Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 1 addition & 15 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,4 @@ jobs:
- name: Run tests with coverage
run: |
mkdir -p build
vendor/bin/phpunit \
--coverage-text \
--coverage-clover build/coverage.xml

- name: Upload coverage artifact
uses: actions/upload-artifact@v4
with:
name: coverage-clover
path: build/coverage.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: build/coverage.xml
fail_ci_if_error: true
vendor/bin/phpunit
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
HTTP client for **Yandex Cloud Vision OCR** (sync + async). Designed as a small, predictable, PSR-friendly Composer library with clear errors, DTOs, and optional concurrency via a runner interface.

<p align="center">
<a href="https://github.com/php-vision/ya-ocr-sdk/actions"><img src="https://github.com/php-vision/ya-ocr-sdk/actions/workflows/ci-tests.yml/badge.svg" alt="Tests status"></a>
<a href="https://github.com/php-vision/ya-ocr-sdk/actions"><img src="https://github.com/php-vision/ya-ocr-sdk/actions/workflows/ci-test.yml/badge.svg" alt="Tests status"></a>
<a href="https://packagist.org/packages/php-vision/ya-ocr-sdk"><img src="https://img.shields.io/packagist/v/php-vision/ya-ocr-sdk.svg" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/php-vision/ya-ocr-sdk"><img src="https://img.shields.io/packagist/l/php-vision/ya-ocr-sdk.svg" alt="License"></a>
</p>
Expand Down
37 changes: 0 additions & 37 deletions src/Ocr/Command/GetOperationCommand.php

This file was deleted.

39 changes: 0 additions & 39 deletions src/Ocr/Command/GetRecognitionCommand.php

This file was deleted.

36 changes: 0 additions & 36 deletions src/Ocr/Command/RecognizeTextCommand.php

This file was deleted.

42 changes: 0 additions & 42 deletions src/Ocr/Command/StartTextRecognitionCommand.php

This file was deleted.

81 changes: 0 additions & 81 deletions src/Ocr/Command/WaitCommand.php

This file was deleted.

2 changes: 1 addition & 1 deletion src/Dto/OcrResponse.php → src/Ocr/Dto/OcrResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace PhpVision\YandexVision\Dto;
namespace PhpVision\YandexVision\Ocr\Dto;

final readonly class OcrResponse
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace PhpVision\YandexVision\Dto;
namespace PhpVision\YandexVision\Ocr\Dto;

final readonly class OperationStatus
{
Expand Down
16 changes: 15 additions & 1 deletion src/Ocr/OcrHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace PhpVision\YandexVision\Ocr;

use PhpVision\YandexVision\Ocr\Request\OcrRequestInterface;
use PhpVision\YandexVision\Exception\ApiException;
use PhpVision\YandexVision\Exception\HttpException;
use PhpVision\YandexVision\Exception\ValidationException;
Expand All @@ -22,12 +23,25 @@ public function __construct(
) {
}

/**
* @return array{0: array<string, mixed>, 1: array<string, mixed>}
*/
public function send(OcrRequestInterface $request): array
{
return $this->sendJsonRequest(
$request->getMethod(),
$request->getUrl(),
$request->getHeaders(),
$request->getBody()
);
}

/**
* @param array<string, string> $headers
* @param array<string, mixed>|null $body
* @return array{0: array<string, mixed>, 1: array<string, mixed>}
*/
public function sendJsonRequest(string $method, string $url, array $headers, ?array $body): array
private function sendJsonRequest(string $method, string $url, array $headers, ?array $body): array
{
$request = $this->requestFactory->createRequest($method, $url);
foreach ($headers as $name => $value) {
Expand Down
Loading