<commit_before><?php

use Rokka\Client\Core\DynamicMetadata\SubjectArea;
use Rokka\Client\Core\SourceImage;

class SourceImageTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @return array
     */
    public function createFromJsonDataProvider()
    {
        $imageReverser = function (SourceImage $image) {
            $data = [
                'organization' => $image->organization,
                'binary_hash' => $image->binaryHash,
                'hash' => $image->hash,
                'name' => $image->name,
                'format' => $image->format,
                'size' => $image->size,
                'width' => $image->width,
                'height' => $image->height,
                'user_metadata' => $image->userMetadata,
                'dynamic_metadata' => [],
                'created' => $image->created->format(DateTime::RFC3339),
                'link' => $image->link,
            ];

            foreach ($image->dynamicMetadata as $name => $meta) {
                $metaAsArray = [];
                if ($meta instanceof SubjectArea) {
                    $metaAsArray = ['width' => $meta->width, 'height' => $meta->height, 'x' => $meta->x, 'y' => $meta->y];
                }
                $data['dynamic_metadata'][$name] = $metaAsArray;
            }

            return $data;
        };

        $testData = [];

        $image = new SourceImage('organization', 'binaryHash', 'hash', 'name', 'format', 'size', 'width', 'height', [], [], new DateTime(), 'link');
        $testData['base-image'] = [
            $image, $imageReverser($image), true,
        ];

        $image = new SourceImage('organization', 'binaryHash', 'hash', 'name', 'format', 'size', 'width', 'height', [], [], new DateTime(), 'link');
        $testData['base-image-json'] = [
            $image, json_encode($imageReverser($image)),
        ];

        $subjectAres = new SubjectArea(10, 10, 100, 100);
        $image = new SourceImage('organization', 'binaryHash', 'hash', 'name', 'format', 'size', 'width', 'height', [], ['subject_area' => $subjectAres], new DateTime(), 'link');<commit_msg>fix microseconds problem on tests for 7.1<commit_after><?php

use Rokka\Client\Core\DynamicMetadata\SubjectArea;
use Rokka\Client\Core\SourceImage;

class SourceImageTest extends \PHPUnit_Framework_TestCase
{
    /**
     * @return array
     */
    public function createFromJsonDataProvider()
    {
        $imageReverser = function (SourceImage $image) {
            $data = [
                'organization' => $image->organization,
                'binary_hash' => $image->binaryHash,
                'hash' => $image->hash,
                'name' => $image->name,
                'format' => $image->format,
                'size' => $image->size,
                'width' => $image->width,
                'height' => $image->height,
                'user_metadata' => $image->userMetadata,
                'dynamic_metadata' => [],
                'created' => $image->created->format("Y-m-d\TH:i:s.uP"),
                'link' => $image->link,
            ];

            foreach ($image->dynamicMetadata as $name => $meta) {
                $metaAsArray = [];
                if ($meta instanceof SubjectArea) {
                    $metaAsArray = ['width' => $meta->width, 'height' => $meta->height, 'x' => $meta->x, 'y' => $meta->y];
                }
                $data['dynamic_metadata'][$name] = $metaAsArray;
            }

            return $data;
        };

        $testData = [];

        $image = new SourceImage('organization', 'binaryHash', 'hash', 'name', 'format', 'size', 'width', 'height', [], [], new DateTime(), 'link');
        $testData['base-image'] = [
            $image, $imageReverser($image), true,
        ];

        $image = new SourceImage('organization', 'binaryHash', 'hash', 'name', 'format', 'size', 'width', 'height', [], [], new DateTime(), 'link');
        $testData['base-image-json'] = [
            $image, json_encode($imageReverser($image)),
        ];

        $subjectAres = new SubjectArea(10, 10, 100, 100);
        $image = new SourceImage('organization', 'binaryHash', 'hash', 'name', 'format', 'size', 'width', 'height', [], ['subject_area' => $subjectAres], new DateTime(), 'link');
{'fraction_non_alphanumeric': 0.18269230769230768, 'fraction_numerical': 0.006097560975609756, 'mean_word_length': 2.099563953488372, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 73, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6320572', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1183, 'n_words': 245}