diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c40bc61..1eee43e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -19,16 +19,18 @@ jobs: - name: Setup uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: 8.3 extensions: mbstring, fileinfo, json, intl, dom + tools: castor - name: Run composer install run: composer install -n --prefer-dist - - name: 'php-cs-fixer check' - run: 'vendor/bin/php-cs-fixer fix --dry-run --diff' - env: - PHP_CS_FIXER_IGNORE_ENV: 1 + - name: Install qa tooling + run: castor qa:update + + - name: Check coding standards + run: castor qa:cs --dry-run tests: name: Run tests for PHP ${{ matrix.php-versions }} @@ -36,7 +38,7 @@ jobs: strategy: max-parallel: 15 matrix: - php-versions: ['8.0', '8.1', '8.2'] + php-versions: ['8.1', '8.2', '8.3'] steps: - name: Checkout uses: actions/checkout@v3 @@ -52,9 +54,10 @@ jobs: with: php-version: ${{ matrix.php-versions }} extensions: mbstring, fileinfo, json, intl, dom + tools: castor - name: Run composer install run: composer install -n --prefer-dist - name: Run tests - run: make test + run: castor qa:test diff --git a/.gitignore b/.gitignore index 3012f3f..2cf940c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# Castor +/.castor.stub.php + # Composer composer.lock composer.phar diff --git a/CHANGELOG.md b/CHANGELOG.md index 835e981..d45c7f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,23 +1,30 @@ # Changes between versions +## 7.0.0 (2024-03-29) + + * upgrade to `janephp/open-api` 7.6 + * drop support for PHP <8.1 + * update the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#28 in #47 + * switch to [Castor](https://castor.jolicode.com/) for the project tooling + ## 6.3.0 (2023-08-17) - * updated the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#27 in #44 - * updated the spec according to the current documentation - * fixed several definitions + * update the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#27 in #44 + * update the spec according to the current documentation + * fix several definitions ## 6.2.0 (2023-04-19) * upgrade to `janephp/open-api` 7.4 - * updated the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#26 in #43 + * update the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#26 in #43 * support for the newly introduced pagination cursors - * updated descriptions according to the docs + * update descriptions according to the docs * add `TimeReportsResult.weekly_capacity` and `TimeReportsResult.avatar_url` * bump the minimum required PHP version ## 6.1.0 (2022-11-12) - * updated the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#22 in #41 + * update the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#22 in #41 * add support for `User.access_roles` as defined in https://help.getharvest.com/api-v2/users-api/users/users/#access-roles * remove the now non-working `User.is_admin` and `User.is_project_manager` booleans * add management of users assigned team mates, as defined in https://help.getharvest.com/api-v2/users-api/users/teammates/ @@ -27,28 +34,28 @@ * upgrade to `janephp/open-api` 7.3 * drop support for PHP <7.4 - * updated the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#20 - * added `Company.currency_code_display` and `Company.currency_symbol_display` - * several fields of the `User` object have disappeared, due to the [API changes introduced in March](https://www.getharvest.com/blog/new-flexible-permissions#:~:text=The%20API%20has%20been%20updated%20to%20align%20with%20the%20new%20permissions%20features.). + * update the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#20 + * add `Company.currency_code_display` and `Company.currency_symbol_display` + * several fields of the `User` object have disappeared, due to the [API changes introduced in March](https://www.getharvest.com/blog/new-flexible-permissions#:~:text=The%20API%20has%20been%20update%20to%20align%20with%20the%20new%20permissions%20features.).  ## 5.2.0 (2022-01-10) - * upgraded `janephp/open-api` from 6.3 to 7.1 - thanks @jdrieghe - * added support for Symfony 6 - * updated the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#19 - * added support for `User.telephone` + * upgrade `janephp/open-api` from 6.3 to 7.1 - thanks @jdrieghe + * add support for Symfony 6 + * update the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#19 + * add support for `User.telephone` ## 5.1.0 (2021-08-03) - * updated the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#18 - * added `date_format` on the `Company` model - * added `hours_without_timer` and `external_reference/account_id` in the `TaskAssignment` model + * update the SDK based on the latest spec updates - see jolicode/harvest-openapi-generator#18 + * add `date_format` on the `Company` model + * add `hours_without_timer` and `external_reference/account_id` in the `TaskAssignment` model ## 5.0.0 (2021-04-10) * add tests on the API * support PHP 7.2 to PHP 8.0 - * migrated the openapi spec to open api 3 + * migrate the openapi spec to open api 3 ## 4.3.0 (2021-01-18) @@ -64,55 +71,55 @@ * use Jane 6 Authentication plugins * upgrade to `janephp/open-api` 6.1 - * regenerated SDK - * fixed the `jane-php/open-api-runtime` dependency to a minor version, in order to avoid situations where a jane-php update would break things + * regenerate SDK + * fix the `jane-php/open-api-runtime` dependency to a minor version, in order to avoid situations where a jane-php update would break things ## 4.0.1 (2020-07-30) * upgrade to `janephp/open-api` 6.0 - * fixed boolean query parameters serialization + * fix boolean query parameters serialization ## 4.0.0 (2020-05-14) - * fixed several endpoint names - * removed missnamed endpoints + * fix several endpoint names + * remove missnamed endpoints * [documented all the available operations](doc/index.md) ## 3.0.3 (2020-02-25) - * fixed plural definition names for reports Schemas + * fix plural definition names for reports Schemas ## 3.0.2 (2020-02-25) - * Added Schemas for the "reports" endpoints + * add Schemas for the "reports" endpoints ## 3.0.1 (2020-02-25) - * fixed the location of reports endpoints parameters + * fix the location of reports endpoints parameters ## 3.0.0 (2020-02-21) * upgrade to `janephp/open-api` 5.3 - * updated the SDK based on the latest [spec updates](https://github.com/jolicode/harvest-openapi-generator/pull/9): + * update the SDK based on the latest [spec updates](https://github.com/jolicode/harvest-openapi-generator/pull/9): * add the ability to filter time entries by `task_id` * several new "report" endpoints * support for `rounded_hours` in the `TimeEntry` model ## 2.1.0 (2020-01-14) - * updated the OpenAPI definition file - * added the "company update" endpoint - * updated the endpoints documentation according to Harvest's API doc - * added the `Company` `weekly_capacity` attribute - * added the `Invoice` `recurring_invoice_id` attribute + * update the OpenAPI definition file + * add the "company update" endpoint + * update the endpoints documentation according to Harvest's API doc + * add the `Company` `weekly_capacity` attribute + * add the `Invoice` `recurring_invoice_id` attribute ## 2.0.0 (2019-10-28) - * Upgrade Jane to 4.5 https://github.com/janephp/janephp/releases/tag/v4.5.3, the new generated classes have better PHPDoc​ - * Generate PSR-18 client instead of HttPlug client - * Support for cost and billable rates - * Removed the telephone property from the user model - * Added statement_key in the Client properties + * upgrade Jane to 4.5 https://github.com/janephp/janephp/releases/tag/v4.5.3, the new generated classes have better PHPDoc​ + * generate PSR-18 client instead of HttPlug client + * support for cost and billable rates + * remove the telephone property from the user model + * add statement_key in the Client properties ## 1.1.0 (2019-04-01) @@ -121,11 +128,11 @@ ## 1.0.2 (2019-01-24) * support null values for nested objects or values (jane-openapi strict mode false) - * changed `quantity` types to `float` instead of `integer` + * change `quantity` types to `float` instead of `integer` ## 1.0.1 (2019-01-22) - * Fixed the `deleteTimeEntryExternalReference` endpoint operationId + * fix the `deleteTimeEntryExternalReference` endpoint operationId ## 1.0.0 (2019-01-21) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1340093..8bdc6c8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,7 +48,7 @@ Use [PHP CS fixer](http://cs.sensiolabs.org/) to make your code compliant with our coding standards: ```shell -make cs +castor qa:cs ``` ## Keeping your fork up-to-date diff --git a/Makefile b/Makefile deleted file mode 100644 index 5a07919..0000000 --- a/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -cs: ## Fix CS violations - ./vendor/bin/php-cs-fixer fix --verbose - -cs_dry_run: ## Display CS violations without fixing it - ./vendor/bin/php-cs-fixer fix --verbose --dry-run - -test: ## Run tests - ./vendor/bin/simple-phpunit - -update_sdk: ## Downloads the last specification and re-generates the SDK - curl https://raw.githubusercontent.com/jolicode/harvest-openapi-generator/master/generated/harvest-openapi.yaml -o Resources/harvest-openapi.yaml - ./vendor/bin/jane-openapi generate -c .jane-openapi.php - -.PHONY: help - -help: ## Display this help - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' - -.DEFAULT_GOAL := help diff --git a/Resources/harvest-openapi.yaml b/Resources/harvest-openapi.yaml index 462d67e..302d7d8 100644 --- a/Resources/harvest-openapi.yaml +++ b/Resources/harvest-openapi.yaml @@ -1044,7 +1044,7 @@ components: nullable: true is_closed: type: boolean - description: 'Whether the expense has been approved or closed for some other reason.' + description: 'Whether the expense has been approved or not.' nullable: true is_locked: type: boolean @@ -1293,7 +1293,7 @@ components: nullable: true timer_started_at: type: string - description: 'Date and time the timer was started (if tracking by duration). Use the ISO 8601 Format.' + description: 'Date and time the running timer was started (if tracking by duration). Use the ISO 8601 Format. Returns null for stopped timers.' nullable: true format: date-time started_time: @@ -7330,6 +7330,10 @@ paths: type: string description: 'Any notes to be associated with the payment.' nullable: true + send_thank_you: + type: boolean + description: 'Whether or not to send a thank you email (if enabled for your account in Invoices > Configure > Messages). Only sends an email if the invoice will be fully paid after creating this payment. Defaults to true.' + nullable: true required: - amount '/invoices/{invoiceId}/payments/{paymentId}': @@ -9126,6 +9130,13 @@ paths: in: query schema: type: string + - + name: include_fixed_fee + description: 'When true, billable amounts will be calculated and included for fixed fee projects.' + required: false + in: query + schema: + type: string - name: page description: 'The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1)' @@ -9220,6 +9231,13 @@ paths: in: query schema: type: string + - + name: include_fixed_fee + description: 'When true, billable amounts will be calculated and included for fixed fee projects.' + required: false + in: query + schema: + type: string - name: page description: 'The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1)' @@ -9322,6 +9340,13 @@ paths: in: query schema: type: string + - + name: include_fixed_fee + description: 'When true, billable amounts will be calculated and included for fixed fee projects.' + required: false + in: query + schema: + type: string - name: page description: 'The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1)' @@ -9419,6 +9444,13 @@ paths: in: query schema: type: string + - + name: include_fixed_fee + description: 'When true, billable amounts will be calculated and included for fixed fee projects.' + required: false + in: query + schema: + type: string - name: page description: 'The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1)' diff --git a/castor.php b/castor.php new file mode 100644 index 0000000..a52cea0 --- /dev/null +++ b/castor.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace sdk; + +use Castor\Attribute\AsTask; + +use function Castor\exit_code; +use function Castor\fs; +use function Castor\import; +use function Castor\io; +use function Castor\request; + +import(__DIR__.'/tools/php-cs-fixer/castor.php'); + +const SPEC_URL = 'https://raw.githubusercontent.com/jolicode/harvest-openapi-generator/master/generated/harvest-openapi.yaml'; + +#[AsTask(description: 'Downloads the last specification and re-generates the SDK', aliases: ['update'])] +function update(): int +{ + update_specification(); + + return generate(); +} + +#[AsTask(description: 'Downloads the last specification from Github')] +function update_specification(): void +{ + io()->comment(sprintf('Download the spec from %s', SPEC_URL)); + fs()->dumpFile( + 'Resources/harvest-openapi.yaml', + request('GET', SPEC_URL)->getContent() + ); + io()->success('Successfully updated the OpenAPI specification file.'); +} + +#[AsTask(description: 'Re-generates the SDK using the local specification')] +function generate(): int +{ + io()->comment('Generating the SDK using Jane OpenAPI...'); + $result = exit_code('./vendor/bin/jane-openapi generate -c .jane-openapi.php'); + + if (0 !== $result) { + io()->error('An error occurred while generating the SDK.'); + } else { + io()->success('Successfully generated the SDK'); + } + + return $result; +} + +#[AsTask(description: 'Runs the test suite', namespace: 'qa')] +function test(): int +{ + return exit_code('./vendor/bin/simple-phpunit'); +} diff --git a/composer.json b/composer.json index b1b94d9..2a1eb92 100644 --- a/composer.json +++ b/composer.json @@ -22,18 +22,17 @@ } }, "require": { - "php": ">=8.0", - "jane-php/open-api-runtime": "^7.4", + "php": ">=8.1", + "jane-php/open-api-runtime": "^7.6", "php-http/client-implementation": "*", "php-http/client-common": "^1.9 || ^2.0" }, "require-dev": { - "jane-php/open-api-3": "^7.4", - "symfony/http-client": "^5.4 || ^6.0", - "nyholm/psr7": "^1.3", - "friendsofphp/php-cs-fixer": "^3.2", - "symfony/phpunit-bridge": "^5.4 || ^6.0", - "symfony/yaml": "^5.4 || ^6.0" + "jane-php/open-api-3": "^7.6", + "symfony/http-client": "^5.4 || ^6.0 || ^7.0", + "nyholm/psr7": "^1.6", + "symfony/phpunit-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, "config": { "allow-plugins": { diff --git a/doc/updating-sdk.md b/doc/updating-sdk.md index 1caef72..74f3b9d 100644 --- a/doc/updating-sdk.md +++ b/doc/updating-sdk.md @@ -1,5 +1,10 @@ # Updating the SDK +> [!NOTE] +> The tooling for this project uses [Castor](https://castor.jolicode.com/), +> a full-featured PHP task runner. In order to install Castor, see the +> [installation instructions](https://castor.jolicode.com/getting-started/installation/). + ## Fetch the latest OpenAPI specification version This library is generated using an OpenApi definition which is itself @@ -8,23 +13,28 @@ generated. Therefore, you should not manually change the generated in the [jolicode/harvest-openapi-generator](https://github.com/jolicode/harvest-openapi-generator) repository. -You can update the SDK to the last available specification version by running the following command: +You can update the SDK to the last available specification version by +running the following command: ```bash -make update_sdk +castor update ``` +This will both update the specification and re-generate the library code. Once done, you can run tests against the library: ```bash -make tests +castor qa:test ``` +If you wish to open a pull-request, please follow the [contribution guidelines](CONTRIBUTING.md). + ### Detailed steps -Updating the SDK "by hand" requires to download the last specification version and re-generate the library code (trhis is basically what `make update_sdk` does): +Updating the SDK "by hand" requires to download the last specification version +and re-generate the library code. This can be done with the following commands: ```bash -curl https://raw.githubusercontent.com/jolicode/harvest-openapi-generator/master/generated/harvest-openapi.yaml -o Resources/harvest-openapi.yaml -./vendor/bin/jane-openapi generate -c .jane-openapi.php +castor sdk:update-specification +castor sdk:generate ``` diff --git a/generated/Client.php b/generated/Client.php index 58864ca..edbdef2 100644 --- a/generated/Client.php +++ b/generated/Client.php @@ -11,7 +11,7 @@ namespace JoliCode\Harvest\Api; -class Client extends \JoliCode\Harvest\Api\Runtime\Client\Client +class Client extends Runtime\Client\Client { /** * Returns a list of your clients. The clients are returned sorted by creation date, with the most recently created clients appearing first. @@ -29,11 +29,11 @@ class Client extends \JoliCode\Harvest\Api\Runtime\Client\Client * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Clients|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Clients|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listClients(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListClients($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListClients($queryParameters), $fetch); } /** @@ -41,11 +41,11 @@ public function listClients(array $queryParameters = [], string $fetch = self::F * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Client|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Client|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createClient(Model\ClientsPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateClient($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateClient($requestBody), $fetch); } /** @@ -53,11 +53,11 @@ public function createClient(Model\ClientsPostBody $requestBody, string $fetch = * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteClient(string $clientId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteClient($clientId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteClient($clientId), $fetch); } /** @@ -65,11 +65,11 @@ public function deleteClient(string $clientId, string $fetch = self::FETCH_OBJEC * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Client|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Client|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveClient(string $clientId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveClient($clientId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveClient($clientId), $fetch); } /** @@ -77,21 +77,21 @@ public function retrieveClient(string $clientId, string $fetch = self::FETCH_OBJ * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Client|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Client|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateClient(string $clientId, Model\ClientsClientIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateClient($clientId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateClient($clientId, $requestBody), $fetch); } /** * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Company|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Company|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveCompany(string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveCompany(), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveCompany(), $fetch); } /** @@ -99,11 +99,11 @@ public function retrieveCompany(string $fetch = self::FETCH_OBJECT) * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Company|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Company|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateCompany(Model\CompanyPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateCompany($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateCompany($requestBody), $fetch); } /** @@ -122,11 +122,11 @@ public function updateCompany(Model\CompanyPatchBody $requestBody, string $fetch * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Contacts|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Contacts|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listContacts(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListContacts($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListContacts($queryParameters), $fetch); } /** @@ -134,11 +134,11 @@ public function listContacts(array $queryParameters = [], string $fetch = self:: * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Contact|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Contact|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createContact(Model\ContactsPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateContact($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateContact($requestBody), $fetch); } /** @@ -146,11 +146,11 @@ public function createContact(Model\ContactsPostBody $requestBody, string $fetch * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteContact(string $contactId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteContact($contactId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteContact($contactId), $fetch); } /** @@ -158,11 +158,11 @@ public function deleteContact(string $contactId, string $fetch = self::FETCH_OBJ * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Contact|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Contact|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveContact(string $contactId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveContact($contactId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveContact($contactId), $fetch); } /** @@ -170,11 +170,11 @@ public function retrieveContact(string $contactId, string $fetch = self::FETCH_O * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Contact|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Contact|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateContact(string $contactId, Model\ContactsContactIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateContact($contactId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateContact($contactId, $requestBody), $fetch); } /** @@ -192,11 +192,11 @@ public function updateContact(string $contactId, Model\ContactsContactIdPatchBod * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\EstimateItemCategories|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\EstimateItemCategories|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listEstimateItemCategories(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListEstimateItemCategories($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListEstimateItemCategories($queryParameters), $fetch); } /** @@ -204,11 +204,11 @@ public function listEstimateItemCategories(array $queryParameters = [], string $ * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\EstimateItemCategory|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\EstimateItemCategory|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createEstimateItemCategory(Model\EstimateItemCategoriesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateEstimateItemCategory($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateEstimateItemCategory($requestBody), $fetch); } /** @@ -216,11 +216,11 @@ public function createEstimateItemCategory(Model\EstimateItemCategoriesPostBody * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteEstimateItemCategory(string $estimateItemCategoryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteEstimateItemCategory($estimateItemCategoryId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteEstimateItemCategory($estimateItemCategoryId), $fetch); } /** @@ -228,11 +228,11 @@ public function deleteEstimateItemCategory(string $estimateItemCategoryId, strin * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\EstimateItemCategory|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\EstimateItemCategory|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveEstimateItemCategory(string $estimateItemCategoryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveEstimateItemCategory($estimateItemCategoryId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveEstimateItemCategory($estimateItemCategoryId), $fetch); } /** @@ -240,11 +240,11 @@ public function retrieveEstimateItemCategory(string $estimateItemCategoryId, str * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\EstimateItemCategory|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\EstimateItemCategory|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateEstimateItemCategory(string $estimateItemCategoryId, Model\EstimateItemCategoriesEstimateItemCategoryIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateEstimateItemCategory($estimateItemCategoryId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateEstimateItemCategory($estimateItemCategoryId, $requestBody), $fetch); } /** @@ -265,11 +265,11 @@ public function updateEstimateItemCategory(string $estimateItemCategoryId, Model * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Estimates|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Estimates|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listEstimates(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListEstimates($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListEstimates($queryParameters), $fetch); } /** @@ -277,11 +277,11 @@ public function listEstimates(array $queryParameters = [], string $fetch = self: * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Estimate|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Estimate|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createEstimate(Model\EstimatesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateEstimate($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateEstimate($requestBody), $fetch); } /** @@ -289,11 +289,11 @@ public function createEstimate(Model\EstimatesPostBody $requestBody, string $fet * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteEstimate(string $estimateId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteEstimate($estimateId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteEstimate($estimateId), $fetch); } /** @@ -301,11 +301,11 @@ public function deleteEstimate(string $estimateId, string $fetch = self::FETCH_O * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Estimate|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Estimate|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveEstimate(string $estimateId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveEstimate($estimateId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveEstimate($estimateId), $fetch); } /** @@ -313,11 +313,11 @@ public function retrieveEstimate(string $estimateId, string $fetch = self::FETCH * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Estimate|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Estimate|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateEstimate(string $estimateId, Model\EstimatesEstimateIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateEstimate($estimateId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateEstimate($estimateId, $requestBody), $fetch); } /** @@ -335,11 +335,11 @@ public function updateEstimate(string $estimateId, Model\EstimatesEstimateIdPatc * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\EstimateMessages|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\EstimateMessages|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listMessagesForEstimate(string $estimateId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListMessagesForEstimate($estimateId, $queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListMessagesForEstimate($estimateId, $queryParameters), $fetch); } /** @@ -347,11 +347,11 @@ public function listMessagesForEstimate(string $estimateId, array $queryParamete * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\EstimateMessage|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\EstimateMessage|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createEstimateMessage(string $estimateId, Model\EstimatesEstimateIdMessagesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateEstimateMessage($estimateId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateEstimateMessage($estimateId, $requestBody), $fetch); } /** @@ -359,11 +359,11 @@ public function createEstimateMessage(string $estimateId, Model\EstimatesEstimat * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteEstimateMessage(string $estimateId, string $messageId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteEstimateMessage($estimateId, $messageId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteEstimateMessage($estimateId, $messageId), $fetch); } /** @@ -382,11 +382,11 @@ public function deleteEstimateMessage(string $estimateId, string $messageId, str * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ExpenseCategories|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ExpenseCategories|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listExpenseCategories(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListExpenseCategories($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListExpenseCategories($queryParameters), $fetch); } /** @@ -394,11 +394,11 @@ public function listExpenseCategories(array $queryParameters = [], string $fetch * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ExpenseCategory|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ExpenseCategory|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createExpenseCategory(Model\ExpenseCategoriesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateExpenseCategory($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateExpenseCategory($requestBody), $fetch); } /** @@ -406,11 +406,11 @@ public function createExpenseCategory(Model\ExpenseCategoriesPostBody $requestBo * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteExpenseCategory(string $expenseCategoryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteExpenseCategory($expenseCategoryId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteExpenseCategory($expenseCategoryId), $fetch); } /** @@ -418,11 +418,11 @@ public function deleteExpenseCategory(string $expenseCategoryId, string $fetch = * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ExpenseCategory|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ExpenseCategory|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveExpenseCategory(string $expenseCategoryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveExpenseCategory($expenseCategoryId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveExpenseCategory($expenseCategoryId), $fetch); } /** @@ -430,11 +430,11 @@ public function retrieveExpenseCategory(string $expenseCategoryId, string $fetch * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ExpenseCategory|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ExpenseCategory|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateExpenseCategory(string $expenseCategoryId, Model\ExpenseCategoriesExpenseCategoryIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateExpenseCategory($expenseCategoryId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateExpenseCategory($expenseCategoryId, $requestBody), $fetch); } /** @@ -457,11 +457,11 @@ public function updateExpenseCategory(string $expenseCategoryId, Model\ExpenseCa * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Expenses|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Expenses|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listExpenses(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListExpenses($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListExpenses($queryParameters), $fetch); } /** @@ -469,11 +469,11 @@ public function listExpenses(array $queryParameters = [], string $fetch = self:: * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Expense|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Expense|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createExpense(Model\ExpensesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateExpense($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateExpense($requestBody), $fetch); } /** @@ -481,11 +481,11 @@ public function createExpense(Model\ExpensesPostBody $requestBody, string $fetch * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteExpense(string $expenseId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteExpense($expenseId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteExpense($expenseId), $fetch); } /** @@ -493,11 +493,11 @@ public function deleteExpense(string $expenseId, string $fetch = self::FETCH_OBJ * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Expense|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Expense|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveExpense(string $expenseId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveExpense($expenseId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveExpense($expenseId), $fetch); } /** @@ -505,11 +505,11 @@ public function retrieveExpense(string $expenseId, string $fetch = self::FETCH_O * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Expense|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Expense|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateExpense(string $expenseId, Model\ExpensesExpenseIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateExpense($expenseId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateExpense($expenseId, $requestBody), $fetch); } /** @@ -527,11 +527,11 @@ public function updateExpense(string $expenseId, Model\ExpensesExpenseIdPatchBod * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\InvoiceItemCategories|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\InvoiceItemCategories|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listInvoiceItemCategories(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListInvoiceItemCategories($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListInvoiceItemCategories($queryParameters), $fetch); } /** @@ -539,11 +539,11 @@ public function listInvoiceItemCategories(array $queryParameters = [], string $f * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\InvoiceItemCategory|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\InvoiceItemCategory|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createInvoiceItemCategory(Model\InvoiceItemCategoriesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateInvoiceItemCategory($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateInvoiceItemCategory($requestBody), $fetch); } /** @@ -551,11 +551,11 @@ public function createInvoiceItemCategory(Model\InvoiceItemCategoriesPostBody $r * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteInvoiceItemCategory(string $invoiceItemCategoryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteInvoiceItemCategory($invoiceItemCategoryId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteInvoiceItemCategory($invoiceItemCategoryId), $fetch); } /** @@ -563,11 +563,11 @@ public function deleteInvoiceItemCategory(string $invoiceItemCategoryId, string * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\InvoiceItemCategory|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\InvoiceItemCategory|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveInvoiceItemCategory(string $invoiceItemCategoryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveInvoiceItemCategory($invoiceItemCategoryId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveInvoiceItemCategory($invoiceItemCategoryId), $fetch); } /** @@ -575,11 +575,11 @@ public function retrieveInvoiceItemCategory(string $invoiceItemCategoryId, strin * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\InvoiceItemCategory|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\InvoiceItemCategory|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateInvoiceItemCategory(string $invoiceItemCategoryId, Model\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateInvoiceItemCategory($invoiceItemCategoryId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateInvoiceItemCategory($invoiceItemCategoryId, $requestBody), $fetch); } /** @@ -601,11 +601,11 @@ public function updateInvoiceItemCategory(string $invoiceItemCategoryId, Model\I * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Invoices|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Invoices|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listInvoices(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListInvoices($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListInvoices($queryParameters), $fetch); } /** @@ -613,11 +613,11 @@ public function listInvoices(array $queryParameters = [], string $fetch = self:: * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Invoice|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Invoice|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createInvoice(Model\InvoicesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateInvoice($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateInvoice($requestBody), $fetch); } /** @@ -625,11 +625,11 @@ public function createInvoice(Model\InvoicesPostBody $requestBody, string $fetch * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteInvoice(string $invoiceId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteInvoice($invoiceId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteInvoice($invoiceId), $fetch); } /** @@ -637,11 +637,11 @@ public function deleteInvoice(string $invoiceId, string $fetch = self::FETCH_OBJ * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Invoice|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Invoice|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveInvoice(string $invoiceId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveInvoice($invoiceId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveInvoice($invoiceId), $fetch); } /** @@ -649,11 +649,11 @@ public function retrieveInvoice(string $invoiceId, string $fetch = self::FETCH_O * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Invoice|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Invoice|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateInvoice(string $invoiceId, Model\InvoicesInvoiceIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateInvoice($invoiceId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateInvoice($invoiceId, $requestBody), $fetch); } /** @@ -671,11 +671,11 @@ public function updateInvoice(string $invoiceId, Model\InvoicesInvoiceIdPatchBod * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\InvoiceMessages|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\InvoiceMessages|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listMessagesForInvoice(string $invoiceId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListMessagesForInvoice($invoiceId, $queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListMessagesForInvoice($invoiceId, $queryParameters), $fetch); } /** @@ -683,11 +683,11 @@ public function listMessagesForInvoice(string $invoiceId, array $queryParameters * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\InvoiceMessage|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\InvoiceMessage|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createInvoiceMessage(string $invoiceId, Model\InvoicesInvoiceIdMessagesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateInvoiceMessage($invoiceId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateInvoiceMessage($invoiceId, $requestBody), $fetch); } /** @@ -701,11 +701,11 @@ public function createInvoiceMessage(string $invoiceId, Model\InvoicesInvoiceIdM * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\InvoiceMessageSubjectAndBody|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\InvoiceMessageSubjectAndBody|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveInvoiceMessageSubjectAndBodyForSpecificInvoice(string $invoiceId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveInvoiceMessageSubjectAndBodyForSpecificInvoice($invoiceId, $queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveInvoiceMessageSubjectAndBodyForSpecificInvoice($invoiceId, $queryParameters), $fetch); } /** @@ -713,11 +713,11 @@ public function retrieveInvoiceMessageSubjectAndBodyForSpecificInvoice(string $i * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteInvoiceMessage(string $invoiceId, string $messageId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteInvoiceMessage($invoiceId, $messageId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteInvoiceMessage($invoiceId, $messageId), $fetch); } /** @@ -735,11 +735,11 @@ public function deleteInvoiceMessage(string $invoiceId, string $messageId, strin * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\InvoicePayments|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\InvoicePayments|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listPaymentsForInvoice(string $invoiceId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListPaymentsForInvoice($invoiceId, $queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListPaymentsForInvoice($invoiceId, $queryParameters), $fetch); } /** @@ -747,11 +747,11 @@ public function listPaymentsForInvoice(string $invoiceId, array $queryParameters * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\InvoicePayment|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\InvoicePayment|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createInvoicePayment(string $invoiceId, Model\InvoicesInvoiceIdPaymentsPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateInvoicePayment($invoiceId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateInvoicePayment($invoiceId, $requestBody), $fetch); } /** @@ -759,11 +759,11 @@ public function createInvoicePayment(string $invoiceId, Model\InvoicesInvoiceIdP * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteInvoicePayment(string $invoiceId, string $paymentId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteInvoicePayment($invoiceId, $paymentId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteInvoicePayment($invoiceId, $paymentId), $fetch); } /** @@ -783,11 +783,11 @@ public function deleteInvoicePayment(string $invoiceId, string $paymentId, strin * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Projects|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Projects|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listProjects(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListProjects($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListProjects($queryParameters), $fetch); } /** @@ -795,11 +795,11 @@ public function listProjects(array $queryParameters = [], string $fetch = self:: * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Project|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Project|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createProject(Model\ProjectsPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateProject($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateProject($requestBody), $fetch); } /** @@ -809,11 +809,11 @@ public function createProject(Model\ProjectsPostBody $requestBody, string $fetch * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteProject(string $projectId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteProject($projectId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteProject($projectId), $fetch); } /** @@ -821,11 +821,11 @@ public function deleteProject(string $projectId, string $fetch = self::FETCH_OBJ * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Project|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Project|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveProject(string $projectId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveProject($projectId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveProject($projectId), $fetch); } /** @@ -833,11 +833,11 @@ public function retrieveProject(string $projectId, string $fetch = self::FETCH_O * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Project|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Project|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateProject(string $projectId, Model\ProjectsProjectIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateProject($projectId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateProject($projectId, $requestBody), $fetch); } /** @@ -855,11 +855,11 @@ public function updateProject(string $projectId, Model\ProjectsProjectIdPatchBod * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TaskAssignments|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TaskAssignments|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listTaskAssignmentsForSpecificProject(string $projectId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListTaskAssignmentsForSpecificProject($projectId, $queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListTaskAssignmentsForSpecificProject($projectId, $queryParameters), $fetch); } /** @@ -867,11 +867,11 @@ public function listTaskAssignmentsForSpecificProject(string $projectId, array $ * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TaskAssignment|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TaskAssignment|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createTaskAssignment(string $projectId, Model\ProjectsProjectIdTaskAssignmentsPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateTaskAssignment($projectId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateTaskAssignment($projectId, $requestBody), $fetch); } /** @@ -879,11 +879,11 @@ public function createTaskAssignment(string $projectId, Model\ProjectsProjectIdT * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteTaskAssignment(string $projectId, string $taskAssignmentId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteTaskAssignment($projectId, $taskAssignmentId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteTaskAssignment($projectId, $taskAssignmentId), $fetch); } /** @@ -891,11 +891,11 @@ public function deleteTaskAssignment(string $projectId, string $taskAssignmentId * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TaskAssignment|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TaskAssignment|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveTaskAssignment(string $projectId, string $taskAssignmentId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveTaskAssignment($projectId, $taskAssignmentId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveTaskAssignment($projectId, $taskAssignmentId), $fetch); } /** @@ -903,11 +903,11 @@ public function retrieveTaskAssignment(string $projectId, string $taskAssignment * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TaskAssignment|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TaskAssignment|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateTaskAssignment(string $projectId, string $taskAssignmentId, Model\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateTaskAssignment($projectId, $taskAssignmentId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateTaskAssignment($projectId, $taskAssignmentId, $requestBody), $fetch); } /** @@ -926,11 +926,11 @@ public function updateTaskAssignment(string $projectId, string $taskAssignmentId * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\UserAssignments|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\UserAssignments|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listUserAssignmentsForSpecificProject(string $projectId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListUserAssignmentsForSpecificProject($projectId, $queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListUserAssignmentsForSpecificProject($projectId, $queryParameters), $fetch); } /** @@ -938,11 +938,11 @@ public function listUserAssignmentsForSpecificProject(string $projectId, array $ * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\UserAssignment|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\UserAssignment|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createUserAssignment(string $projectId, Model\ProjectsProjectIdUserAssignmentsPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateUserAssignment($projectId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateUserAssignment($projectId, $requestBody), $fetch); } /** @@ -950,11 +950,11 @@ public function createUserAssignment(string $projectId, Model\ProjectsProjectIdU * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteUserAssignment(string $projectId, string $userAssignmentId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteUserAssignment($projectId, $userAssignmentId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteUserAssignment($projectId, $userAssignmentId), $fetch); } /** @@ -962,11 +962,11 @@ public function deleteUserAssignment(string $projectId, string $userAssignmentId * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\UserAssignment|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\UserAssignment|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveUserAssignment(string $projectId, string $userAssignmentId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveUserAssignment($projectId, $userAssignmentId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveUserAssignment($projectId, $userAssignmentId), $fetch); } /** @@ -974,11 +974,11 @@ public function retrieveUserAssignment(string $projectId, string $userAssignment * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\UserAssignment|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\UserAssignment|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateUserAssignment(string $projectId, string $userAssignmentId, Model\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateUserAssignment($projectId, $userAssignmentId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateUserAssignment($projectId, $userAssignmentId, $requestBody), $fetch); } /** @@ -992,11 +992,11 @@ public function updateUserAssignment(string $projectId, string $userAssignmentId * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ExpenseReportsResults|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ExpenseReportsResults|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function expenseCategoriesReport(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ExpenseCategoriesReport($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ExpenseCategoriesReport($queryParameters), $fetch); } /** @@ -1010,11 +1010,11 @@ public function expenseCategoriesReport(array $queryParameters = [], string $fet * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ExpenseReportsResults|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ExpenseReportsResults|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function clientsExpensesReport(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ClientsExpensesReport($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ClientsExpensesReport($queryParameters), $fetch); } /** @@ -1028,11 +1028,11 @@ public function clientsExpensesReport(array $queryParameters = [], string $fetch * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ExpenseReportsResults|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ExpenseReportsResults|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function projectsExpensesReport(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ProjectsExpensesReport($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ProjectsExpensesReport($queryParameters), $fetch); } /** @@ -1046,11 +1046,11 @@ public function projectsExpensesReport(array $queryParameters = [], string $fetc * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ExpenseReportsResults|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ExpenseReportsResults|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function teamExpensesReport(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\TeamExpensesReport($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\TeamExpensesReport($queryParameters), $fetch); } /** @@ -1065,11 +1065,11 @@ public function teamExpensesReport(array $queryParameters = [], string $fetch = * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ProjectBudgetReportResults|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ProjectBudgetReportResults|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function projectBudgetReport(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ProjectBudgetReport($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ProjectBudgetReport($queryParameters), $fetch); } /** @@ -1077,17 +1077,18 @@ public function projectBudgetReport(array $queryParameters = [], string $fetch = * * @var string $from only report on time entries with a spent_date on or after the given date * @var string $to only report on time entries with a spent_date on or before the given date + * @var string $include_fixed_fee when true, billable amounts will be calculated and included for fixed fee projects * @var int $page The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1) * @var int $per_page The number of records to return per page. Can range between 1 and 2000. (Default: 2000) * } * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TimeReportsResults|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TimeReportsResults|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function clientsTimeReport(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ClientsTimeReport($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ClientsTimeReport($queryParameters), $fetch); } /** @@ -1095,17 +1096,18 @@ public function clientsTimeReport(array $queryParameters = [], string $fetch = s * * @var string $from only report on time entries with a spent_date on or after the given date * @var string $to only report on time entries with a spent_date on or before the given date + * @var string $include_fixed_fee when true, billable amounts will be calculated and included for fixed fee projects * @var int $page The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1) * @var int $per_page The number of records to return per page. Can range between 1 and 2000. (Default: 2000) * } * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TimeReportsResults|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TimeReportsResults|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function projectsTimeReport(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ProjectsTimeReport($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ProjectsTimeReport($queryParameters), $fetch); } /** @@ -1113,17 +1115,18 @@ public function projectsTimeReport(array $queryParameters = [], string $fetch = * * @var string $from only report on time entries with a spent_date on or after the given date * @var string $to only report on time entries with a spent_date on or before the given date + * @var string $include_fixed_fee when true, billable amounts will be calculated and included for fixed fee projects * @var int $page The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1) * @var int $per_page The number of records to return per page. Can range between 1 and 2000. (Default: 2000) * } * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TimeReportsResults|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TimeReportsResults|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function tasksReport(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\TasksReport($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\TasksReport($queryParameters), $fetch); } /** @@ -1131,17 +1134,18 @@ public function tasksReport(array $queryParameters = [], string $fetch = self::F * * @var string $from only report on time entries with a spent_date on or after the given date * @var string $to only report on time entries with a spent_date on or before the given date + * @var string $include_fixed_fee when true, billable amounts will be calculated and included for fixed fee projects * @var int $page The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1) * @var int $per_page The number of records to return per page. Can range between 1 and 2000. (Default: 2000) * } * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TimeReportsResults|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TimeReportsResults|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function teamTimeReport(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\TeamTimeReport($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\TeamTimeReport($queryParameters), $fetch); } /** @@ -1159,11 +1163,11 @@ public function teamTimeReport(array $queryParameters = [], string $fetch = self * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\UninvoicedReportResults|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\UninvoicedReportResults|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function uninvoicedReport(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UninvoicedReport($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\UninvoicedReport($queryParameters), $fetch); } /** @@ -1180,11 +1184,11 @@ public function uninvoicedReport(array $queryParameters = [], string $fetch = se * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Roles|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Roles|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listRoles(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListRoles($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListRoles($queryParameters), $fetch); } /** @@ -1192,11 +1196,11 @@ public function listRoles(array $queryParameters = [], string $fetch = self::FET * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Role|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Role|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createRole(Model\RolesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateRole($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateRole($requestBody), $fetch); } /** @@ -1204,11 +1208,11 @@ public function createRole(Model\RolesPostBody $requestBody, string $fetch = sel * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteRole(string $roleId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteRole($roleId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteRole($roleId), $fetch); } /** @@ -1216,11 +1220,11 @@ public function deleteRole(string $roleId, string $fetch = self::FETCH_OBJECT) * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Role|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Role|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveRole(string $roleId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveRole($roleId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveRole($roleId), $fetch); } /** @@ -1228,11 +1232,11 @@ public function retrieveRole(string $roleId, string $fetch = self::FETCH_OBJECT) * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Role|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Role|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateRole(string $roleId, Model\RolesRoleIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateRole($roleId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateRole($roleId, $requestBody), $fetch); } /** @@ -1251,11 +1255,11 @@ public function updateRole(string $roleId, Model\RolesRoleIdPatchBody $requestBo * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TaskAssignments|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TaskAssignments|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listTaskAssignments(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListTaskAssignments($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListTaskAssignments($queryParameters), $fetch); } /** @@ -1274,11 +1278,11 @@ public function listTaskAssignments(array $queryParameters = [], string $fetch = * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Tasks|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Tasks|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listTasks(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListTasks($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListTasks($queryParameters), $fetch); } /** @@ -1286,11 +1290,11 @@ public function listTasks(array $queryParameters = [], string $fetch = self::FET * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Task|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Task|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createTask(Model\TasksPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateTask($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateTask($requestBody), $fetch); } /** @@ -1298,11 +1302,11 @@ public function createTask(Model\TasksPostBody $requestBody, string $fetch = sel * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteTask(string $taskId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteTask($taskId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteTask($taskId), $fetch); } /** @@ -1310,11 +1314,11 @@ public function deleteTask(string $taskId, string $fetch = self::FETCH_OBJECT) * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Task|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Task|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveTask(string $taskId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveTask($taskId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveTask($taskId), $fetch); } /** @@ -1322,11 +1326,11 @@ public function retrieveTask(string $taskId, string $fetch = self::FETCH_OBJECT) * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Task|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Task|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateTask(string $taskId, Model\TasksTaskIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateTask($taskId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateTask($taskId, $requestBody), $fetch); } /** @@ -1352,11 +1356,11 @@ public function updateTask(string $taskId, Model\TasksTaskIdPatchBody $requestBo * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TimeEntries|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TimeEntries|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listTimeEntries(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListTimeEntries($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListTimeEntries($queryParameters), $fetch); } /** @@ -1366,11 +1370,11 @@ public function listTimeEntries(array $queryParameters = [], string $fetch = sel * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TimeEntry|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TimeEntry|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createTimeEntry(Model\TimeEntriesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateTimeEntry($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateTimeEntry($requestBody), $fetch); } /** @@ -1378,11 +1382,11 @@ public function createTimeEntry(Model\TimeEntriesPostBody $requestBody, string $ * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteTimeEntry(string $timeEntryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteTimeEntry($timeEntryId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteTimeEntry($timeEntryId), $fetch); } /** @@ -1390,11 +1394,11 @@ public function deleteTimeEntry(string $timeEntryId, string $fetch = self::FETCH * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TimeEntry|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TimeEntry|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveTimeEntry(string $timeEntryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveTimeEntry($timeEntryId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveTimeEntry($timeEntryId), $fetch); } /** @@ -1402,11 +1406,11 @@ public function retrieveTimeEntry(string $timeEntryId, string $fetch = self::FET * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TimeEntry|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TimeEntry|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateTimeEntry(string $timeEntryId, Model\TimeEntriesTimeEntryIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateTimeEntry($timeEntryId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateTimeEntry($timeEntryId, $requestBody), $fetch); } /** @@ -1414,11 +1418,11 @@ public function updateTimeEntry(string $timeEntryId, Model\TimeEntriesTimeEntryI * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteTimeEntryExternalReference(string $timeEntryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteTimeEntryExternalReference($timeEntryId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteTimeEntryExternalReference($timeEntryId), $fetch); } /** @@ -1426,11 +1430,11 @@ public function deleteTimeEntryExternalReference(string $timeEntryId, string $fe * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TimeEntry|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TimeEntry|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function restartStoppedTimeEntry(string $timeEntryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RestartStoppedTimeEntry($timeEntryId), $fetch); + return $this->executeEndpoint(new Endpoint\RestartStoppedTimeEntry($timeEntryId), $fetch); } /** @@ -1438,11 +1442,11 @@ public function restartStoppedTimeEntry(string $timeEntryId, string $fetch = sel * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TimeEntry|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TimeEntry|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function stopRunningTimeEntry(string $timeEntryId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\StopRunningTimeEntry($timeEntryId), $fetch); + return $this->executeEndpoint(new Endpoint\StopRunningTimeEntry($timeEntryId), $fetch); } /** @@ -1462,11 +1466,11 @@ public function stopRunningTimeEntry(string $timeEntryId, string $fetch = self:: * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\UserAssignments|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\UserAssignments|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listUserAssignments(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListUserAssignments($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListUserAssignments($queryParameters), $fetch); } /** @@ -1485,11 +1489,11 @@ public function listUserAssignments(array $queryParameters = [], string $fetch = * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Users|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Users|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listUsers(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListUsers($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListUsers($queryParameters), $fetch); } /** @@ -1497,21 +1501,21 @@ public function listUsers(array $queryParameters = [], string $fetch = self::FET * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\User|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\User|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createUser(Model\UsersPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateUser($requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateUser($requestBody), $fetch); } /** * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\User|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\User|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveTheCurrentlyAuthenticatedUser(string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveTheCurrentlyAuthenticatedUser(), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveTheCurrentlyAuthenticatedUser(), $fetch); } /** @@ -1527,11 +1531,11 @@ public function retrieveTheCurrentlyAuthenticatedUser(string $fetch = self::FETC * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ProjectAssignments|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ProjectAssignments|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listActiveProjectAssignmentsForTheCurrentlyAuthenticatedUser(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListActiveProjectAssignmentsForTheCurrentlyAuthenticatedUser($queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListActiveProjectAssignmentsForTheCurrentlyAuthenticatedUser($queryParameters), $fetch); } /** @@ -1539,11 +1543,11 @@ public function listActiveProjectAssignmentsForTheCurrentlyAuthenticatedUser(arr * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function deleteUser(string $userId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\DeleteUser($userId), $fetch); + return $this->executeEndpoint(new Endpoint\DeleteUser($userId), $fetch); } /** @@ -1551,11 +1555,11 @@ public function deleteUser(string $userId, string $fetch = self::FETCH_OBJECT) * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\User|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\User|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveUser(string $userId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveUser($userId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveUser($userId), $fetch); } /** @@ -1563,11 +1567,11 @@ public function retrieveUser(string $userId, string $fetch = self::FETCH_OBJECT) * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\User|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\User|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateUser(string $userId, Model\UsersUserIdPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateUser($userId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateUser($userId, $requestBody), $fetch); } /** @@ -1584,11 +1588,11 @@ public function updateUser(string $userId, Model\UsersUserIdPatchBody $requestBo * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\BillableRates|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\BillableRates|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listBillableRatesForSpecificUser(string $userId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListBillableRatesForSpecificUser($userId, $queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListBillableRatesForSpecificUser($userId, $queryParameters), $fetch); } /** @@ -1599,11 +1603,11 @@ public function listBillableRatesForSpecificUser(string $userId, array $queryPar * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\BillableRate|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\BillableRate|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createBillableRate(string $userId, Model\UsersUserIdBillableRatesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateBillableRate($userId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateBillableRate($userId, $requestBody), $fetch); } /** @@ -1611,11 +1615,11 @@ public function createBillableRate(string $userId, Model\UsersUserIdBillableRate * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\BillableRate|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\BillableRate|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveBillableRate(string $userId, string $billableRateId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveBillableRate($userId, $billableRateId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveBillableRate($userId, $billableRateId), $fetch); } /** @@ -1632,11 +1636,11 @@ public function retrieveBillableRate(string $userId, string $billableRateId, str * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\CostRates|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\CostRates|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listCostRatesForSpecificUser(string $userId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListCostRatesForSpecificUser($userId, $queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListCostRatesForSpecificUser($userId, $queryParameters), $fetch); } /** @@ -1647,11 +1651,11 @@ public function listCostRatesForSpecificUser(string $userId, array $queryParamet * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\CostRate|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\CostRate|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function createCostRate(string $userId, Model\UsersUserIdCostRatesPostBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\CreateCostRate($userId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\CreateCostRate($userId, $requestBody), $fetch); } /** @@ -1659,11 +1663,11 @@ public function createCostRate(string $userId, Model\UsersUserIdCostRatesPostBod * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\CostRate|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\CostRate|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function retrieveCostRate(string $userId, string $costRateId, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\RetrieveCostRate($userId, $costRateId), $fetch); + return $this->executeEndpoint(new Endpoint\RetrieveCostRate($userId, $costRateId), $fetch); } /** @@ -1681,11 +1685,11 @@ public function retrieveCostRate(string $userId, string $costRateId, string $fet * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\ProjectAssignments|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\ProjectAssignments|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listActiveProjectAssignments(string $userId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListActiveProjectAssignments($userId, $queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListActiveProjectAssignments($userId, $queryParameters), $fetch); } /** @@ -1702,11 +1706,11 @@ public function listActiveProjectAssignments(string $userId, array $queryParamet * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\Teammates|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\Teammates|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function listAssignedTeammatesForSpecificUser(string $userId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\ListAssignedTeammatesForSpecificUser($userId, $queryParameters), $fetch); + return $this->executeEndpoint(new Endpoint\ListAssignedTeammatesForSpecificUser($userId, $queryParameters), $fetch); } /** @@ -1716,11 +1720,11 @@ public function listAssignedTeammatesForSpecificUser(string $userId, array $quer * * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * - * @return \JoliCode\Harvest\Api\Model\TeammatesPatchResponse|\JoliCode\Harvest\Api\Model\Error|\Psr\Http\Message\ResponseInterface|null + * @return Model\TeammatesPatchResponse|Model\Error|\Psr\Http\Message\ResponseInterface|null */ public function updateUserAssignedTeammates(string $userId, Model\UsersUserIdTeammatesPatchBody $requestBody, string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new \JoliCode\Harvest\Api\Endpoint\UpdateUserAssignedTeammates($userId, $requestBody), $fetch); + return $this->executeEndpoint(new Endpoint\UpdateUserAssignedTeammates($userId, $requestBody), $fetch); } public static function create($httpClient = null, array $additionalPlugins = [], array $additionalNormalizers = []) @@ -1728,7 +1732,7 @@ public static function create($httpClient = null, array $additionalPlugins = [], if (null === $httpClient) { $httpClient = \Http\Discovery\Psr18ClientDiscovery::find(); $plugins = []; - $uri = \Http\Discovery\Psr17FactoryDiscovery::findUrlFactory()->createUri('https://api.harvestapp.com/v2'); + $uri = \Http\Discovery\Psr17FactoryDiscovery::findUriFactory()->createUri('https://api.harvestapp.com/v2'); $plugins[] = new \Http\Client\Common\Plugin\AddHostPlugin($uri); $plugins[] = new \Http\Client\Common\Plugin\AddPathPlugin($uri); if (\count($additionalPlugins) > 0) { @@ -1738,7 +1742,7 @@ public static function create($httpClient = null, array $additionalPlugins = [], } $requestFactory = \Http\Discovery\Psr17FactoryDiscovery::findRequestFactory(); $streamFactory = \Http\Discovery\Psr17FactoryDiscovery::findStreamFactory(); - $normalizers = [new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), new \JoliCode\Harvest\Api\Normalizer\JaneObjectNormalizer()]; + $normalizers = [new \Symfony\Component\Serializer\Normalizer\ArrayDenormalizer(), new Normalizer\JaneObjectNormalizer()]; if (\count($additionalNormalizers) > 0) { $normalizers = array_merge($normalizers, $additionalNormalizers); } diff --git a/generated/Endpoint/ClientsExpensesReport.php b/generated/Endpoint/ClientsExpensesReport.php index 56009f8..3840e1a 100644 --- a/generated/Endpoint/ClientsExpensesReport.php +++ b/generated/Endpoint/ClientsExpensesReport.php @@ -71,7 +71,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\ExpenseReportsResults|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ClientsTimeReport.php b/generated/Endpoint/ClientsTimeReport.php index 34abe08..a5b1144 100644 --- a/generated/Endpoint/ClientsTimeReport.php +++ b/generated/Endpoint/ClientsTimeReport.php @@ -20,6 +20,7 @@ class ClientsTimeReport extends \JoliCode\Harvest\Api\Runtime\Client\BaseEndpoin * * @var string $from only report on time entries with a spent_date on or after the given date * @var string $to only report on time entries with a spent_date on or before the given date + * @var string $include_fixed_fee when true, billable amounts will be calculated and included for fixed fee projects * @var int $page The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1) * @var int $per_page The number of records to return per page. Can range between 1 and 2000. (Default: 2000) * } @@ -57,11 +58,12 @@ public function getAuthenticationScopes(): array protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver { $optionsResolver = parent::getQueryOptionsResolver(); - $optionsResolver->setDefined(['from', 'to', 'page', 'per_page']); + $optionsResolver->setDefined(['from', 'to', 'include_fixed_fee', 'page', 'per_page']); $optionsResolver->setRequired(['from', 'to']); $optionsResolver->setDefaults([]); $optionsResolver->addAllowedTypes('from', ['string']); $optionsResolver->addAllowedTypes('to', ['string']); + $optionsResolver->addAllowedTypes('include_fixed_fee', ['string']); $optionsResolver->addAllowedTypes('page', ['int']); $optionsResolver->addAllowedTypes('per_page', ['int']); @@ -71,7 +73,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\TimeReportsResults|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateBillableRate.php b/generated/Endpoint/CreateBillableRate.php index ac0f78c..216a6ef 100644 --- a/generated/Endpoint/CreateBillableRate.php +++ b/generated/Endpoint/CreateBillableRate.php @@ -60,7 +60,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\BillableRate|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateClient.php b/generated/Endpoint/CreateClient.php index ff577f7..61c37d2 100644 --- a/generated/Endpoint/CreateClient.php +++ b/generated/Endpoint/CreateClient.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Client|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateContact.php b/generated/Endpoint/CreateContact.php index 2182a02..e170b99 100644 --- a/generated/Endpoint/CreateContact.php +++ b/generated/Endpoint/CreateContact.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Contact|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateCostRate.php b/generated/Endpoint/CreateCostRate.php index 3edc337..49d50fe 100644 --- a/generated/Endpoint/CreateCostRate.php +++ b/generated/Endpoint/CreateCostRate.php @@ -60,7 +60,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\CostRate|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateEstimate.php b/generated/Endpoint/CreateEstimate.php index 7bbb5e0..b498d2b 100644 --- a/generated/Endpoint/CreateEstimate.php +++ b/generated/Endpoint/CreateEstimate.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Estimate|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateEstimateItemCategory.php b/generated/Endpoint/CreateEstimateItemCategory.php index b1d5f07..38cd740 100644 --- a/generated/Endpoint/CreateEstimateItemCategory.php +++ b/generated/Endpoint/CreateEstimateItemCategory.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\EstimateItemCategory|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateEstimateMessage.php b/generated/Endpoint/CreateEstimateMessage.php index 28cd869..a2490be 100644 --- a/generated/Endpoint/CreateEstimateMessage.php +++ b/generated/Endpoint/CreateEstimateMessage.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\EstimateMessage|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateExpense.php b/generated/Endpoint/CreateExpense.php index 0263503..b1681f5 100644 --- a/generated/Endpoint/CreateExpense.php +++ b/generated/Endpoint/CreateExpense.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Expense|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateExpenseCategory.php b/generated/Endpoint/CreateExpenseCategory.php index 4a2865d..feb15b0 100644 --- a/generated/Endpoint/CreateExpenseCategory.php +++ b/generated/Endpoint/CreateExpenseCategory.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\ExpenseCategory|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateInvoice.php b/generated/Endpoint/CreateInvoice.php index 50d8fa4..003d42e 100644 --- a/generated/Endpoint/CreateInvoice.php +++ b/generated/Endpoint/CreateInvoice.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Invoice|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateInvoiceItemCategory.php b/generated/Endpoint/CreateInvoiceItemCategory.php index 3308362..b66516d 100644 --- a/generated/Endpoint/CreateInvoiceItemCategory.php +++ b/generated/Endpoint/CreateInvoiceItemCategory.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\InvoiceItemCategory|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateInvoiceMessage.php b/generated/Endpoint/CreateInvoiceMessage.php index 65385ba..64c4d74 100644 --- a/generated/Endpoint/CreateInvoiceMessage.php +++ b/generated/Endpoint/CreateInvoiceMessage.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\InvoiceMessage|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateInvoicePayment.php b/generated/Endpoint/CreateInvoicePayment.php index f6fbc9f..c9aa101 100644 --- a/generated/Endpoint/CreateInvoicePayment.php +++ b/generated/Endpoint/CreateInvoicePayment.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\InvoicePayment|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateProject.php b/generated/Endpoint/CreateProject.php index 9e88b1c..875fe68 100644 --- a/generated/Endpoint/CreateProject.php +++ b/generated/Endpoint/CreateProject.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Project|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateRole.php b/generated/Endpoint/CreateRole.php index b3b6b4b..ae536fe 100644 --- a/generated/Endpoint/CreateRole.php +++ b/generated/Endpoint/CreateRole.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Role|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateTask.php b/generated/Endpoint/CreateTask.php index d1a8a5c..e5a53f2 100644 --- a/generated/Endpoint/CreateTask.php +++ b/generated/Endpoint/CreateTask.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Task|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateTaskAssignment.php b/generated/Endpoint/CreateTaskAssignment.php index 3f8527a..0817733 100644 --- a/generated/Endpoint/CreateTaskAssignment.php +++ b/generated/Endpoint/CreateTaskAssignment.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\TaskAssignment|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateTimeEntry.php b/generated/Endpoint/CreateTimeEntry.php index 2173adc..80a833f 100644 --- a/generated/Endpoint/CreateTimeEntry.php +++ b/generated/Endpoint/CreateTimeEntry.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\TimeEntry|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateUser.php b/generated/Endpoint/CreateUser.php index cf05de2..ee7ecae 100644 --- a/generated/Endpoint/CreateUser.php +++ b/generated/Endpoint/CreateUser.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\User|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/CreateUserAssignment.php b/generated/Endpoint/CreateUserAssignment.php index 0693ea2..3e18b4b 100644 --- a/generated/Endpoint/CreateUserAssignment.php +++ b/generated/Endpoint/CreateUserAssignment.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\UserAssignment|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteClient.php b/generated/Endpoint/DeleteClient.php index 8c1a2be..5b412be 100644 --- a/generated/Endpoint/DeleteClient.php +++ b/generated/Endpoint/DeleteClient.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteContact.php b/generated/Endpoint/DeleteContact.php index 866a4ba..8cb3a08 100644 --- a/generated/Endpoint/DeleteContact.php +++ b/generated/Endpoint/DeleteContact.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteEstimate.php b/generated/Endpoint/DeleteEstimate.php index 616e16a..d2e6a59 100644 --- a/generated/Endpoint/DeleteEstimate.php +++ b/generated/Endpoint/DeleteEstimate.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteEstimateItemCategory.php b/generated/Endpoint/DeleteEstimateItemCategory.php index 710bb1c..29098f7 100644 --- a/generated/Endpoint/DeleteEstimateItemCategory.php +++ b/generated/Endpoint/DeleteEstimateItemCategory.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteEstimateMessage.php b/generated/Endpoint/DeleteEstimateMessage.php index c929858..b8b4a40 100644 --- a/generated/Endpoint/DeleteEstimateMessage.php +++ b/generated/Endpoint/DeleteEstimateMessage.php @@ -54,7 +54,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteExpense.php b/generated/Endpoint/DeleteExpense.php index c52d04a..110b234 100644 --- a/generated/Endpoint/DeleteExpense.php +++ b/generated/Endpoint/DeleteExpense.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteExpenseCategory.php b/generated/Endpoint/DeleteExpenseCategory.php index 79dfe40..e65a161 100644 --- a/generated/Endpoint/DeleteExpenseCategory.php +++ b/generated/Endpoint/DeleteExpenseCategory.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteInvoice.php b/generated/Endpoint/DeleteInvoice.php index 240303a..cbcf70f 100644 --- a/generated/Endpoint/DeleteInvoice.php +++ b/generated/Endpoint/DeleteInvoice.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteInvoiceItemCategory.php b/generated/Endpoint/DeleteInvoiceItemCategory.php index 4aa4148..4ca9446 100644 --- a/generated/Endpoint/DeleteInvoiceItemCategory.php +++ b/generated/Endpoint/DeleteInvoiceItemCategory.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteInvoiceMessage.php b/generated/Endpoint/DeleteInvoiceMessage.php index 342fa60..497b067 100644 --- a/generated/Endpoint/DeleteInvoiceMessage.php +++ b/generated/Endpoint/DeleteInvoiceMessage.php @@ -54,7 +54,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteInvoicePayment.php b/generated/Endpoint/DeleteInvoicePayment.php index 26d60a8..4156942 100644 --- a/generated/Endpoint/DeleteInvoicePayment.php +++ b/generated/Endpoint/DeleteInvoicePayment.php @@ -54,7 +54,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteProject.php b/generated/Endpoint/DeleteProject.php index 65b0a75..f542dd9 100644 --- a/generated/Endpoint/DeleteProject.php +++ b/generated/Endpoint/DeleteProject.php @@ -54,7 +54,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteRole.php b/generated/Endpoint/DeleteRole.php index 3ef72fa..0056520 100644 --- a/generated/Endpoint/DeleteRole.php +++ b/generated/Endpoint/DeleteRole.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteTask.php b/generated/Endpoint/DeleteTask.php index fa5b3f0..72616eb 100644 --- a/generated/Endpoint/DeleteTask.php +++ b/generated/Endpoint/DeleteTask.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteTaskAssignment.php b/generated/Endpoint/DeleteTaskAssignment.php index 926b3c3..1c927b7 100644 --- a/generated/Endpoint/DeleteTaskAssignment.php +++ b/generated/Endpoint/DeleteTaskAssignment.php @@ -54,7 +54,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteTimeEntry.php b/generated/Endpoint/DeleteTimeEntry.php index e365ec4..6135b80 100644 --- a/generated/Endpoint/DeleteTimeEntry.php +++ b/generated/Endpoint/DeleteTimeEntry.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteTimeEntryExternalReference.php b/generated/Endpoint/DeleteTimeEntryExternalReference.php index 24e81b6..12a251a 100644 --- a/generated/Endpoint/DeleteTimeEntryExternalReference.php +++ b/generated/Endpoint/DeleteTimeEntryExternalReference.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteUser.php b/generated/Endpoint/DeleteUser.php index 528ab63..4900a63 100644 --- a/generated/Endpoint/DeleteUser.php +++ b/generated/Endpoint/DeleteUser.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/DeleteUserAssignment.php b/generated/Endpoint/DeleteUserAssignment.php index 9b610c7..6fe760d 100644 --- a/generated/Endpoint/DeleteUserAssignment.php +++ b/generated/Endpoint/DeleteUserAssignment.php @@ -54,7 +54,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ExpenseCategoriesReport.php b/generated/Endpoint/ExpenseCategoriesReport.php index d473cb7..ac2f84f 100644 --- a/generated/Endpoint/ExpenseCategoriesReport.php +++ b/generated/Endpoint/ExpenseCategoriesReport.php @@ -71,7 +71,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\ExpenseReportsResults|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListActiveProjectAssignments.php b/generated/Endpoint/ListActiveProjectAssignments.php index 7778ded..d1aea4d 100644 --- a/generated/Endpoint/ListActiveProjectAssignments.php +++ b/generated/Endpoint/ListActiveProjectAssignments.php @@ -77,7 +77,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\ProjectAssignments|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListActiveProjectAssignmentsForTheCurrentlyAuthenticatedUser.php b/generated/Endpoint/ListActiveProjectAssignmentsForTheCurrentlyAuthenticatedUser.php index ad02d93..ec29cf3 100644 --- a/generated/Endpoint/ListActiveProjectAssignmentsForTheCurrentlyAuthenticatedUser.php +++ b/generated/Endpoint/ListActiveProjectAssignmentsForTheCurrentlyAuthenticatedUser.php @@ -71,7 +71,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\ProjectAssignments|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListAssignedTeammatesForSpecificUser.php b/generated/Endpoint/ListAssignedTeammatesForSpecificUser.php index aaaa63f..a3114ea 100644 --- a/generated/Endpoint/ListAssignedTeammatesForSpecificUser.php +++ b/generated/Endpoint/ListAssignedTeammatesForSpecificUser.php @@ -75,7 +75,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\Teammates|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListBillableRatesForSpecificUser.php b/generated/Endpoint/ListBillableRatesForSpecificUser.php index d8f1cb7..d1b8f08 100644 --- a/generated/Endpoint/ListBillableRatesForSpecificUser.php +++ b/generated/Endpoint/ListBillableRatesForSpecificUser.php @@ -75,7 +75,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\BillableRates|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListClients.php b/generated/Endpoint/ListClients.php index 1eccb51..3703c9d 100644 --- a/generated/Endpoint/ListClients.php +++ b/generated/Endpoint/ListClients.php @@ -78,7 +78,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\Clients|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListContacts.php b/generated/Endpoint/ListContacts.php index 3ac8a05..94981ce 100644 --- a/generated/Endpoint/ListContacts.php +++ b/generated/Endpoint/ListContacts.php @@ -77,7 +77,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\Contacts|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListCostRatesForSpecificUser.php b/generated/Endpoint/ListCostRatesForSpecificUser.php index ddc4cff..1e43b7a 100644 --- a/generated/Endpoint/ListCostRatesForSpecificUser.php +++ b/generated/Endpoint/ListCostRatesForSpecificUser.php @@ -75,7 +75,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\CostRates|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListEstimateItemCategories.php b/generated/Endpoint/ListEstimateItemCategories.php index 179f232..676967e 100644 --- a/generated/Endpoint/ListEstimateItemCategories.php +++ b/generated/Endpoint/ListEstimateItemCategories.php @@ -75,7 +75,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\EstimateItemCategories|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListEstimates.php b/generated/Endpoint/ListEstimates.php index 4527190..39a2181 100644 --- a/generated/Endpoint/ListEstimates.php +++ b/generated/Endpoint/ListEstimates.php @@ -81,7 +81,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\Estimates|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListExpenseCategories.php b/generated/Endpoint/ListExpenseCategories.php index 1b313c8..5c11204 100644 --- a/generated/Endpoint/ListExpenseCategories.php +++ b/generated/Endpoint/ListExpenseCategories.php @@ -78,7 +78,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\ExpenseCategories|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListExpenses.php b/generated/Endpoint/ListExpenses.php index 530c424..e59c860 100644 --- a/generated/Endpoint/ListExpenses.php +++ b/generated/Endpoint/ListExpenses.php @@ -86,7 +86,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\Expenses|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListInvoiceItemCategories.php b/generated/Endpoint/ListInvoiceItemCategories.php index c20584e..f3b20e6 100644 --- a/generated/Endpoint/ListInvoiceItemCategories.php +++ b/generated/Endpoint/ListInvoiceItemCategories.php @@ -75,7 +75,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\InvoiceItemCategories|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListInvoices.php b/generated/Endpoint/ListInvoices.php index 426fb53..4152860 100644 --- a/generated/Endpoint/ListInvoices.php +++ b/generated/Endpoint/ListInvoices.php @@ -83,7 +83,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\Invoices|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListMessagesForEstimate.php b/generated/Endpoint/ListMessagesForEstimate.php index 8d30196..4ac8330 100644 --- a/generated/Endpoint/ListMessagesForEstimate.php +++ b/generated/Endpoint/ListMessagesForEstimate.php @@ -77,7 +77,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\EstimateMessages|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListMessagesForInvoice.php b/generated/Endpoint/ListMessagesForInvoice.php index 9b20e3e..faaac74 100644 --- a/generated/Endpoint/ListMessagesForInvoice.php +++ b/generated/Endpoint/ListMessagesForInvoice.php @@ -77,7 +77,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\InvoiceMessages|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListPaymentsForInvoice.php b/generated/Endpoint/ListPaymentsForInvoice.php index 5ae695b..680cf3d 100644 --- a/generated/Endpoint/ListPaymentsForInvoice.php +++ b/generated/Endpoint/ListPaymentsForInvoice.php @@ -77,7 +77,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\InvoicePayments|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListProjects.php b/generated/Endpoint/ListProjects.php index bedefa7..8d3a19a 100644 --- a/generated/Endpoint/ListProjects.php +++ b/generated/Endpoint/ListProjects.php @@ -80,7 +80,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\Projects|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListRoles.php b/generated/Endpoint/ListRoles.php index 369c61b..747ac3a 100644 --- a/generated/Endpoint/ListRoles.php +++ b/generated/Endpoint/ListRoles.php @@ -73,7 +73,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\Roles|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListTaskAssignments.php b/generated/Endpoint/ListTaskAssignments.php index 6a16975..e84729b 100644 --- a/generated/Endpoint/ListTaskAssignments.php +++ b/generated/Endpoint/ListTaskAssignments.php @@ -78,7 +78,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\TaskAssignments|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListTaskAssignmentsForSpecificProject.php b/generated/Endpoint/ListTaskAssignmentsForSpecificProject.php index f22d42f..6375597 100644 --- a/generated/Endpoint/ListTaskAssignmentsForSpecificProject.php +++ b/generated/Endpoint/ListTaskAssignmentsForSpecificProject.php @@ -78,7 +78,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\TaskAssignments|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListTasks.php b/generated/Endpoint/ListTasks.php index 22d0888..05a09b8 100644 --- a/generated/Endpoint/ListTasks.php +++ b/generated/Endpoint/ListTasks.php @@ -78,7 +78,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\Tasks|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListTimeEntries.php b/generated/Endpoint/ListTimeEntries.php index bb77314..b0ff31b 100644 --- a/generated/Endpoint/ListTimeEntries.php +++ b/generated/Endpoint/ListTimeEntries.php @@ -93,7 +93,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\TimeEntries|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListUserAssignments.php b/generated/Endpoint/ListUserAssignments.php index 75f4a5c..2ce3b54 100644 --- a/generated/Endpoint/ListUserAssignments.php +++ b/generated/Endpoint/ListUserAssignments.php @@ -80,7 +80,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\UserAssignments|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListUserAssignmentsForSpecificProject.php b/generated/Endpoint/ListUserAssignmentsForSpecificProject.php index aaa1e80..196ee9b 100644 --- a/generated/Endpoint/ListUserAssignmentsForSpecificProject.php +++ b/generated/Endpoint/ListUserAssignmentsForSpecificProject.php @@ -80,7 +80,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\UserAssignments|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ListUsers.php b/generated/Endpoint/ListUsers.php index 07fd420..30c5933 100644 --- a/generated/Endpoint/ListUsers.php +++ b/generated/Endpoint/ListUsers.php @@ -78,7 +78,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\Users|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ProjectBudgetReport.php b/generated/Endpoint/ProjectBudgetReport.php index 26ab2fa..e8165a1 100644 --- a/generated/Endpoint/ProjectBudgetReport.php +++ b/generated/Endpoint/ProjectBudgetReport.php @@ -72,7 +72,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\ProjectBudgetReportResults|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ProjectsExpensesReport.php b/generated/Endpoint/ProjectsExpensesReport.php index 0c8497f..059f02e 100644 --- a/generated/Endpoint/ProjectsExpensesReport.php +++ b/generated/Endpoint/ProjectsExpensesReport.php @@ -71,7 +71,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\ExpenseReportsResults|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/ProjectsTimeReport.php b/generated/Endpoint/ProjectsTimeReport.php index 2025655..1be0a5e 100644 --- a/generated/Endpoint/ProjectsTimeReport.php +++ b/generated/Endpoint/ProjectsTimeReport.php @@ -20,6 +20,7 @@ class ProjectsTimeReport extends \JoliCode\Harvest\Api\Runtime\Client\BaseEndpoi * * @var string $from only report on time entries with a spent_date on or after the given date * @var string $to only report on time entries with a spent_date on or before the given date + * @var string $include_fixed_fee when true, billable amounts will be calculated and included for fixed fee projects * @var int $page The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1) * @var int $per_page The number of records to return per page. Can range between 1 and 2000. (Default: 2000) * } @@ -57,11 +58,12 @@ public function getAuthenticationScopes(): array protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver { $optionsResolver = parent::getQueryOptionsResolver(); - $optionsResolver->setDefined(['from', 'to', 'page', 'per_page']); + $optionsResolver->setDefined(['from', 'to', 'include_fixed_fee', 'page', 'per_page']); $optionsResolver->setRequired(['from', 'to']); $optionsResolver->setDefaults([]); $optionsResolver->addAllowedTypes('from', ['string']); $optionsResolver->addAllowedTypes('to', ['string']); + $optionsResolver->addAllowedTypes('include_fixed_fee', ['string']); $optionsResolver->addAllowedTypes('page', ['int']); $optionsResolver->addAllowedTypes('per_page', ['int']); @@ -71,7 +73,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\TimeReportsResults|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RestartStoppedTimeEntry.php b/generated/Endpoint/RestartStoppedTimeEntry.php index 054972a..55add6e 100644 --- a/generated/Endpoint/RestartStoppedTimeEntry.php +++ b/generated/Endpoint/RestartStoppedTimeEntry.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\TimeEntry|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveBillableRate.php b/generated/Endpoint/RetrieveBillableRate.php index 5c38843..726e1c7 100644 --- a/generated/Endpoint/RetrieveBillableRate.php +++ b/generated/Endpoint/RetrieveBillableRate.php @@ -54,7 +54,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\BillableRate|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveClient.php b/generated/Endpoint/RetrieveClient.php index b6d6a11..d1462b5 100644 --- a/generated/Endpoint/RetrieveClient.php +++ b/generated/Endpoint/RetrieveClient.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Client|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveCompany.php b/generated/Endpoint/RetrieveCompany.php index eca5017..cb6def6 100644 --- a/generated/Endpoint/RetrieveCompany.php +++ b/generated/Endpoint/RetrieveCompany.php @@ -43,7 +43,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Company|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveContact.php b/generated/Endpoint/RetrieveContact.php index 5c17994..48165a7 100644 --- a/generated/Endpoint/RetrieveContact.php +++ b/generated/Endpoint/RetrieveContact.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Contact|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveCostRate.php b/generated/Endpoint/RetrieveCostRate.php index 60d3150..59639cf 100644 --- a/generated/Endpoint/RetrieveCostRate.php +++ b/generated/Endpoint/RetrieveCostRate.php @@ -54,7 +54,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\CostRate|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveEstimate.php b/generated/Endpoint/RetrieveEstimate.php index 3dc8287..612d23f 100644 --- a/generated/Endpoint/RetrieveEstimate.php +++ b/generated/Endpoint/RetrieveEstimate.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Estimate|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveEstimateItemCategory.php b/generated/Endpoint/RetrieveEstimateItemCategory.php index 46c15d4..5a3537a 100644 --- a/generated/Endpoint/RetrieveEstimateItemCategory.php +++ b/generated/Endpoint/RetrieveEstimateItemCategory.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\EstimateItemCategory|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveExpense.php b/generated/Endpoint/RetrieveExpense.php index 30f343d..a169683 100644 --- a/generated/Endpoint/RetrieveExpense.php +++ b/generated/Endpoint/RetrieveExpense.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Expense|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveExpenseCategory.php b/generated/Endpoint/RetrieveExpenseCategory.php index b15221f..8fa24b0 100644 --- a/generated/Endpoint/RetrieveExpenseCategory.php +++ b/generated/Endpoint/RetrieveExpenseCategory.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\ExpenseCategory|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveInvoice.php b/generated/Endpoint/RetrieveInvoice.php index 3ae92e4..b499271 100644 --- a/generated/Endpoint/RetrieveInvoice.php +++ b/generated/Endpoint/RetrieveInvoice.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Invoice|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveInvoiceItemCategory.php b/generated/Endpoint/RetrieveInvoiceItemCategory.php index 50cf769..1d67e5e 100644 --- a/generated/Endpoint/RetrieveInvoiceItemCategory.php +++ b/generated/Endpoint/RetrieveInvoiceItemCategory.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\InvoiceItemCategory|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveInvoiceMessageSubjectAndBodyForSpecificInvoice.php b/generated/Endpoint/RetrieveInvoiceMessageSubjectAndBodyForSpecificInvoice.php index 2b18825..903bb63 100644 --- a/generated/Endpoint/RetrieveInvoiceMessageSubjectAndBodyForSpecificInvoice.php +++ b/generated/Endpoint/RetrieveInvoiceMessageSubjectAndBodyForSpecificInvoice.php @@ -73,7 +73,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\InvoiceMessageSubjectAndBody|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveProject.php b/generated/Endpoint/RetrieveProject.php index 7fe58e8..7d557d3 100644 --- a/generated/Endpoint/RetrieveProject.php +++ b/generated/Endpoint/RetrieveProject.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Project|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveRole.php b/generated/Endpoint/RetrieveRole.php index 7dad0b7..2171792 100644 --- a/generated/Endpoint/RetrieveRole.php +++ b/generated/Endpoint/RetrieveRole.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Role|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveTask.php b/generated/Endpoint/RetrieveTask.php index 866be87..9be7f5b 100644 --- a/generated/Endpoint/RetrieveTask.php +++ b/generated/Endpoint/RetrieveTask.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Task|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveTaskAssignment.php b/generated/Endpoint/RetrieveTaskAssignment.php index b6295a5..d9b53eb 100644 --- a/generated/Endpoint/RetrieveTaskAssignment.php +++ b/generated/Endpoint/RetrieveTaskAssignment.php @@ -54,7 +54,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\TaskAssignment|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveTheCurrentlyAuthenticatedUser.php b/generated/Endpoint/RetrieveTheCurrentlyAuthenticatedUser.php index 36301e3..9782137 100644 --- a/generated/Endpoint/RetrieveTheCurrentlyAuthenticatedUser.php +++ b/generated/Endpoint/RetrieveTheCurrentlyAuthenticatedUser.php @@ -43,7 +43,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\User|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveTimeEntry.php b/generated/Endpoint/RetrieveTimeEntry.php index 963cc72..1593ad6 100644 --- a/generated/Endpoint/RetrieveTimeEntry.php +++ b/generated/Endpoint/RetrieveTimeEntry.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\TimeEntry|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveUser.php b/generated/Endpoint/RetrieveUser.php index 6ec97e7..4638a33 100644 --- a/generated/Endpoint/RetrieveUser.php +++ b/generated/Endpoint/RetrieveUser.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\User|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/RetrieveUserAssignment.php b/generated/Endpoint/RetrieveUserAssignment.php index e88150e..5c0d11d 100644 --- a/generated/Endpoint/RetrieveUserAssignment.php +++ b/generated/Endpoint/RetrieveUserAssignment.php @@ -54,7 +54,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\UserAssignment|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/StopRunningTimeEntry.php b/generated/Endpoint/StopRunningTimeEntry.php index ad89ed5..e8a12e3 100644 --- a/generated/Endpoint/StopRunningTimeEntry.php +++ b/generated/Endpoint/StopRunningTimeEntry.php @@ -52,7 +52,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\TimeEntry|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/TasksReport.php b/generated/Endpoint/TasksReport.php index 2ec7f19..79068c6 100644 --- a/generated/Endpoint/TasksReport.php +++ b/generated/Endpoint/TasksReport.php @@ -20,6 +20,7 @@ class TasksReport extends \JoliCode\Harvest\Api\Runtime\Client\BaseEndpoint impl * * @var string $from only report on time entries with a spent_date on or after the given date * @var string $to only report on time entries with a spent_date on or before the given date + * @var string $include_fixed_fee when true, billable amounts will be calculated and included for fixed fee projects * @var int $page The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1) * @var int $per_page The number of records to return per page. Can range between 1 and 2000. (Default: 2000) * } @@ -57,11 +58,12 @@ public function getAuthenticationScopes(): array protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver { $optionsResolver = parent::getQueryOptionsResolver(); - $optionsResolver->setDefined(['from', 'to', 'page', 'per_page']); + $optionsResolver->setDefined(['from', 'to', 'include_fixed_fee', 'page', 'per_page']); $optionsResolver->setRequired(['from', 'to']); $optionsResolver->setDefaults([]); $optionsResolver->addAllowedTypes('from', ['string']); $optionsResolver->addAllowedTypes('to', ['string']); + $optionsResolver->addAllowedTypes('include_fixed_fee', ['string']); $optionsResolver->addAllowedTypes('page', ['int']); $optionsResolver->addAllowedTypes('per_page', ['int']); @@ -71,7 +73,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\TimeReportsResults|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/TeamExpensesReport.php b/generated/Endpoint/TeamExpensesReport.php index 144c420..eb052e4 100644 --- a/generated/Endpoint/TeamExpensesReport.php +++ b/generated/Endpoint/TeamExpensesReport.php @@ -71,7 +71,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\ExpenseReportsResults|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/TeamTimeReport.php b/generated/Endpoint/TeamTimeReport.php index 11eb06d..d4144c6 100644 --- a/generated/Endpoint/TeamTimeReport.php +++ b/generated/Endpoint/TeamTimeReport.php @@ -20,6 +20,7 @@ class TeamTimeReport extends \JoliCode\Harvest\Api\Runtime\Client\BaseEndpoint i * * @var string $from only report on time entries with a spent_date on or after the given date * @var string $to only report on time entries with a spent_date on or before the given date + * @var string $include_fixed_fee when true, billable amounts will be calculated and included for fixed fee projects * @var int $page The page number to use in pagination. For instance, if you make a list request and receive 2000 records, your subsequent call can include page=2 to retrieve the next page of the list. (Default: 1) * @var int $per_page The number of records to return per page. Can range between 1 and 2000. (Default: 2000) * } @@ -57,11 +58,12 @@ public function getAuthenticationScopes(): array protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver { $optionsResolver = parent::getQueryOptionsResolver(); - $optionsResolver->setDefined(['from', 'to', 'page', 'per_page']); + $optionsResolver->setDefined(['from', 'to', 'include_fixed_fee', 'page', 'per_page']); $optionsResolver->setRequired(['from', 'to']); $optionsResolver->setDefaults([]); $optionsResolver->addAllowedTypes('from', ['string']); $optionsResolver->addAllowedTypes('to', ['string']); + $optionsResolver->addAllowedTypes('include_fixed_fee', ['string']); $optionsResolver->addAllowedTypes('page', ['int']); $optionsResolver->addAllowedTypes('per_page', ['int']); @@ -71,7 +73,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\TimeReportsResults|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UninvoicedReport.php b/generated/Endpoint/UninvoicedReport.php index 7101c76..4923355 100644 --- a/generated/Endpoint/UninvoicedReport.php +++ b/generated/Endpoint/UninvoicedReport.php @@ -75,7 +75,7 @@ protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver /** * @return \JoliCode\Harvest\Api\Model\UninvoicedReportResults|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateClient.php b/generated/Endpoint/UpdateClient.php index 77bed2f..1433277 100644 --- a/generated/Endpoint/UpdateClient.php +++ b/generated/Endpoint/UpdateClient.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Client|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateCompany.php b/generated/Endpoint/UpdateCompany.php index 0d6c1a8..93d3dd4 100644 --- a/generated/Endpoint/UpdateCompany.php +++ b/generated/Endpoint/UpdateCompany.php @@ -55,7 +55,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Company|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateContact.php b/generated/Endpoint/UpdateContact.php index eab9ec2..32704dd 100644 --- a/generated/Endpoint/UpdateContact.php +++ b/generated/Endpoint/UpdateContact.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Contact|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateEstimate.php b/generated/Endpoint/UpdateEstimate.php index dbfd222..c2200fd 100644 --- a/generated/Endpoint/UpdateEstimate.php +++ b/generated/Endpoint/UpdateEstimate.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Estimate|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateEstimateItemCategory.php b/generated/Endpoint/UpdateEstimateItemCategory.php index ecbf8af..26e42be 100644 --- a/generated/Endpoint/UpdateEstimateItemCategory.php +++ b/generated/Endpoint/UpdateEstimateItemCategory.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\EstimateItemCategory|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateExpense.php b/generated/Endpoint/UpdateExpense.php index bc0c1cd..97cf454 100644 --- a/generated/Endpoint/UpdateExpense.php +++ b/generated/Endpoint/UpdateExpense.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Expense|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateExpenseCategory.php b/generated/Endpoint/UpdateExpenseCategory.php index 9ef4800..630b565 100644 --- a/generated/Endpoint/UpdateExpenseCategory.php +++ b/generated/Endpoint/UpdateExpenseCategory.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\ExpenseCategory|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateInvoice.php b/generated/Endpoint/UpdateInvoice.php index c6b1d9a..32ee039 100644 --- a/generated/Endpoint/UpdateInvoice.php +++ b/generated/Endpoint/UpdateInvoice.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Invoice|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateInvoiceItemCategory.php b/generated/Endpoint/UpdateInvoiceItemCategory.php index fca2647..d1b9b41 100644 --- a/generated/Endpoint/UpdateInvoiceItemCategory.php +++ b/generated/Endpoint/UpdateInvoiceItemCategory.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\InvoiceItemCategory|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateProject.php b/generated/Endpoint/UpdateProject.php index 8c3bbd3..dc108c2 100644 --- a/generated/Endpoint/UpdateProject.php +++ b/generated/Endpoint/UpdateProject.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Project|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateRole.php b/generated/Endpoint/UpdateRole.php index 48f6dc2..bad1abf 100644 --- a/generated/Endpoint/UpdateRole.php +++ b/generated/Endpoint/UpdateRole.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Role|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateTask.php b/generated/Endpoint/UpdateTask.php index 8350712..e68967c 100644 --- a/generated/Endpoint/UpdateTask.php +++ b/generated/Endpoint/UpdateTask.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\Task|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateTaskAssignment.php b/generated/Endpoint/UpdateTaskAssignment.php index 0fafe48..d073ddb 100644 --- a/generated/Endpoint/UpdateTaskAssignment.php +++ b/generated/Endpoint/UpdateTaskAssignment.php @@ -59,7 +59,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\TaskAssignment|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateTimeEntry.php b/generated/Endpoint/UpdateTimeEntry.php index d75c034..2b17398 100644 --- a/generated/Endpoint/UpdateTimeEntry.php +++ b/generated/Endpoint/UpdateTimeEntry.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\TimeEntry|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateUser.php b/generated/Endpoint/UpdateUser.php index 23d2d40..11d0106 100644 --- a/generated/Endpoint/UpdateUser.php +++ b/generated/Endpoint/UpdateUser.php @@ -57,7 +57,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\User|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateUserAssignedTeammates.php b/generated/Endpoint/UpdateUserAssignedTeammates.php index 50f8038..1007883 100644 --- a/generated/Endpoint/UpdateUserAssignedTeammates.php +++ b/generated/Endpoint/UpdateUserAssignedTeammates.php @@ -59,7 +59,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\TeammatesPatchResponse|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Endpoint/UpdateUserAssignment.php b/generated/Endpoint/UpdateUserAssignment.php index fac8345..fff3c96 100644 --- a/generated/Endpoint/UpdateUserAssignment.php +++ b/generated/Endpoint/UpdateUserAssignment.php @@ -59,7 +59,7 @@ public function getAuthenticationScopes(): array /** * @return \JoliCode\Harvest\Api\Model\UserAssignment|\JoliCode\Harvest\Api\Model\Error|null */ - protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, string $contentType = null) + protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) { $status = $response->getStatusCode(); $body = (string) $response->getBody(); diff --git a/generated/Model/BillableRates.php b/generated/Model/BillableRates.php index f3d6ae7..5c47805 100644 --- a/generated/Model/BillableRates.php +++ b/generated/Model/BillableRates.php @@ -18,7 +18,7 @@ class BillableRates extends \ArrayObject */ protected $initialized = []; /** - * @var BillableRate[] + * @var list */ protected $billableRates; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return BillableRate[] + * @return list */ public function getBillableRates(): array { @@ -64,7 +64,7 @@ public function getBillableRates(): array } /** - * @param BillableRate[] $billableRates + * @param list $billableRates */ public function setBillableRates(array $billableRates): self { diff --git a/generated/Model/Clients.php b/generated/Model/Clients.php index ff1e116..d84ad9e 100644 --- a/generated/Model/Clients.php +++ b/generated/Model/Clients.php @@ -18,7 +18,7 @@ class Clients extends \ArrayObject */ protected $initialized = []; /** - * @var Client[] + * @var list */ protected $clients; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return Client[] + * @return list */ public function getClients(): array { @@ -64,7 +64,7 @@ public function getClients(): array } /** - * @param Client[] $clients + * @param list $clients */ public function setClients(array $clients): self { diff --git a/generated/Model/Companies.php b/generated/Model/Companies.php index bc1b6c8..65ca9f0 100644 --- a/generated/Model/Companies.php +++ b/generated/Model/Companies.php @@ -18,7 +18,7 @@ class Companies extends \ArrayObject */ protected $initialized = []; /** - * @var Company[] + * @var list */ protected $companies; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return Company[] + * @return list */ public function getCompanies(): array { @@ -64,7 +64,7 @@ public function getCompanies(): array } /** - * @param Company[] $companies + * @param list $companies */ public function setCompanies(array $companies): self { diff --git a/generated/Model/Contacts.php b/generated/Model/Contacts.php index 75ea776..b7b59ad 100644 --- a/generated/Model/Contacts.php +++ b/generated/Model/Contacts.php @@ -18,7 +18,7 @@ class Contacts extends \ArrayObject */ protected $initialized = []; /** - * @var Contact[] + * @var list */ protected $contacts; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return Contact[] + * @return list */ public function getContacts(): array { @@ -64,7 +64,7 @@ public function getContacts(): array } /** - * @param Contact[] $contacts + * @param list $contacts */ public function setContacts(array $contacts): self { diff --git a/generated/Model/CostRates.php b/generated/Model/CostRates.php index f20cfb8..a2dcc50 100644 --- a/generated/Model/CostRates.php +++ b/generated/Model/CostRates.php @@ -18,7 +18,7 @@ class CostRates extends \ArrayObject */ protected $initialized = []; /** - * @var CostRate[] + * @var list */ protected $costRates; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return CostRate[] + * @return list */ public function getCostRates(): array { @@ -64,7 +64,7 @@ public function getCostRates(): array } /** - * @param CostRate[] $costRates + * @param list $costRates */ public function setCostRates(array $costRates): self { diff --git a/generated/Model/Estimate.php b/generated/Model/Estimate.php index 4411627..4fac46a 100644 --- a/generated/Model/Estimate.php +++ b/generated/Model/Estimate.php @@ -32,7 +32,7 @@ class Estimate extends \ArrayObject /** * Array of estimate line items. * - * @var EstimateLineItem[]|null + * @var list|null */ protected $lineItems; /** @@ -208,7 +208,7 @@ public function setClient(?EstimateClient $client): self /** * Array of estimate line items. * - * @return EstimateLineItem[]|null + * @return list|null */ public function getLineItems(): ?array { @@ -218,7 +218,7 @@ public function getLineItems(): ?array /** * Array of estimate line items. * - * @param EstimateLineItem[]|null $lineItems + * @param list|null $lineItems */ public function setLineItems(?array $lineItems): self { diff --git a/generated/Model/EstimateItemCategories.php b/generated/Model/EstimateItemCategories.php index 90455ab..56440ad 100644 --- a/generated/Model/EstimateItemCategories.php +++ b/generated/Model/EstimateItemCategories.php @@ -18,7 +18,7 @@ class EstimateItemCategories extends \ArrayObject */ protected $initialized = []; /** - * @var EstimateItemCategory[] + * @var list */ protected $estimateItemCategories; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return EstimateItemCategory[] + * @return list */ public function getEstimateItemCategories(): array { @@ -64,7 +64,7 @@ public function getEstimateItemCategories(): array } /** - * @param EstimateItemCategory[] $estimateItemCategories + * @param list $estimateItemCategories */ public function setEstimateItemCategories(array $estimateItemCategories): self { diff --git a/generated/Model/EstimateLineItems.php b/generated/Model/EstimateLineItems.php index 87cf847..7b21f77 100644 --- a/generated/Model/EstimateLineItems.php +++ b/generated/Model/EstimateLineItems.php @@ -18,7 +18,7 @@ class EstimateLineItems extends \ArrayObject */ protected $initialized = []; /** - * @var EstimateLineItem[] + * @var list */ protected $estimateLineItems; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return EstimateLineItem[] + * @return list */ public function getEstimateLineItems(): array { @@ -64,7 +64,7 @@ public function getEstimateLineItems(): array } /** - * @param EstimateLineItem[] $estimateLineItems + * @param list $estimateLineItems */ public function setEstimateLineItems(array $estimateLineItems): self { diff --git a/generated/Model/EstimateMessage.php b/generated/Model/EstimateMessage.php index 47540a6..ed40d4f 100644 --- a/generated/Model/EstimateMessage.php +++ b/generated/Model/EstimateMessage.php @@ -50,7 +50,7 @@ class EstimateMessage extends \ArrayObject /** * Array of estimate message recipients. * - * @var EstimateMessageRecipient[]|null + * @var list|null */ protected $recipients; /** @@ -193,7 +193,7 @@ public function setSentFromEmail(?string $sentFromEmail): self /** * Array of estimate message recipients. * - * @return EstimateMessageRecipient[]|null + * @return list|null */ public function getRecipients(): ?array { @@ -203,7 +203,7 @@ public function getRecipients(): ?array /** * Array of estimate message recipients. * - * @param EstimateMessageRecipient[]|null $recipients + * @param list|null $recipients */ public function setRecipients(?array $recipients): self { diff --git a/generated/Model/EstimateMessageRecipients.php b/generated/Model/EstimateMessageRecipients.php index d1883b5..c56409f 100644 --- a/generated/Model/EstimateMessageRecipients.php +++ b/generated/Model/EstimateMessageRecipients.php @@ -18,7 +18,7 @@ class EstimateMessageRecipients extends \ArrayObject */ protected $initialized = []; /** - * @var EstimateMessageRecipient[] + * @var list */ protected $estimateMessageRecipients; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return EstimateMessageRecipient[] + * @return list */ public function getEstimateMessageRecipients(): array { @@ -64,7 +64,7 @@ public function getEstimateMessageRecipients(): array } /** - * @param EstimateMessageRecipient[] $estimateMessageRecipients + * @param list $estimateMessageRecipients */ public function setEstimateMessageRecipients(array $estimateMessageRecipients): self { diff --git a/generated/Model/EstimateMessages.php b/generated/Model/EstimateMessages.php index ab5d6e6..0e72b7e 100644 --- a/generated/Model/EstimateMessages.php +++ b/generated/Model/EstimateMessages.php @@ -18,7 +18,7 @@ class EstimateMessages extends \ArrayObject */ protected $initialized = []; /** - * @var EstimateMessage[] + * @var list */ protected $estimateMessages; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return EstimateMessage[] + * @return list */ public function getEstimateMessages(): array { @@ -64,7 +64,7 @@ public function getEstimateMessages(): array } /** - * @param EstimateMessage[] $estimateMessages + * @param list $estimateMessages */ public function setEstimateMessages(array $estimateMessages): self { diff --git a/generated/Model/Estimates.php b/generated/Model/Estimates.php index d716949..7a5be8f 100644 --- a/generated/Model/Estimates.php +++ b/generated/Model/Estimates.php @@ -18,7 +18,7 @@ class Estimates extends \ArrayObject */ protected $initialized = []; /** - * @var Estimate[] + * @var list */ protected $estimates; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return Estimate[] + * @return list */ public function getEstimates(): array { @@ -64,7 +64,7 @@ public function getEstimates(): array } /** - * @param Estimate[] $estimates + * @param list $estimates */ public function setEstimates(array $estimates): self { diff --git a/generated/Model/EstimatesEstimateIdMessagesPostBody.php b/generated/Model/EstimatesEstimateIdMessagesPostBody.php index 8a9df18..b58cfda 100644 --- a/generated/Model/EstimatesEstimateIdMessagesPostBody.php +++ b/generated/Model/EstimatesEstimateIdMessagesPostBody.php @@ -26,7 +26,7 @@ class EstimatesEstimateIdMessagesPostBody extends \ArrayObject /** * Array of recipient parameters. See below for details. * - * @var EstimatesEstimateIdMessagesPostBodyRecipientsItem[]|null + * @var list|null */ protected $recipients; /** @@ -75,7 +75,7 @@ public function setEventType(?string $eventType): self /** * Array of recipient parameters. See below for details. * - * @return EstimatesEstimateIdMessagesPostBodyRecipientsItem[]|null + * @return list|null */ public function getRecipients(): ?array { @@ -85,7 +85,7 @@ public function getRecipients(): ?array /** * Array of recipient parameters. See below for details. * - * @param EstimatesEstimateIdMessagesPostBodyRecipientsItem[]|null $recipients + * @param list|null $recipients */ public function setRecipients(?array $recipients): self { diff --git a/generated/Model/EstimatesEstimateIdPatchBody.php b/generated/Model/EstimatesEstimateIdPatchBody.php index 081c960..a0e76b6 100644 --- a/generated/Model/EstimatesEstimateIdPatchBody.php +++ b/generated/Model/EstimatesEstimateIdPatchBody.php @@ -80,7 +80,7 @@ class EstimatesEstimateIdPatchBody extends \ArrayObject /** * Array of line item parameters. * - * @var EstimatesEstimateIdPatchBodyLineItemsItem[]|null + * @var list|null */ protected $lineItems; @@ -282,7 +282,7 @@ public function setIssueDate(?\DateTime $issueDate): self /** * Array of line item parameters. * - * @return EstimatesEstimateIdPatchBodyLineItemsItem[]|null + * @return list|null */ public function getLineItems(): ?array { @@ -292,7 +292,7 @@ public function getLineItems(): ?array /** * Array of line item parameters. * - * @param EstimatesEstimateIdPatchBodyLineItemsItem[]|null $lineItems + * @param list|null $lineItems */ public function setLineItems(?array $lineItems): self { diff --git a/generated/Model/EstimatesPostBody.php b/generated/Model/EstimatesPostBody.php index 81b688c..e97f7fe 100644 --- a/generated/Model/EstimatesPostBody.php +++ b/generated/Model/EstimatesPostBody.php @@ -80,7 +80,7 @@ class EstimatesPostBody extends \ArrayObject /** * Array of line item parameters. * - * @var EstimatesPostBodyLineItemsItem[]|null + * @var list|null */ protected $lineItems; @@ -282,7 +282,7 @@ public function setIssueDate(?\DateTime $issueDate): self /** * Array of line item parameters. * - * @return EstimatesPostBodyLineItemsItem[]|null + * @return list|null */ public function getLineItems(): ?array { @@ -292,7 +292,7 @@ public function getLineItems(): ?array /** * Array of line item parameters. * - * @param EstimatesPostBodyLineItemsItem[]|null $lineItems + * @param list|null $lineItems */ public function setLineItems(?array $lineItems): self { diff --git a/generated/Model/Expense.php b/generated/Model/Expense.php index 0d0e0b7..1ae5a6a 100644 --- a/generated/Model/Expense.php +++ b/generated/Model/Expense.php @@ -88,7 +88,7 @@ class Expense extends \ArrayObject */ protected $billable; /** - * Whether the expense has been approved or closed for some other reason. + * Whether the expense has been approved or not. * * @var bool|null */ @@ -358,7 +358,7 @@ public function setBillable(?bool $billable): self } /** - * Whether the expense has been approved or closed for some other reason. + * Whether the expense has been approved or not. */ public function getIsClosed(): ?bool { @@ -366,7 +366,7 @@ public function getIsClosed(): ?bool } /** - * Whether the expense has been approved or closed for some other reason. + * Whether the expense has been approved or not. */ public function setIsClosed(?bool $isClosed): self { diff --git a/generated/Model/ExpenseCategories.php b/generated/Model/ExpenseCategories.php index 6fdf375..3a83ac0 100644 --- a/generated/Model/ExpenseCategories.php +++ b/generated/Model/ExpenseCategories.php @@ -18,7 +18,7 @@ class ExpenseCategories extends \ArrayObject */ protected $initialized = []; /** - * @var ExpenseCategory[] + * @var list */ protected $expenseCategories; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return ExpenseCategory[] + * @return list */ public function getExpenseCategories(): array { @@ -64,7 +64,7 @@ public function getExpenseCategories(): array } /** - * @param ExpenseCategory[] $expenseCategories + * @param list $expenseCategories */ public function setExpenseCategories(array $expenseCategories): self { diff --git a/generated/Model/ExpenseReportsResults.php b/generated/Model/ExpenseReportsResults.php index 87faeb4..48abbf5 100644 --- a/generated/Model/ExpenseReportsResults.php +++ b/generated/Model/ExpenseReportsResults.php @@ -18,7 +18,7 @@ class ExpenseReportsResults extends \ArrayObject */ protected $initialized = []; /** - * @var ExpenseReportsResult[] + * @var list */ protected $results; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return ExpenseReportsResult[] + * @return list */ public function getResults(): array { @@ -64,7 +64,7 @@ public function getResults(): array } /** - * @param ExpenseReportsResult[] $results + * @param list $results */ public function setResults(array $results): self { diff --git a/generated/Model/Expenses.php b/generated/Model/Expenses.php index 5ecad06..9953202 100644 --- a/generated/Model/Expenses.php +++ b/generated/Model/Expenses.php @@ -18,7 +18,7 @@ class Expenses extends \ArrayObject */ protected $initialized = []; /** - * @var Expense[] + * @var list */ protected $expenses; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return Expense[] + * @return list */ public function getExpenses(): array { @@ -64,7 +64,7 @@ public function getExpenses(): array } /** - * @param Expense[] $expenses + * @param list $expenses */ public function setExpenses(array $expenses): self { diff --git a/generated/Model/Invoice.php b/generated/Model/Invoice.php index 3fdf68e..f3eee69 100644 --- a/generated/Model/Invoice.php +++ b/generated/Model/Invoice.php @@ -32,7 +32,7 @@ class Invoice extends \ArrayObject /** * Array of invoice line items. * - * @var InvoiceLineItem[]|null + * @var list|null */ protected $lineItems; /** @@ -176,7 +176,7 @@ class Invoice extends \ArrayObject /** * The list of payment options enabled for the invoice. Options: [ach, credit_card, paypal]. * - * @var string[]|null + * @var list|null */ protected $paymentOptions; /** @@ -268,7 +268,7 @@ public function setClient(?InvoiceClient $client): self /** * Array of invoice line items. * - * @return InvoiceLineItem[]|null + * @return list|null */ public function getLineItems(): ?array { @@ -278,7 +278,7 @@ public function getLineItems(): ?array /** * Array of invoice line items. * - * @param InvoiceLineItem[]|null $lineItems + * @param list|null $lineItems */ public function setLineItems(?array $lineItems): self { @@ -728,7 +728,7 @@ public function setPaymentTerm(?string $paymentTerm): self /** * The list of payment options enabled for the invoice. Options: [ach, credit_card, paypal]. * - * @return string[]|null + * @return list|null */ public function getPaymentOptions(): ?array { @@ -738,7 +738,7 @@ public function getPaymentOptions(): ?array /** * The list of payment options enabled for the invoice. Options: [ach, credit_card, paypal]. * - * @param string[]|null $paymentOptions + * @param list|null $paymentOptions */ public function setPaymentOptions(?array $paymentOptions): self { diff --git a/generated/Model/InvoiceItemCategories.php b/generated/Model/InvoiceItemCategories.php index 230ab9f..a926a73 100644 --- a/generated/Model/InvoiceItemCategories.php +++ b/generated/Model/InvoiceItemCategories.php @@ -18,7 +18,7 @@ class InvoiceItemCategories extends \ArrayObject */ protected $initialized = []; /** - * @var InvoiceItemCategory[] + * @var list */ protected $invoiceItemCategories; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return InvoiceItemCategory[] + * @return list */ public function getInvoiceItemCategories(): array { @@ -64,7 +64,7 @@ public function getInvoiceItemCategories(): array } /** - * @param InvoiceItemCategory[] $invoiceItemCategories + * @param list $invoiceItemCategories */ public function setInvoiceItemCategories(array $invoiceItemCategories): self { diff --git a/generated/Model/InvoiceLineItems.php b/generated/Model/InvoiceLineItems.php index c31da48..5827621 100644 --- a/generated/Model/InvoiceLineItems.php +++ b/generated/Model/InvoiceLineItems.php @@ -18,7 +18,7 @@ class InvoiceLineItems extends \ArrayObject */ protected $initialized = []; /** - * @var InvoiceLineItem[] + * @var list */ protected $invoiceLineItems; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return InvoiceLineItem[] + * @return list */ public function getInvoiceLineItems(): array { @@ -64,7 +64,7 @@ public function getInvoiceLineItems(): array } /** - * @param InvoiceLineItem[] $invoiceLineItems + * @param list $invoiceLineItems */ public function setInvoiceLineItems(array $invoiceLineItems): self { diff --git a/generated/Model/InvoiceMessage.php b/generated/Model/InvoiceMessage.php index 9b92dda..75f31aa 100644 --- a/generated/Model/InvoiceMessage.php +++ b/generated/Model/InvoiceMessage.php @@ -50,7 +50,7 @@ class InvoiceMessage extends \ArrayObject /** * Array of invoice message recipients. * - * @var InvoiceMessageRecipient[]|null + * @var list|null */ protected $recipients; /** @@ -225,7 +225,7 @@ public function setSentFromEmail(?string $sentFromEmail): self /** * Array of invoice message recipients. * - * @return InvoiceMessageRecipient[]|null + * @return list|null */ public function getRecipients(): ?array { @@ -235,7 +235,7 @@ public function getRecipients(): ?array /** * Array of invoice message recipients. * - * @param InvoiceMessageRecipient[]|null $recipients + * @param list|null $recipients */ public function setRecipients(?array $recipients): self { diff --git a/generated/Model/InvoiceMessageRecipients.php b/generated/Model/InvoiceMessageRecipients.php index d2c5d9c..862d725 100644 --- a/generated/Model/InvoiceMessageRecipients.php +++ b/generated/Model/InvoiceMessageRecipients.php @@ -18,7 +18,7 @@ class InvoiceMessageRecipients extends \ArrayObject */ protected $initialized = []; /** - * @var InvoiceMessageRecipient[] + * @var list */ protected $invoiceMessageRecipients; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return InvoiceMessageRecipient[] + * @return list */ public function getInvoiceMessageRecipients(): array { @@ -64,7 +64,7 @@ public function getInvoiceMessageRecipients(): array } /** - * @param InvoiceMessageRecipient[] $invoiceMessageRecipients + * @param list $invoiceMessageRecipients */ public function setInvoiceMessageRecipients(array $invoiceMessageRecipients): self { diff --git a/generated/Model/InvoiceMessages.php b/generated/Model/InvoiceMessages.php index aef2ddd..58f41bc 100644 --- a/generated/Model/InvoiceMessages.php +++ b/generated/Model/InvoiceMessages.php @@ -18,7 +18,7 @@ class InvoiceMessages extends \ArrayObject */ protected $initialized = []; /** - * @var InvoiceMessage[] + * @var list */ protected $invoiceMessages; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return InvoiceMessage[] + * @return list */ public function getInvoiceMessages(): array { @@ -64,7 +64,7 @@ public function getInvoiceMessages(): array } /** - * @param InvoiceMessage[] $invoiceMessages + * @param list $invoiceMessages */ public function setInvoiceMessages(array $invoiceMessages): self { diff --git a/generated/Model/InvoicePayments.php b/generated/Model/InvoicePayments.php index b0f2dc6..fd8961d 100644 --- a/generated/Model/InvoicePayments.php +++ b/generated/Model/InvoicePayments.php @@ -18,7 +18,7 @@ class InvoicePayments extends \ArrayObject */ protected $initialized = []; /** - * @var InvoicePayment[] + * @var list */ protected $invoicePayments; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return InvoicePayment[] + * @return list */ public function getInvoicePayments(): array { @@ -64,7 +64,7 @@ public function getInvoicePayments(): array } /** - * @param InvoicePayment[] $invoicePayments + * @param list $invoicePayments */ public function setInvoicePayments(array $invoicePayments): self { diff --git a/generated/Model/Invoices.php b/generated/Model/Invoices.php index a141b33..be6e30f 100644 --- a/generated/Model/Invoices.php +++ b/generated/Model/Invoices.php @@ -18,7 +18,7 @@ class Invoices extends \ArrayObject */ protected $initialized = []; /** - * @var Invoice[] + * @var list */ protected $invoices; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return Invoice[] + * @return list */ public function getInvoices(): array { @@ -64,7 +64,7 @@ public function getInvoices(): array } /** - * @param Invoice[] $invoices + * @param list $invoices */ public function setInvoices(array $invoices): self { diff --git a/generated/Model/InvoicesInvoiceIdMessagesPostBody.php b/generated/Model/InvoicesInvoiceIdMessagesPostBody.php index 5454b08..6211aab 100644 --- a/generated/Model/InvoicesInvoiceIdMessagesPostBody.php +++ b/generated/Model/InvoicesInvoiceIdMessagesPostBody.php @@ -26,7 +26,7 @@ class InvoicesInvoiceIdMessagesPostBody extends \ArrayObject /** * Array of recipient parameters. See below for details. * - * @var InvoicesInvoiceIdMessagesPostBodyRecipientsItem[]|null + * @var list|null */ protected $recipients; /** @@ -95,7 +95,7 @@ public function setEventType(?string $eventType): self /** * Array of recipient parameters. See below for details. * - * @return InvoicesInvoiceIdMessagesPostBodyRecipientsItem[]|null + * @return list|null */ public function getRecipients(): ?array { @@ -105,7 +105,7 @@ public function getRecipients(): ?array /** * Array of recipient parameters. See below for details. * - * @param InvoicesInvoiceIdMessagesPostBodyRecipientsItem[]|null $recipients + * @param list|null $recipients */ public function setRecipients(?array $recipients): self { diff --git a/generated/Model/InvoicesInvoiceIdPatchBody.php b/generated/Model/InvoicesInvoiceIdPatchBody.php index 09f5747..12fcbb2 100644 --- a/generated/Model/InvoicesInvoiceIdPatchBody.php +++ b/generated/Model/InvoicesInvoiceIdPatchBody.php @@ -104,13 +104,13 @@ class InvoicesInvoiceIdPatchBody extends \ArrayObject /** * The payment options available to pay the invoice. Your account must be configured with the appropriate options under Settings > Integrations > Online payment to assign them. Options: [ach, credit_card, paypal]. * - * @var string[]|null + * @var list|null */ protected $paymentOptions; /** * Array of line item parameters. * - * @var InvoicesInvoiceIdPatchBodyLineItemsItem[]|null + * @var list|null */ protected $lineItems; @@ -388,7 +388,7 @@ public function setPaymentTerm(?string $paymentTerm): self /** * The payment options available to pay the invoice. Your account must be configured with the appropriate options under Settings > Integrations > Online payment to assign them. Options: [ach, credit_card, paypal]. * - * @return string[]|null + * @return list|null */ public function getPaymentOptions(): ?array { @@ -398,7 +398,7 @@ public function getPaymentOptions(): ?array /** * The payment options available to pay the invoice. Your account must be configured with the appropriate options under Settings > Integrations > Online payment to assign them. Options: [ach, credit_card, paypal]. * - * @param string[]|null $paymentOptions + * @param list|null $paymentOptions */ public function setPaymentOptions(?array $paymentOptions): self { @@ -411,7 +411,7 @@ public function setPaymentOptions(?array $paymentOptions): self /** * Array of line item parameters. * - * @return InvoicesInvoiceIdPatchBodyLineItemsItem[]|null + * @return list|null */ public function getLineItems(): ?array { @@ -421,7 +421,7 @@ public function getLineItems(): ?array /** * Array of line item parameters. * - * @param InvoicesInvoiceIdPatchBodyLineItemsItem[]|null $lineItems + * @param list|null $lineItems */ public function setLineItems(?array $lineItems): self { diff --git a/generated/Model/InvoicesInvoiceIdPaymentsPostBody.php b/generated/Model/InvoicesInvoiceIdPaymentsPostBody.php index da1cbda..093e3ed 100644 --- a/generated/Model/InvoicesInvoiceIdPaymentsPostBody.php +++ b/generated/Model/InvoicesInvoiceIdPaymentsPostBody.php @@ -41,6 +41,12 @@ class InvoicesInvoiceIdPaymentsPostBody extends \ArrayObject * @var string|null */ protected $notes; + /** + * Whether or not to send a thank you email (if enabled for your account in Invoices > Configure > Messages). Only sends an email if the invoice will be fully paid after creating this payment. Defaults to true. + * + * @var bool|null + */ + protected $sendThankYou; public function isInitialized($property): bool { @@ -122,4 +128,23 @@ public function setNotes(?string $notes): self return $this; } + + /** + * Whether or not to send a thank you email (if enabled for your account in Invoices > Configure > Messages). Only sends an email if the invoice will be fully paid after creating this payment. Defaults to true. + */ + public function getSendThankYou(): ?bool + { + return $this->sendThankYou; + } + + /** + * Whether or not to send a thank you email (if enabled for your account in Invoices > Configure > Messages). Only sends an email if the invoice will be fully paid after creating this payment. Defaults to true. + */ + public function setSendThankYou(?bool $sendThankYou): self + { + $this->initialized['sendThankYou'] = true; + $this->sendThankYou = $sendThankYou; + + return $this; + } } diff --git a/generated/Model/InvoicesPostBody.php b/generated/Model/InvoicesPostBody.php index f6c87a8..38347de 100644 --- a/generated/Model/InvoicesPostBody.php +++ b/generated/Model/InvoicesPostBody.php @@ -98,7 +98,7 @@ class InvoicesPostBody extends \ArrayObject /** * The payment options available to pay the invoice. Your account must be configured with the appropriate options under Settings > Integrations > Online payment to assign them. Options: [ach, credit_card, paypal]. * - * @var string[]|null + * @var list|null */ protected $paymentOptions; /** @@ -116,7 +116,7 @@ class InvoicesPostBody extends \ArrayObject /** * Array of line item parameters. * - * @var InvoicesPostBodyLineItemsItem[]|null + * @var list|null */ protected $lineItems; @@ -375,7 +375,7 @@ public function setPaymentTerm(?string $paymentTerm): self /** * The payment options available to pay the invoice. Your account must be configured with the appropriate options under Settings > Integrations > Online payment to assign them. Options: [ach, credit_card, paypal]. * - * @return string[]|null + * @return list|null */ public function getPaymentOptions(): ?array { @@ -385,7 +385,7 @@ public function getPaymentOptions(): ?array /** * The payment options available to pay the invoice. Your account must be configured with the appropriate options under Settings > Integrations > Online payment to assign them. Options: [ach, credit_card, paypal]. * - * @param string[]|null $paymentOptions + * @param list|null $paymentOptions */ public function setPaymentOptions(?array $paymentOptions): self { @@ -436,7 +436,7 @@ public function setRetainerId(?int $retainerId): self /** * Array of line item parameters. * - * @return InvoicesPostBodyLineItemsItem[]|null + * @return list|null */ public function getLineItems(): ?array { @@ -446,7 +446,7 @@ public function getLineItems(): ?array /** * Array of line item parameters. * - * @param InvoicesPostBodyLineItemsItem[]|null $lineItems + * @param list|null $lineItems */ public function setLineItems(?array $lineItems): self { diff --git a/generated/Model/InvoicesPostBodyLineItemsImport.php b/generated/Model/InvoicesPostBodyLineItemsImport.php index e6b064a..51173de 100644 --- a/generated/Model/InvoicesPostBodyLineItemsImport.php +++ b/generated/Model/InvoicesPostBodyLineItemsImport.php @@ -20,7 +20,7 @@ class InvoicesPostBodyLineItemsImport extends \ArrayObject /** * An array of the client’s project IDs you’d like to include time/expenses from. * - * @var int[] + * @var list */ protected $projectIds; /** @@ -44,7 +44,7 @@ public function isInitialized($property): bool /** * An array of the client’s project IDs you’d like to include time/expenses from. * - * @return int[] + * @return list */ public function getProjectIds(): array { @@ -54,7 +54,7 @@ public function getProjectIds(): array /** * An array of the client’s project IDs you’d like to include time/expenses from. * - * @param int[] $projectIds + * @param list $projectIds */ public function setProjectIds(array $projectIds): self { diff --git a/generated/Model/ProjectAssignment.php b/generated/Model/ProjectAssignment.php index 46effa7..a9186f9 100644 --- a/generated/Model/ProjectAssignment.php +++ b/generated/Model/ProjectAssignment.php @@ -80,7 +80,7 @@ class ProjectAssignment extends \ArrayObject /** * Array of task assignment objects associated with the project. * - * @var TaskAssignment[]|null + * @var list|null */ protected $taskAssignments; @@ -282,7 +282,7 @@ public function setClient(?ProjectAssignmentClient $client): self /** * Array of task assignment objects associated with the project. * - * @return TaskAssignment[]|null + * @return list|null */ public function getTaskAssignments(): ?array { @@ -292,7 +292,7 @@ public function getTaskAssignments(): ?array /** * Array of task assignment objects associated with the project. * - * @param TaskAssignment[]|null $taskAssignments + * @param list|null $taskAssignments */ public function setTaskAssignments(?array $taskAssignments): self { diff --git a/generated/Model/ProjectAssignments.php b/generated/Model/ProjectAssignments.php index 9588ea8..edb9f25 100644 --- a/generated/Model/ProjectAssignments.php +++ b/generated/Model/ProjectAssignments.php @@ -18,7 +18,7 @@ class ProjectAssignments extends \ArrayObject */ protected $initialized = []; /** - * @var ProjectAssignment[] + * @var list */ protected $projectAssignments; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return ProjectAssignment[] + * @return list */ public function getProjectAssignments(): array { @@ -64,7 +64,7 @@ public function getProjectAssignments(): array } /** - * @param ProjectAssignment[] $projectAssignments + * @param list $projectAssignments */ public function setProjectAssignments(array $projectAssignments): self { diff --git a/generated/Model/ProjectBudgetReportResults.php b/generated/Model/ProjectBudgetReportResults.php index da16c90..3014eb9 100644 --- a/generated/Model/ProjectBudgetReportResults.php +++ b/generated/Model/ProjectBudgetReportResults.php @@ -18,7 +18,7 @@ class ProjectBudgetReportResults extends \ArrayObject */ protected $initialized = []; /** - * @var ProjectBudgetReportResult[] + * @var list */ protected $results; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return ProjectBudgetReportResult[] + * @return list */ public function getResults(): array { @@ -64,7 +64,7 @@ public function getResults(): array } /** - * @param ProjectBudgetReportResult[] $results + * @param list $results */ public function setResults(array $results): self { diff --git a/generated/Model/Projects.php b/generated/Model/Projects.php index 0d94b79..468aa59 100644 --- a/generated/Model/Projects.php +++ b/generated/Model/Projects.php @@ -18,7 +18,7 @@ class Projects extends \ArrayObject */ protected $initialized = []; /** - * @var Project[] + * @var list */ protected $projects; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return Project[] + * @return list */ public function getProjects(): array { @@ -64,7 +64,7 @@ public function getProjects(): array } /** - * @param Project[] $projects + * @param list $projects */ public function setProjects(array $projects): self { diff --git a/generated/Model/Role.php b/generated/Model/Role.php index 427d7d8..8d29e45 100644 --- a/generated/Model/Role.php +++ b/generated/Model/Role.php @@ -32,7 +32,7 @@ class Role extends \ArrayObject /** * The IDs of the users assigned to this role. * - * @var int[]|null + * @var list|null */ protected $userIds; /** @@ -94,7 +94,7 @@ public function setName(?string $name): self /** * The IDs of the users assigned to this role. * - * @return int[]|null + * @return list|null */ public function getUserIds(): ?array { @@ -104,7 +104,7 @@ public function getUserIds(): ?array /** * The IDs of the users assigned to this role. * - * @param int[]|null $userIds + * @param list|null $userIds */ public function setUserIds(?array $userIds): self { diff --git a/generated/Model/Roles.php b/generated/Model/Roles.php index d3a101c..a69458f 100644 --- a/generated/Model/Roles.php +++ b/generated/Model/Roles.php @@ -18,7 +18,7 @@ class Roles extends \ArrayObject */ protected $initialized = []; /** - * @var Role[] + * @var list */ protected $roles; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return Role[] + * @return list */ public function getRoles(): array { @@ -64,7 +64,7 @@ public function getRoles(): array } /** - * @param Role[] $roles + * @param list $roles */ public function setRoles(array $roles): self { diff --git a/generated/Model/RolesPostBody.php b/generated/Model/RolesPostBody.php index 6eb3fab..27b89ac 100644 --- a/generated/Model/RolesPostBody.php +++ b/generated/Model/RolesPostBody.php @@ -26,7 +26,7 @@ class RolesPostBody extends \ArrayObject /** * The IDs of the users assigned to this role. * - * @var int[]|null + * @var list|null */ protected $userIds; @@ -57,7 +57,7 @@ public function setName(?string $name): self /** * The IDs of the users assigned to this role. * - * @return int[]|null + * @return list|null */ public function getUserIds(): ?array { @@ -67,7 +67,7 @@ public function getUserIds(): ?array /** * The IDs of the users assigned to this role. * - * @param int[]|null $userIds + * @param list|null $userIds */ public function setUserIds(?array $userIds): self { diff --git a/generated/Model/RolesRoleIdPatchBody.php b/generated/Model/RolesRoleIdPatchBody.php index b543a9a..15f9314 100644 --- a/generated/Model/RolesRoleIdPatchBody.php +++ b/generated/Model/RolesRoleIdPatchBody.php @@ -26,7 +26,7 @@ class RolesRoleIdPatchBody extends \ArrayObject /** * The IDs of the users assigned to this role. * - * @var int[]|null + * @var list|null */ protected $userIds; @@ -57,7 +57,7 @@ public function setName(?string $name): self /** * The IDs of the users assigned to this role. * - * @return int[]|null + * @return list|null */ public function getUserIds(): ?array { @@ -67,7 +67,7 @@ public function getUserIds(): ?array /** * The IDs of the users assigned to this role. * - * @param int[]|null $userIds + * @param list|null $userIds */ public function setUserIds(?array $userIds): self { diff --git a/generated/Model/TaskAssignments.php b/generated/Model/TaskAssignments.php index 53759c1..297eb35 100644 --- a/generated/Model/TaskAssignments.php +++ b/generated/Model/TaskAssignments.php @@ -18,7 +18,7 @@ class TaskAssignments extends \ArrayObject */ protected $initialized = []; /** - * @var TaskAssignment[] + * @var list */ protected $taskAssignments; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return TaskAssignment[] + * @return list */ public function getTaskAssignments(): array { @@ -64,7 +64,7 @@ public function getTaskAssignments(): array } /** - * @param TaskAssignment[] $taskAssignments + * @param list $taskAssignments */ public function setTaskAssignments(array $taskAssignments): self { diff --git a/generated/Model/Tasks.php b/generated/Model/Tasks.php index 8340d9e..ec5a868 100644 --- a/generated/Model/Tasks.php +++ b/generated/Model/Tasks.php @@ -18,7 +18,7 @@ class Tasks extends \ArrayObject */ protected $initialized = []; /** - * @var Task[] + * @var list */ protected $tasks; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return Task[] + * @return list */ public function getTasks(): array { @@ -64,7 +64,7 @@ public function getTasks(): array } /** - * @param Task[] $tasks + * @param list $tasks */ public function setTasks(array $tasks): self { diff --git a/generated/Model/Teammates.php b/generated/Model/Teammates.php index baa9c3c..2b6b6ba 100644 --- a/generated/Model/Teammates.php +++ b/generated/Model/Teammates.php @@ -18,7 +18,7 @@ class Teammates extends \ArrayObject */ protected $initialized = []; /** - * @var Teammate[] + * @var list */ protected $teammates; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return Teammate[] + * @return list */ public function getTeammates(): array { @@ -64,7 +64,7 @@ public function getTeammates(): array } /** - * @param Teammate[] $teammates + * @param list $teammates */ public function setTeammates(array $teammates): self { diff --git a/generated/Model/TeammatesPatchResponse.php b/generated/Model/TeammatesPatchResponse.php index 5193128..f7515ba 100644 --- a/generated/Model/TeammatesPatchResponse.php +++ b/generated/Model/TeammatesPatchResponse.php @@ -18,7 +18,7 @@ class TeammatesPatchResponse extends \ArrayObject */ protected $initialized = []; /** - * @var Teammate[] + * @var list */ protected $teammates; @@ -28,7 +28,7 @@ public function isInitialized($property): bool } /** - * @return Teammate[] + * @return list */ public function getTeammates(): array { @@ -36,7 +36,7 @@ public function getTeammates(): array } /** - * @param Teammate[] $teammates + * @param list $teammates */ public function setTeammates(array $teammates): self { diff --git a/generated/Model/TimeEntries.php b/generated/Model/TimeEntries.php index be5bdaf..80ea7ed 100644 --- a/generated/Model/TimeEntries.php +++ b/generated/Model/TimeEntries.php @@ -18,7 +18,7 @@ class TimeEntries extends \ArrayObject */ protected $initialized = []; /** - * @var TimeEntry[] + * @var list */ protected $timeEntries; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return TimeEntry[] + * @return list */ public function getTimeEntries(): array { @@ -64,7 +64,7 @@ public function getTimeEntries(): array } /** - * @param TimeEntry[] $timeEntries + * @param list $timeEntries */ public function setTimeEntries(array $timeEntries): self { diff --git a/generated/Model/TimeEntry.php b/generated/Model/TimeEntry.php index 31c75a1..3e64ec7 100644 --- a/generated/Model/TimeEntry.php +++ b/generated/Model/TimeEntry.php @@ -122,7 +122,7 @@ class TimeEntry extends \ArrayObject */ protected $isBilled; /** - * Date and time the timer was started (if tracking by duration). Use the ISO 8601 Format. + * Date and time the running timer was started (if tracking by duration). Use the ISO 8601 Format. Returns null for stopped timers. * * @var \DateTime|null */ @@ -518,7 +518,7 @@ public function setIsBilled(?bool $isBilled): self } /** - * Date and time the timer was started (if tracking by duration). Use the ISO 8601 Format. + * Date and time the running timer was started (if tracking by duration). Use the ISO 8601 Format. Returns null for stopped timers. */ public function getTimerStartedAt(): ?\DateTime { @@ -526,7 +526,7 @@ public function getTimerStartedAt(): ?\DateTime } /** - * Date and time the timer was started (if tracking by duration). Use the ISO 8601 Format. + * Date and time the running timer was started (if tracking by duration). Use the ISO 8601 Format. Returns null for stopped timers. */ public function setTimerStartedAt(?\DateTime $timerStartedAt): self { diff --git a/generated/Model/TimeReportsResults.php b/generated/Model/TimeReportsResults.php index 2c656d6..b170f49 100644 --- a/generated/Model/TimeReportsResults.php +++ b/generated/Model/TimeReportsResults.php @@ -18,7 +18,7 @@ class TimeReportsResults extends \ArrayObject */ protected $initialized = []; /** - * @var TimeReportsResult[] + * @var list */ protected $results; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return TimeReportsResult[] + * @return list */ public function getResults(): array { @@ -64,7 +64,7 @@ public function getResults(): array } /** - * @param TimeReportsResult[] $results + * @param list $results */ public function setResults(array $results): self { diff --git a/generated/Model/UninvoicedReportResults.php b/generated/Model/UninvoicedReportResults.php index 670b1e6..0f7e302 100644 --- a/generated/Model/UninvoicedReportResults.php +++ b/generated/Model/UninvoicedReportResults.php @@ -18,7 +18,7 @@ class UninvoicedReportResults extends \ArrayObject */ protected $initialized = []; /** - * @var UninvoicedReportResult[] + * @var list */ protected $results; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return UninvoicedReportResult[] + * @return list */ public function getResults(): array { @@ -64,7 +64,7 @@ public function getResults(): array } /** - * @param UninvoicedReportResult[] $results + * @param list $results */ public function setResults(array $results): self { diff --git a/generated/Model/User.php b/generated/Model/User.php index 26dca03..b8fdd7c 100644 --- a/generated/Model/User.php +++ b/generated/Model/User.php @@ -92,13 +92,13 @@ class User extends \ArrayObject /** * Descriptive names of the business roles assigned to this person. They can be used for filtering reports, and have no effect in their permissions in Harvest. * - * @var string[]|null + * @var list|null */ protected $roles; /** * Access role(s) that determine the user’s permissions in Harvest. Possible values: administrator, manager or member. Users with the manager role can additionally be granted one or more of these roles: project_creator, billable_rates_manager, managed_projects_invoice_drafter, managed_projects_invoice_manager, client_and_task_manager, time_and_expenses_manager, estimates_manager. * - * @var string[]|null + * @var list|null */ protected $accessRoles; /** @@ -356,7 +356,7 @@ public function setCostRate(?float $costRate): self /** * Descriptive names of the business roles assigned to this person. They can be used for filtering reports, and have no effect in their permissions in Harvest. * - * @return string[]|null + * @return list|null */ public function getRoles(): ?array { @@ -366,7 +366,7 @@ public function getRoles(): ?array /** * Descriptive names of the business roles assigned to this person. They can be used for filtering reports, and have no effect in their permissions in Harvest. * - * @param string[]|null $roles + * @param list|null $roles */ public function setRoles(?array $roles): self { @@ -379,7 +379,7 @@ public function setRoles(?array $roles): self /** * Access role(s) that determine the user’s permissions in Harvest. Possible values: administrator, manager or member. Users with the manager role can additionally be granted one or more of these roles: project_creator, billable_rates_manager, managed_projects_invoice_drafter, managed_projects_invoice_manager, client_and_task_manager, time_and_expenses_manager, estimates_manager. * - * @return string[]|null + * @return list|null */ public function getAccessRoles(): ?array { @@ -389,7 +389,7 @@ public function getAccessRoles(): ?array /** * Access role(s) that determine the user’s permissions in Harvest. Possible values: administrator, manager or member. Users with the manager role can additionally be granted one or more of these roles: project_creator, billable_rates_manager, managed_projects_invoice_drafter, managed_projects_invoice_manager, client_and_task_manager, time_and_expenses_manager, estimates_manager. * - * @param string[]|null $accessRoles + * @param list|null $accessRoles */ public function setAccessRoles(?array $accessRoles): self { diff --git a/generated/Model/UserAssignments.php b/generated/Model/UserAssignments.php index 2ce7f60..f3782da 100644 --- a/generated/Model/UserAssignments.php +++ b/generated/Model/UserAssignments.php @@ -18,7 +18,7 @@ class UserAssignments extends \ArrayObject */ protected $initialized = []; /** - * @var UserAssignment[] + * @var list */ protected $userAssignments; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return UserAssignment[] + * @return list */ public function getUserAssignments(): array { @@ -64,7 +64,7 @@ public function getUserAssignments(): array } /** - * @param UserAssignment[] $userAssignments + * @param list $userAssignments */ public function setUserAssignments(array $userAssignments): self { diff --git a/generated/Model/Users.php b/generated/Model/Users.php index 1cd325b..756b59e 100644 --- a/generated/Model/Users.php +++ b/generated/Model/Users.php @@ -18,7 +18,7 @@ class Users extends \ArrayObject */ protected $initialized = []; /** - * @var User[] + * @var list */ protected $users; /** @@ -56,7 +56,7 @@ public function isInitialized($property): bool } /** - * @return User[] + * @return list */ public function getUsers(): array { @@ -64,7 +64,7 @@ public function getUsers(): array } /** - * @param User[] $users + * @param list $users */ public function setUsers(array $users): self { diff --git a/generated/Model/UsersPostBody.php b/generated/Model/UsersPostBody.php index bdaf9d4..842f227 100644 --- a/generated/Model/UsersPostBody.php +++ b/generated/Model/UsersPostBody.php @@ -80,13 +80,13 @@ class UsersPostBody extends \ArrayObject /** * Descriptive names of the business roles assigned to this person. They can be used for filtering reports, and have no effect in their permissions in Harvest. * - * @var string[]|null + * @var list|null */ protected $roles; /** * Access role(s) that determine the user’s permissions in Harvest. Possible values: administrator, manager or member. Users with the manager role can additionally be granted one or more of these roles: project_creator, billable_rates_manager, managed_projects_invoice_drafter, managed_projects_invoice_manager, client_and_task_manager, time_and_expenses_manager, estimates_manager. * - * @var string[]|null + * @var list|null */ protected $accessRoles; @@ -288,7 +288,7 @@ public function setCostRate(?float $costRate): self /** * Descriptive names of the business roles assigned to this person. They can be used for filtering reports, and have no effect in their permissions in Harvest. * - * @return string[]|null + * @return list|null */ public function getRoles(): ?array { @@ -298,7 +298,7 @@ public function getRoles(): ?array /** * Descriptive names of the business roles assigned to this person. They can be used for filtering reports, and have no effect in their permissions in Harvest. * - * @param string[]|null $roles + * @param list|null $roles */ public function setRoles(?array $roles): self { @@ -311,7 +311,7 @@ public function setRoles(?array $roles): self /** * Access role(s) that determine the user’s permissions in Harvest. Possible values: administrator, manager or member. Users with the manager role can additionally be granted one or more of these roles: project_creator, billable_rates_manager, managed_projects_invoice_drafter, managed_projects_invoice_manager, client_and_task_manager, time_and_expenses_manager, estimates_manager. * - * @return string[]|null + * @return list|null */ public function getAccessRoles(): ?array { @@ -321,7 +321,7 @@ public function getAccessRoles(): ?array /** * Access role(s) that determine the user’s permissions in Harvest. Possible values: administrator, manager or member. Users with the manager role can additionally be granted one or more of these roles: project_creator, billable_rates_manager, managed_projects_invoice_drafter, managed_projects_invoice_manager, client_and_task_manager, time_and_expenses_manager, estimates_manager. * - * @param string[]|null $accessRoles + * @param list|null $accessRoles */ public function setAccessRoles(?array $accessRoles): self { diff --git a/generated/Model/UsersUserIdPatchBody.php b/generated/Model/UsersUserIdPatchBody.php index 25ded76..fcbb70c 100644 --- a/generated/Model/UsersUserIdPatchBody.php +++ b/generated/Model/UsersUserIdPatchBody.php @@ -80,13 +80,13 @@ class UsersUserIdPatchBody extends \ArrayObject /** * Descriptive names of the business roles assigned to this person. They can be used for filtering reports, and have no effect in their permissions in Harvest. * - * @var string[]|null + * @var list|null */ protected $roles; /** * Access role(s) that determine the user’s permissions in Harvest. Possible values: administrator, manager or member. Users with the manager role can additionally be granted one or more of these roles: project_creator, billable_rates_manager, managed_projects_invoice_drafter, managed_projects_invoice_manager, client_and_task_manager, time_and_expenses_manager, estimates_manager. * - * @var string[]|null + * @var list|null */ protected $accessRoles; @@ -288,7 +288,7 @@ public function setCostRate(?float $costRate): self /** * Descriptive names of the business roles assigned to this person. They can be used for filtering reports, and have no effect in their permissions in Harvest. * - * @return string[]|null + * @return list|null */ public function getRoles(): ?array { @@ -298,7 +298,7 @@ public function getRoles(): ?array /** * Descriptive names of the business roles assigned to this person. They can be used for filtering reports, and have no effect in their permissions in Harvest. * - * @param string[]|null $roles + * @param list|null $roles */ public function setRoles(?array $roles): self { @@ -311,7 +311,7 @@ public function setRoles(?array $roles): self /** * Access role(s) that determine the user’s permissions in Harvest. Possible values: administrator, manager or member. Users with the manager role can additionally be granted one or more of these roles: project_creator, billable_rates_manager, managed_projects_invoice_drafter, managed_projects_invoice_manager, client_and_task_manager, time_and_expenses_manager, estimates_manager. * - * @return string[]|null + * @return list|null */ public function getAccessRoles(): ?array { @@ -321,7 +321,7 @@ public function getAccessRoles(): ?array /** * Access role(s) that determine the user’s permissions in Harvest. Possible values: administrator, manager or member. Users with the manager role can additionally be granted one or more of these roles: project_creator, billable_rates_manager, managed_projects_invoice_drafter, managed_projects_invoice_manager, client_and_task_manager, time_and_expenses_manager, estimates_manager. * - * @param string[]|null $accessRoles + * @param list|null $accessRoles */ public function setAccessRoles(?array $accessRoles): self { diff --git a/generated/Model/UsersUserIdTeammatesPatchBody.php b/generated/Model/UsersUserIdTeammatesPatchBody.php index 745de85..7251b75 100644 --- a/generated/Model/UsersUserIdTeammatesPatchBody.php +++ b/generated/Model/UsersUserIdTeammatesPatchBody.php @@ -20,7 +20,7 @@ class UsersUserIdTeammatesPatchBody extends \ArrayObject /** * Full list of user IDs to be assigned to the Manager. * - * @var string[]|null + * @var list|null */ protected $teammateIds; @@ -32,7 +32,7 @@ public function isInitialized($property): bool /** * Full list of user IDs to be assigned to the Manager. * - * @return string[]|null + * @return list|null */ public function getTeammateIds(): ?array { @@ -42,7 +42,7 @@ public function getTeammateIds(): ?array /** * Full list of user IDs to be assigned to the Manager. * - * @param string[]|null $teammateIds + * @param list|null $teammateIds */ public function setTeammateIds(?array $teammateIds): self { diff --git a/generated/Normalizer/BillableRateNormalizer.php b/generated/Normalizer/BillableRateNormalizer.php index 5366381..b0e6df3 100644 --- a/generated/Normalizer/BillableRateNormalizer.php +++ b/generated/Normalizer/BillableRateNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,128 +22,238 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class BillableRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class BillableRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\BillableRate' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\BillableRate' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\BillableRate' === $type; } - $object = new \JoliCode\Harvest\Api\Model\BillableRate(); - if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { - $data['amount'] = (float) $data['amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\BillableRate' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\BillableRate(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { + $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); + unset($data['start_date']); + } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { + $object->setStartDate(null); + } + if (\array_key_exists('end_date', $data) && null !== $data['end_date']) { + $object->setEndDate(\DateTime::createFromFormat('Y-m-d', $data['end_date'])->setTime(0, 0, 0)); + unset($data['end_date']); + } elseif (\array_key_exists('end_date', $data) && null === $data['end_date']) { + $object->setEndDate(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('amount', $data) && null !== $data['amount']) { - $object->setAmount($data['amount']); - unset($data['amount']); - } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { - $object->setAmount(null); - } - if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { - $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); - unset($data['start_date']); - } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { - $object->setStartDate(null); - } - if (\array_key_exists('end_date', $data) && null !== $data['end_date']) { - $object->setEndDate(\DateTime::createFromFormat('Y-m-d', $data['end_date'])->setTime(0, 0, 0)); - unset($data['end_date']); - } elseif (\array_key_exists('end_date', $data) && null === $data['end_date']) { - $object->setEndDate(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { + $data['start_date'] = $object->getStartDate()->format('Y-m-d'); + } + if ($object->isInitialized('endDate') && null !== $object->getEndDate()) { + $data['end_date'] = $object->getEndDate()->format('Y-m-d'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\BillableRate' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class BillableRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['amount'] = $object->getAmount(); - } - if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { - $data['start_date'] = $object->getStartDate()->format('Y-m-d'); - } - if ($object->isInitialized('endDate') && null !== $object->getEndDate()) { - $data['end_date'] = $object->getEndDate()->format('Y-m-d'); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\BillableRate' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\BillableRate' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\BillableRate(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { + $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); + unset($data['start_date']); + } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { + $object->setStartDate(null); + } + if (\array_key_exists('end_date', $data) && null !== $data['end_date']) { + $object->setEndDate(\DateTime::createFromFormat('Y-m-d', $data['end_date'])->setTime(0, 0, 0)); + unset($data['end_date']); + } elseif (\array_key_exists('end_date', $data) && null === $data['end_date']) { + $object->setEndDate(null); } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { + $data['start_date'] = $object->getStartDate()->format('Y-m-d'); + } + if ($object->isInitialized('endDate') && null !== $object->getEndDate()) { + $data['end_date'] = $object->getEndDate()->format('Y-m-d'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\BillableRate' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\BillableRate' => false]; + } } } diff --git a/generated/Normalizer/BillableRatesNormalizer.php b/generated/Normalizer/BillableRatesNormalizer.php index 87af632..1acc58d 100644 --- a/generated/Normalizer/BillableRatesNormalizer.php +++ b/generated/Normalizer/BillableRatesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class BillableRatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\BillableRates' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class BillableRatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\BillableRates' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\BillableRates' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\BillableRates' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\BillableRates(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\BillableRates(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('billable_rates', $data)) { + $values = []; + foreach ($data['billable_rates'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\BillableRate', 'json', $context); + } + $object->setBillableRates($values); + unset($data['billable_rates']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('billable_rates', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['billable_rates'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\BillableRate', 'json', $context); + foreach ($object->getBillableRates() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setBillableRates($values); - unset($data['billable_rates']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['billable_rates'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\BillableRates' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class BillableRatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getBillableRates() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\BillableRates' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\BillableRates' === $data::class; } - $data['billable_rates'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\BillableRates(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('billable_rates', $data)) { + $values = []; + foreach ($data['billable_rates'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\BillableRate', 'json', $context); + } + $object->setBillableRates($values); + unset($data['billable_rates']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getBillableRates() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['billable_rates'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\BillableRates' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\BillableRates' => false]; + } } } diff --git a/generated/Normalizer/ClientNormalizer.php b/generated/Normalizer/ClientNormalizer.php index d1b6e56..c5ad0b0 100644 --- a/generated/Normalizer/ClientNormalizer.php +++ b/generated/Normalizer/ClientNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,143 +22,268 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\Client' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Client' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Client' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Client' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Client(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Client(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('address', $data) && null !== $data['address']) { + $object->setAddress($data['address']); + unset($data['address']); + } elseif (\array_key_exists('address', $data) && null === $data['address']) { + $object->setAddress(null); + } + if (\array_key_exists('statement_key', $data) && null !== $data['statement_key']) { + $object->setStatementKey($data['statement_key']); + unset($data['statement_key']); + } elseif (\array_key_exists('statement_key', $data) && null === $data['statement_key']) { + $object->setStatementKey(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('address', $data) && null !== $data['address']) { - $object->setAddress($data['address']); - unset($data['address']); - } elseif (\array_key_exists('address', $data) && null === $data['address']) { - $object->setAddress(null); - } - if (\array_key_exists('statement_key', $data) && null !== $data['statement_key']) { - $object->setStatementKey($data['statement_key']); - unset($data['statement_key']); - } elseif (\array_key_exists('statement_key', $data) && null === $data['statement_key']) { - $object->setStatementKey(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('address') && null !== $object->getAddress()) { + $data['address'] = $object->getAddress(); + } + if ($object->isInitialized('statementKey') && null !== $object->getStatementKey()) { + $data['statement_key'] = $object->getStatementKey(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Client' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['address'] = $object->getAddress(); - } - if ($object->isInitialized('statementKey') && null !== $object->getStatementKey()) { - $data['statement_key'] = $object->getStatementKey(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Client' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Client' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Client(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('address', $data) && null !== $data['address']) { + $object->setAddress($data['address']); + unset($data['address']); + } elseif (\array_key_exists('address', $data) && null === $data['address']) { + $object->setAddress(null); + } + if (\array_key_exists('statement_key', $data) && null !== $data['statement_key']) { + $object->setStatementKey($data['statement_key']); + unset($data['statement_key']); + } elseif (\array_key_exists('statement_key', $data) && null === $data['statement_key']) { + $object->setStatementKey(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('address') && null !== $object->getAddress()) { + $data['address'] = $object->getAddress(); + } + if ($object->isInitialized('statementKey') && null !== $object->getStatementKey()) { + $data['statement_key'] = $object->getStatementKey(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Client' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Client' => false]; + } } } diff --git a/generated/Normalizer/ClientsClientIdPatchBodyNormalizer.php b/generated/Normalizer/ClientsClientIdPatchBodyNormalizer.php index 9bb21e1..8b6cc59 100644 --- a/generated/Normalizer/ClientsClientIdPatchBodyNormalizer.php +++ b/generated/Normalizer/ClientsClientIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,107 +22,196 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ClientsClientIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ClientsClientIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ClientsClientIdPatchBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ClientsClientIdPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('address', $data) && null !== $data['address']) { + $object->setAddress($data['address']); + unset($data['address']); + } elseif (\array_key_exists('address', $data) && null === $data['address']) { + $object->setAddress(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('address', $data) && null !== $data['address']) { - $object->setAddress($data['address']); - unset($data['address']); - } elseif (\array_key_exists('address', $data) && null === $data['address']) { - $object->setAddress(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('address') && null !== $object->getAddress()) { + $data['address'] = $object->getAddress(); } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ClientsClientIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['address'] = $object->getAddress(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' === $type; } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ClientsClientIdPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('address', $data) && null !== $data['address']) { + $object->setAddress($data['address']); + unset($data['address']); + } elseif (\array_key_exists('address', $data) && null === $data['address']) { + $object->setAddress(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('address') && null !== $object->getAddress()) { + $data['address'] = $object->getAddress(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/ClientsNormalizer.php b/generated/Normalizer/ClientsNormalizer.php index 3c79b60..3c3dd40 100644 --- a/generated/Normalizer/ClientsNormalizer.php +++ b/generated/Normalizer/ClientsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ClientsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Clients' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ClientsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Clients' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Clients' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Clients' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Clients(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Clients(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('clients', $data)) { + $values = []; + foreach ($data['clients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Client', 'json', $context); + } + $object->setClients($values); + unset($data['clients']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('clients', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['clients'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Client', 'json', $context); + foreach ($object->getClients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setClients($values); - unset($data['clients']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['clients'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Clients' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ClientsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getClients() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Clients' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Clients' === $data::class; } - $data['clients'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Clients(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('clients', $data)) { + $values = []; + foreach ($data['clients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Client', 'json', $context); + } + $object->setClients($values); + unset($data['clients']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getClients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['clients'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Clients' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Clients' => false]; + } } } diff --git a/generated/Normalizer/ClientsPostBodyNormalizer.php b/generated/Normalizer/ClientsPostBodyNormalizer.php index 62f8316..a181b5f 100644 --- a/generated/Normalizer/ClientsPostBodyNormalizer.php +++ b/generated/Normalizer/ClientsPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,105 +22,192 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ClientsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ClientsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ClientsPostBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ClientsPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('address', $data) && null !== $data['address']) { + $object->setAddress($data['address']); + unset($data['address']); + } elseif (\array_key_exists('address', $data) && null === $data['address']) { + $object->setAddress(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('address', $data) && null !== $data['address']) { - $object->setAddress($data['address']); - unset($data['address']); - } elseif (\array_key_exists('address', $data) && null === $data['address']) { - $object->setAddress(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['name'] = $object->getName(); + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('address') && null !== $object->getAddress()) { + $data['address'] = $object->getAddress(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ClientsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['name'] = $object->getName(); - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('address') && null !== $object->getAddress()) { - $data['address'] = $object->getAddress(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' === $type; } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ClientsPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('address', $data) && null !== $data['address']) { + $object->setAddress($data['address']); + unset($data['address']); + } elseif (\array_key_exists('address', $data) && null === $data['address']) { + $object->setAddress(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('address') && null !== $object->getAddress()) { + $data['address'] = $object->getAddress(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' => false]; + } } } diff --git a/generated/Normalizer/CompaniesNormalizer.php b/generated/Normalizer/CompaniesNormalizer.php index c90772e..c4878d8 100644 --- a/generated/Normalizer/CompaniesNormalizer.php +++ b/generated/Normalizer/CompaniesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CompaniesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Companies' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class CompaniesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Companies' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Companies' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Companies' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Companies(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Companies(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('companies', $data)) { + $values = []; + foreach ($data['companies'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Company', 'json', $context); + } + $object->setCompanies($values); + unset($data['companies']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('companies', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['companies'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Company', 'json', $context); + foreach ($object->getCompanies() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setCompanies($values); - unset($data['companies']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['companies'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Companies' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class CompaniesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getCompanies() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Companies' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Companies' === $data::class; } - $data['companies'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Companies(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('companies', $data)) { + $values = []; + foreach ($data['companies'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Company', 'json', $context); + } + $object->setCompanies($values); + unset($data['companies']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getCompanies() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['companies'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Companies' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Companies' => false]; + } } } diff --git a/generated/Normalizer/CompanyNormalizer.php b/generated/Normalizer/CompanyNormalizer.php index e137030..af0d8d7 100644 --- a/generated/Normalizer/CompanyNormalizer.php +++ b/generated/Normalizer/CompanyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,251 +22,484 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CompanyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class CompanyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\Company' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Company' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Company' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Company' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Company(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Company(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('base_uri', $data) && null !== $data['base_uri']) { + $object->setBaseUri($data['base_uri']); + unset($data['base_uri']); + } elseif (\array_key_exists('base_uri', $data) && null === $data['base_uri']) { + $object->setBaseUri(null); + } + if (\array_key_exists('full_domain', $data) && null !== $data['full_domain']) { + $object->setFullDomain($data['full_domain']); + unset($data['full_domain']); + } elseif (\array_key_exists('full_domain', $data) && null === $data['full_domain']) { + $object->setFullDomain(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('week_start_day', $data) && null !== $data['week_start_day']) { + $object->setWeekStartDay($data['week_start_day']); + unset($data['week_start_day']); + } elseif (\array_key_exists('week_start_day', $data) && null === $data['week_start_day']) { + $object->setWeekStartDay(null); + } + if (\array_key_exists('wants_timestamp_timers', $data) && null !== $data['wants_timestamp_timers']) { + $object->setWantsTimestampTimers($data['wants_timestamp_timers']); + unset($data['wants_timestamp_timers']); + } elseif (\array_key_exists('wants_timestamp_timers', $data) && null === $data['wants_timestamp_timers']) { + $object->setWantsTimestampTimers(null); + } + if (\array_key_exists('time_format', $data) && null !== $data['time_format']) { + $object->setTimeFormat($data['time_format']); + unset($data['time_format']); + } elseif (\array_key_exists('time_format', $data) && null === $data['time_format']) { + $object->setTimeFormat(null); + } + if (\array_key_exists('date_format', $data) && null !== $data['date_format']) { + $object->setDateFormat($data['date_format']); + unset($data['date_format']); + } elseif (\array_key_exists('date_format', $data) && null === $data['date_format']) { + $object->setDateFormat(null); + } + if (\array_key_exists('plan_type', $data) && null !== $data['plan_type']) { + $object->setPlanType($data['plan_type']); + unset($data['plan_type']); + } elseif (\array_key_exists('plan_type', $data) && null === $data['plan_type']) { + $object->setPlanType(null); + } + if (\array_key_exists('clock', $data) && null !== $data['clock']) { + $object->setClock($data['clock']); + unset($data['clock']); + } elseif (\array_key_exists('clock', $data) && null === $data['clock']) { + $object->setClock(null); + } + if (\array_key_exists('currency_code_display', $data) && null !== $data['currency_code_display']) { + $object->setCurrencyCodeDisplay($data['currency_code_display']); + unset($data['currency_code_display']); + } elseif (\array_key_exists('currency_code_display', $data) && null === $data['currency_code_display']) { + $object->setCurrencyCodeDisplay(null); + } + if (\array_key_exists('currency_symbol_display', $data) && null !== $data['currency_symbol_display']) { + $object->setCurrencySymbolDisplay($data['currency_symbol_display']); + unset($data['currency_symbol_display']); + } elseif (\array_key_exists('currency_symbol_display', $data) && null === $data['currency_symbol_display']) { + $object->setCurrencySymbolDisplay(null); + } + if (\array_key_exists('decimal_symbol', $data) && null !== $data['decimal_symbol']) { + $object->setDecimalSymbol($data['decimal_symbol']); + unset($data['decimal_symbol']); + } elseif (\array_key_exists('decimal_symbol', $data) && null === $data['decimal_symbol']) { + $object->setDecimalSymbol(null); + } + if (\array_key_exists('thousands_separator', $data) && null !== $data['thousands_separator']) { + $object->setThousandsSeparator($data['thousands_separator']); + unset($data['thousands_separator']); + } elseif (\array_key_exists('thousands_separator', $data) && null === $data['thousands_separator']) { + $object->setThousandsSeparator(null); + } + if (\array_key_exists('color_scheme', $data) && null !== $data['color_scheme']) { + $object->setColorScheme($data['color_scheme']); + unset($data['color_scheme']); + } elseif (\array_key_exists('color_scheme', $data) && null === $data['color_scheme']) { + $object->setColorScheme(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + if (\array_key_exists('expense_feature', $data) && null !== $data['expense_feature']) { + $object->setExpenseFeature($data['expense_feature']); + unset($data['expense_feature']); + } elseif (\array_key_exists('expense_feature', $data) && null === $data['expense_feature']) { + $object->setExpenseFeature(null); + } + if (\array_key_exists('invoice_feature', $data) && null !== $data['invoice_feature']) { + $object->setInvoiceFeature($data['invoice_feature']); + unset($data['invoice_feature']); + } elseif (\array_key_exists('invoice_feature', $data) && null === $data['invoice_feature']) { + $object->setInvoiceFeature(null); + } + if (\array_key_exists('estimate_feature', $data) && null !== $data['estimate_feature']) { + $object->setEstimateFeature($data['estimate_feature']); + unset($data['estimate_feature']); + } elseif (\array_key_exists('estimate_feature', $data) && null === $data['estimate_feature']) { + $object->setEstimateFeature(null); + } + if (\array_key_exists('approval_feature', $data) && null !== $data['approval_feature']) { + $object->setApprovalFeature($data['approval_feature']); + unset($data['approval_feature']); + } elseif (\array_key_exists('approval_feature', $data) && null === $data['approval_feature']) { + $object->setApprovalFeature(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('base_uri', $data) && null !== $data['base_uri']) { - $object->setBaseUri($data['base_uri']); - unset($data['base_uri']); - } elseif (\array_key_exists('base_uri', $data) && null === $data['base_uri']) { - $object->setBaseUri(null); - } - if (\array_key_exists('full_domain', $data) && null !== $data['full_domain']) { - $object->setFullDomain($data['full_domain']); - unset($data['full_domain']); - } elseif (\array_key_exists('full_domain', $data) && null === $data['full_domain']) { - $object->setFullDomain(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('week_start_day', $data) && null !== $data['week_start_day']) { - $object->setWeekStartDay($data['week_start_day']); - unset($data['week_start_day']); - } elseif (\array_key_exists('week_start_day', $data) && null === $data['week_start_day']) { - $object->setWeekStartDay(null); - } - if (\array_key_exists('wants_timestamp_timers', $data) && null !== $data['wants_timestamp_timers']) { - $object->setWantsTimestampTimers($data['wants_timestamp_timers']); - unset($data['wants_timestamp_timers']); - } elseif (\array_key_exists('wants_timestamp_timers', $data) && null === $data['wants_timestamp_timers']) { - $object->setWantsTimestampTimers(null); - } - if (\array_key_exists('time_format', $data) && null !== $data['time_format']) { - $object->setTimeFormat($data['time_format']); - unset($data['time_format']); - } elseif (\array_key_exists('time_format', $data) && null === $data['time_format']) { - $object->setTimeFormat(null); - } - if (\array_key_exists('date_format', $data) && null !== $data['date_format']) { - $object->setDateFormat($data['date_format']); - unset($data['date_format']); - } elseif (\array_key_exists('date_format', $data) && null === $data['date_format']) { - $object->setDateFormat(null); - } - if (\array_key_exists('plan_type', $data) && null !== $data['plan_type']) { - $object->setPlanType($data['plan_type']); - unset($data['plan_type']); - } elseif (\array_key_exists('plan_type', $data) && null === $data['plan_type']) { - $object->setPlanType(null); - } - if (\array_key_exists('clock', $data) && null !== $data['clock']) { - $object->setClock($data['clock']); - unset($data['clock']); - } elseif (\array_key_exists('clock', $data) && null === $data['clock']) { - $object->setClock(null); - } - if (\array_key_exists('currency_code_display', $data) && null !== $data['currency_code_display']) { - $object->setCurrencyCodeDisplay($data['currency_code_display']); - unset($data['currency_code_display']); - } elseif (\array_key_exists('currency_code_display', $data) && null === $data['currency_code_display']) { - $object->setCurrencyCodeDisplay(null); - } - if (\array_key_exists('currency_symbol_display', $data) && null !== $data['currency_symbol_display']) { - $object->setCurrencySymbolDisplay($data['currency_symbol_display']); - unset($data['currency_symbol_display']); - } elseif (\array_key_exists('currency_symbol_display', $data) && null === $data['currency_symbol_display']) { - $object->setCurrencySymbolDisplay(null); - } - if (\array_key_exists('decimal_symbol', $data) && null !== $data['decimal_symbol']) { - $object->setDecimalSymbol($data['decimal_symbol']); - unset($data['decimal_symbol']); - } elseif (\array_key_exists('decimal_symbol', $data) && null === $data['decimal_symbol']) { - $object->setDecimalSymbol(null); - } - if (\array_key_exists('thousands_separator', $data) && null !== $data['thousands_separator']) { - $object->setThousandsSeparator($data['thousands_separator']); - unset($data['thousands_separator']); - } elseif (\array_key_exists('thousands_separator', $data) && null === $data['thousands_separator']) { - $object->setThousandsSeparator(null); - } - if (\array_key_exists('color_scheme', $data) && null !== $data['color_scheme']) { - $object->setColorScheme($data['color_scheme']); - unset($data['color_scheme']); - } elseif (\array_key_exists('color_scheme', $data) && null === $data['color_scheme']) { - $object->setColorScheme(null); - } - if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { - $object->setWeeklyCapacity($data['weekly_capacity']); - unset($data['weekly_capacity']); - } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { - $object->setWeeklyCapacity(null); - } - if (\array_key_exists('expense_feature', $data) && null !== $data['expense_feature']) { - $object->setExpenseFeature($data['expense_feature']); - unset($data['expense_feature']); - } elseif (\array_key_exists('expense_feature', $data) && null === $data['expense_feature']) { - $object->setExpenseFeature(null); - } - if (\array_key_exists('invoice_feature', $data) && null !== $data['invoice_feature']) { - $object->setInvoiceFeature($data['invoice_feature']); - unset($data['invoice_feature']); - } elseif (\array_key_exists('invoice_feature', $data) && null === $data['invoice_feature']) { - $object->setInvoiceFeature(null); - } - if (\array_key_exists('estimate_feature', $data) && null !== $data['estimate_feature']) { - $object->setEstimateFeature($data['estimate_feature']); - unset($data['estimate_feature']); - } elseif (\array_key_exists('estimate_feature', $data) && null === $data['estimate_feature']) { - $object->setEstimateFeature(null); - } - if (\array_key_exists('approval_feature', $data) && null !== $data['approval_feature']) { - $object->setApprovalFeature($data['approval_feature']); - unset($data['approval_feature']); - } elseif (\array_key_exists('approval_feature', $data) && null === $data['approval_feature']) { - $object->setApprovalFeature(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('baseUri') && null !== $object->getBaseUri()) { + $data['base_uri'] = $object->getBaseUri(); + } + if ($object->isInitialized('fullDomain') && null !== $object->getFullDomain()) { + $data['full_domain'] = $object->getFullDomain(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); } + if ($object->isInitialized('weekStartDay') && null !== $object->getWeekStartDay()) { + $data['week_start_day'] = $object->getWeekStartDay(); + } + if ($object->isInitialized('wantsTimestampTimers') && null !== $object->getWantsTimestampTimers()) { + $data['wants_timestamp_timers'] = $object->getWantsTimestampTimers(); + } + if ($object->isInitialized('timeFormat') && null !== $object->getTimeFormat()) { + $data['time_format'] = $object->getTimeFormat(); + } + if ($object->isInitialized('dateFormat') && null !== $object->getDateFormat()) { + $data['date_format'] = $object->getDateFormat(); + } + if ($object->isInitialized('planType') && null !== $object->getPlanType()) { + $data['plan_type'] = $object->getPlanType(); + } + if ($object->isInitialized('clock') && null !== $object->getClock()) { + $data['clock'] = $object->getClock(); + } + if ($object->isInitialized('currencyCodeDisplay') && null !== $object->getCurrencyCodeDisplay()) { + $data['currency_code_display'] = $object->getCurrencyCodeDisplay(); + } + if ($object->isInitialized('currencySymbolDisplay') && null !== $object->getCurrencySymbolDisplay()) { + $data['currency_symbol_display'] = $object->getCurrencySymbolDisplay(); + } + if ($object->isInitialized('decimalSymbol') && null !== $object->getDecimalSymbol()) { + $data['decimal_symbol'] = $object->getDecimalSymbol(); + } + if ($object->isInitialized('thousandsSeparator') && null !== $object->getThousandsSeparator()) { + $data['thousands_separator'] = $object->getThousandsSeparator(); + } + if ($object->isInitialized('colorScheme') && null !== $object->getColorScheme()) { + $data['color_scheme'] = $object->getColorScheme(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + if ($object->isInitialized('expenseFeature') && null !== $object->getExpenseFeature()) { + $data['expense_feature'] = $object->getExpenseFeature(); + } + if ($object->isInitialized('invoiceFeature') && null !== $object->getInvoiceFeature()) { + $data['invoice_feature'] = $object->getInvoiceFeature(); + } + if ($object->isInitialized('estimateFeature') && null !== $object->getEstimateFeature()) { + $data['estimate_feature'] = $object->getEstimateFeature(); + } + if ($object->isInitialized('approvalFeature') && null !== $object->getApprovalFeature()) { + $data['approval_feature'] = $object->getApprovalFeature(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Company' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class CompanyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('baseUri') && null !== $object->getBaseUri()) { - $data['base_uri'] = $object->getBaseUri(); - } - if ($object->isInitialized('fullDomain') && null !== $object->getFullDomain()) { - $data['full_domain'] = $object->getFullDomain(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('weekStartDay') && null !== $object->getWeekStartDay()) { - $data['week_start_day'] = $object->getWeekStartDay(); - } - if ($object->isInitialized('wantsTimestampTimers') && null !== $object->getWantsTimestampTimers()) { - $data['wants_timestamp_timers'] = $object->getWantsTimestampTimers(); - } - if ($object->isInitialized('timeFormat') && null !== $object->getTimeFormat()) { - $data['time_format'] = $object->getTimeFormat(); - } - if ($object->isInitialized('dateFormat') && null !== $object->getDateFormat()) { - $data['date_format'] = $object->getDateFormat(); - } - if ($object->isInitialized('planType') && null !== $object->getPlanType()) { - $data['plan_type'] = $object->getPlanType(); - } - if ($object->isInitialized('clock') && null !== $object->getClock()) { - $data['clock'] = $object->getClock(); - } - if ($object->isInitialized('currencyCodeDisplay') && null !== $object->getCurrencyCodeDisplay()) { - $data['currency_code_display'] = $object->getCurrencyCodeDisplay(); - } - if ($object->isInitialized('currencySymbolDisplay') && null !== $object->getCurrencySymbolDisplay()) { - $data['currency_symbol_display'] = $object->getCurrencySymbolDisplay(); - } - if ($object->isInitialized('decimalSymbol') && null !== $object->getDecimalSymbol()) { - $data['decimal_symbol'] = $object->getDecimalSymbol(); - } - if ($object->isInitialized('thousandsSeparator') && null !== $object->getThousandsSeparator()) { - $data['thousands_separator'] = $object->getThousandsSeparator(); - } - if ($object->isInitialized('colorScheme') && null !== $object->getColorScheme()) { - $data['color_scheme'] = $object->getColorScheme(); - } - if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { - $data['weekly_capacity'] = $object->getWeeklyCapacity(); - } - if ($object->isInitialized('expenseFeature') && null !== $object->getExpenseFeature()) { - $data['expense_feature'] = $object->getExpenseFeature(); - } - if ($object->isInitialized('invoiceFeature') && null !== $object->getInvoiceFeature()) { - $data['invoice_feature'] = $object->getInvoiceFeature(); - } - if ($object->isInitialized('estimateFeature') && null !== $object->getEstimateFeature()) { - $data['estimate_feature'] = $object->getEstimateFeature(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Company' === $type; } - if ($object->isInitialized('approvalFeature') && null !== $object->getApprovalFeature()) { - $data['approval_feature'] = $object->getApprovalFeature(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Company' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Company(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('base_uri', $data) && null !== $data['base_uri']) { + $object->setBaseUri($data['base_uri']); + unset($data['base_uri']); + } elseif (\array_key_exists('base_uri', $data) && null === $data['base_uri']) { + $object->setBaseUri(null); + } + if (\array_key_exists('full_domain', $data) && null !== $data['full_domain']) { + $object->setFullDomain($data['full_domain']); + unset($data['full_domain']); + } elseif (\array_key_exists('full_domain', $data) && null === $data['full_domain']) { + $object->setFullDomain(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('week_start_day', $data) && null !== $data['week_start_day']) { + $object->setWeekStartDay($data['week_start_day']); + unset($data['week_start_day']); + } elseif (\array_key_exists('week_start_day', $data) && null === $data['week_start_day']) { + $object->setWeekStartDay(null); + } + if (\array_key_exists('wants_timestamp_timers', $data) && null !== $data['wants_timestamp_timers']) { + $object->setWantsTimestampTimers($data['wants_timestamp_timers']); + unset($data['wants_timestamp_timers']); + } elseif (\array_key_exists('wants_timestamp_timers', $data) && null === $data['wants_timestamp_timers']) { + $object->setWantsTimestampTimers(null); + } + if (\array_key_exists('time_format', $data) && null !== $data['time_format']) { + $object->setTimeFormat($data['time_format']); + unset($data['time_format']); + } elseif (\array_key_exists('time_format', $data) && null === $data['time_format']) { + $object->setTimeFormat(null); + } + if (\array_key_exists('date_format', $data) && null !== $data['date_format']) { + $object->setDateFormat($data['date_format']); + unset($data['date_format']); + } elseif (\array_key_exists('date_format', $data) && null === $data['date_format']) { + $object->setDateFormat(null); + } + if (\array_key_exists('plan_type', $data) && null !== $data['plan_type']) { + $object->setPlanType($data['plan_type']); + unset($data['plan_type']); + } elseif (\array_key_exists('plan_type', $data) && null === $data['plan_type']) { + $object->setPlanType(null); + } + if (\array_key_exists('clock', $data) && null !== $data['clock']) { + $object->setClock($data['clock']); + unset($data['clock']); + } elseif (\array_key_exists('clock', $data) && null === $data['clock']) { + $object->setClock(null); + } + if (\array_key_exists('currency_code_display', $data) && null !== $data['currency_code_display']) { + $object->setCurrencyCodeDisplay($data['currency_code_display']); + unset($data['currency_code_display']); + } elseif (\array_key_exists('currency_code_display', $data) && null === $data['currency_code_display']) { + $object->setCurrencyCodeDisplay(null); + } + if (\array_key_exists('currency_symbol_display', $data) && null !== $data['currency_symbol_display']) { + $object->setCurrencySymbolDisplay($data['currency_symbol_display']); + unset($data['currency_symbol_display']); + } elseif (\array_key_exists('currency_symbol_display', $data) && null === $data['currency_symbol_display']) { + $object->setCurrencySymbolDisplay(null); } + if (\array_key_exists('decimal_symbol', $data) && null !== $data['decimal_symbol']) { + $object->setDecimalSymbol($data['decimal_symbol']); + unset($data['decimal_symbol']); + } elseif (\array_key_exists('decimal_symbol', $data) && null === $data['decimal_symbol']) { + $object->setDecimalSymbol(null); + } + if (\array_key_exists('thousands_separator', $data) && null !== $data['thousands_separator']) { + $object->setThousandsSeparator($data['thousands_separator']); + unset($data['thousands_separator']); + } elseif (\array_key_exists('thousands_separator', $data) && null === $data['thousands_separator']) { + $object->setThousandsSeparator(null); + } + if (\array_key_exists('color_scheme', $data) && null !== $data['color_scheme']) { + $object->setColorScheme($data['color_scheme']); + unset($data['color_scheme']); + } elseif (\array_key_exists('color_scheme', $data) && null === $data['color_scheme']) { + $object->setColorScheme(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + if (\array_key_exists('expense_feature', $data) && null !== $data['expense_feature']) { + $object->setExpenseFeature($data['expense_feature']); + unset($data['expense_feature']); + } elseif (\array_key_exists('expense_feature', $data) && null === $data['expense_feature']) { + $object->setExpenseFeature(null); + } + if (\array_key_exists('invoice_feature', $data) && null !== $data['invoice_feature']) { + $object->setInvoiceFeature($data['invoice_feature']); + unset($data['invoice_feature']); + } elseif (\array_key_exists('invoice_feature', $data) && null === $data['invoice_feature']) { + $object->setInvoiceFeature(null); + } + if (\array_key_exists('estimate_feature', $data) && null !== $data['estimate_feature']) { + $object->setEstimateFeature($data['estimate_feature']); + unset($data['estimate_feature']); + } elseif (\array_key_exists('estimate_feature', $data) && null === $data['estimate_feature']) { + $object->setEstimateFeature(null); + } + if (\array_key_exists('approval_feature', $data) && null !== $data['approval_feature']) { + $object->setApprovalFeature($data['approval_feature']); + unset($data['approval_feature']); + } elseif (\array_key_exists('approval_feature', $data) && null === $data['approval_feature']) { + $object->setApprovalFeature(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('baseUri') && null !== $object->getBaseUri()) { + $data['base_uri'] = $object->getBaseUri(); + } + if ($object->isInitialized('fullDomain') && null !== $object->getFullDomain()) { + $data['full_domain'] = $object->getFullDomain(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('weekStartDay') && null !== $object->getWeekStartDay()) { + $data['week_start_day'] = $object->getWeekStartDay(); + } + if ($object->isInitialized('wantsTimestampTimers') && null !== $object->getWantsTimestampTimers()) { + $data['wants_timestamp_timers'] = $object->getWantsTimestampTimers(); + } + if ($object->isInitialized('timeFormat') && null !== $object->getTimeFormat()) { + $data['time_format'] = $object->getTimeFormat(); + } + if ($object->isInitialized('dateFormat') && null !== $object->getDateFormat()) { + $data['date_format'] = $object->getDateFormat(); + } + if ($object->isInitialized('planType') && null !== $object->getPlanType()) { + $data['plan_type'] = $object->getPlanType(); + } + if ($object->isInitialized('clock') && null !== $object->getClock()) { + $data['clock'] = $object->getClock(); + } + if ($object->isInitialized('currencyCodeDisplay') && null !== $object->getCurrencyCodeDisplay()) { + $data['currency_code_display'] = $object->getCurrencyCodeDisplay(); + } + if ($object->isInitialized('currencySymbolDisplay') && null !== $object->getCurrencySymbolDisplay()) { + $data['currency_symbol_display'] = $object->getCurrencySymbolDisplay(); + } + if ($object->isInitialized('decimalSymbol') && null !== $object->getDecimalSymbol()) { + $data['decimal_symbol'] = $object->getDecimalSymbol(); + } + if ($object->isInitialized('thousandsSeparator') && null !== $object->getThousandsSeparator()) { + $data['thousands_separator'] = $object->getThousandsSeparator(); + } + if ($object->isInitialized('colorScheme') && null !== $object->getColorScheme()) { + $data['color_scheme'] = $object->getColorScheme(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + if ($object->isInitialized('expenseFeature') && null !== $object->getExpenseFeature()) { + $data['expense_feature'] = $object->getExpenseFeature(); + } + if ($object->isInitialized('invoiceFeature') && null !== $object->getInvoiceFeature()) { + $data['invoice_feature'] = $object->getInvoiceFeature(); + } + if ($object->isInitialized('estimateFeature') && null !== $object->getEstimateFeature()) { + $data['estimate_feature'] = $object->getEstimateFeature(); + } + if ($object->isInitialized('approvalFeature') && null !== $object->getApprovalFeature()) { + $data['approval_feature'] = $object->getApprovalFeature(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Company' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Company' => false]; + } } } diff --git a/generated/Normalizer/CompanyPatchBodyNormalizer.php b/generated/Normalizer/CompanyPatchBodyNormalizer.php index 2d04d5d..7c921e0 100644 --- a/generated/Normalizer/CompanyPatchBodyNormalizer.php +++ b/generated/Normalizer/CompanyPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CompanyPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class CompanyPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\CompanyPatchBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\CompanyPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('wants_timestamp_timers', $data) && null !== $data['wants_timestamp_timers']) { + $object->setWantsTimestampTimers($data['wants_timestamp_timers']); + unset($data['wants_timestamp_timers']); + } elseif (\array_key_exists('wants_timestamp_timers', $data) && null === $data['wants_timestamp_timers']) { + $object->setWantsTimestampTimers(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('wants_timestamp_timers', $data) && null !== $data['wants_timestamp_timers']) { - $object->setWantsTimestampTimers($data['wants_timestamp_timers']); - unset($data['wants_timestamp_timers']); - } elseif (\array_key_exists('wants_timestamp_timers', $data) && null === $data['wants_timestamp_timers']) { - $object->setWantsTimestampTimers(null); - } - if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { - $object->setWeeklyCapacity($data['weekly_capacity']); - unset($data['weekly_capacity']); - } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { - $object->setWeeklyCapacity(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('wantsTimestampTimers') && null !== $object->getWantsTimestampTimers()) { + $data['wants_timestamp_timers'] = $object->getWantsTimestampTimers(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class CompanyPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('wantsTimestampTimers') && null !== $object->getWantsTimestampTimers()) { - $data['wants_timestamp_timers'] = $object->getWantsTimestampTimers(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' === $type; } - if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { - $data['weekly_capacity'] = $object->getWeeklyCapacity(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\CompanyPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('wants_timestamp_timers', $data) && null !== $data['wants_timestamp_timers']) { + $object->setWantsTimestampTimers($data['wants_timestamp_timers']); + unset($data['wants_timestamp_timers']); + } elseif (\array_key_exists('wants_timestamp_timers', $data) && null === $data['wants_timestamp_timers']) { + $object->setWantsTimestampTimers(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('wantsTimestampTimers') && null !== $object->getWantsTimestampTimers()) { + $data['wants_timestamp_timers'] = $object->getWantsTimestampTimers(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' => false]; + } } } diff --git a/generated/Normalizer/ContactClientNormalizer.php b/generated/Normalizer/ContactClientNormalizer.php index 5b7d9ec..0adc416 100644 --- a/generated/Normalizer/ContactClientNormalizer.php +++ b/generated/Normalizer/ContactClientNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ContactClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ContactClient' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ContactClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ContactClient' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ContactClient' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ContactClient' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ContactClient(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ContactClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ContactClient' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ContactClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ContactClient' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ContactClient' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ContactClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ContactClient' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ContactClient' => false]; + } } } diff --git a/generated/Normalizer/ContactNormalizer.php b/generated/Normalizer/ContactNormalizer.php index 27e63f0..dd4ad96 100644 --- a/generated/Normalizer/ContactNormalizer.php +++ b/generated/Normalizer/ContactNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,170 +22,322 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ContactNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Contact' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ContactNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Contact' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Contact' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Contact' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Contact(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Contact(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ContactClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('title', $data) && null !== $data['title']) { + $object->setTitle($data['title']); + unset($data['title']); + } elseif (\array_key_exists('title', $data) && null === $data['title']) { + $object->setTitle(null); + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('phone_office', $data) && null !== $data['phone_office']) { + $object->setPhoneOffice($data['phone_office']); + unset($data['phone_office']); + } elseif (\array_key_exists('phone_office', $data) && null === $data['phone_office']) { + $object->setPhoneOffice(null); + } + if (\array_key_exists('phone_mobile', $data) && null !== $data['phone_mobile']) { + $object->setPhoneMobile($data['phone_mobile']); + unset($data['phone_mobile']); + } elseif (\array_key_exists('phone_mobile', $data) && null === $data['phone_mobile']) { + $object->setPhoneMobile(null); + } + if (\array_key_exists('fax', $data) && null !== $data['fax']) { + $object->setFax($data['fax']); + unset($data['fax']); + } elseif (\array_key_exists('fax', $data) && null === $data['fax']) { + $object->setFax(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('client', $data) && null !== $data['client']) { - $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ContactClient', 'json', $context)); - unset($data['client']); - } elseif (\array_key_exists('client', $data) && null === $data['client']) { - $object->setClient(null); - } - if (\array_key_exists('title', $data) && null !== $data['title']) { - $object->setTitle($data['title']); - unset($data['title']); - } elseif (\array_key_exists('title', $data) && null === $data['title']) { - $object->setTitle(null); - } - if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { - $object->setFirstName($data['first_name']); - unset($data['first_name']); - } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { - $object->setFirstName(null); - } - if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { - $object->setLastName($data['last_name']); - unset($data['last_name']); - } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { - $object->setLastName(null); - } - if (\array_key_exists('email', $data) && null !== $data['email']) { - $object->setEmail($data['email']); - unset($data['email']); - } elseif (\array_key_exists('email', $data) && null === $data['email']) { - $object->setEmail(null); - } - if (\array_key_exists('phone_office', $data) && null !== $data['phone_office']) { - $object->setPhoneOffice($data['phone_office']); - unset($data['phone_office']); - } elseif (\array_key_exists('phone_office', $data) && null === $data['phone_office']) { - $object->setPhoneOffice(null); - } - if (\array_key_exists('phone_mobile', $data) && null !== $data['phone_mobile']) { - $object->setPhoneMobile($data['phone_mobile']); - unset($data['phone_mobile']); - } elseif (\array_key_exists('phone_mobile', $data) && null === $data['phone_mobile']) { - $object->setPhoneMobile(null); - } - if (\array_key_exists('fax', $data) && null !== $data['fax']) { - $object->setFax($data['fax']); - unset($data['fax']); - } elseif (\array_key_exists('fax', $data) && null === $data['fax']) { - $object->setFax(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('title') && null !== $object->getTitle()) { + $data['title'] = $object->getTitle(); + } + if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { + $data['first_name'] = $object->getFirstName(); + } + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + if ($object->isInitialized('phoneOffice') && null !== $object->getPhoneOffice()) { + $data['phone_office'] = $object->getPhoneOffice(); + } + if ($object->isInitialized('phoneMobile') && null !== $object->getPhoneMobile()) { + $data['phone_mobile'] = $object->getPhoneMobile(); + } + if ($object->isInitialized('fax') && null !== $object->getFax()) { + $data['fax'] = $object->getFax(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Contact' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ContactNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('client') && null !== $object->getClient()) { - $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); - } - if ($object->isInitialized('title') && null !== $object->getTitle()) { - $data['title'] = $object->getTitle(); - } - if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { - $data['first_name'] = $object->getFirstName(); - } - if ($object->isInitialized('lastName') && null !== $object->getLastName()) { - $data['last_name'] = $object->getLastName(); - } - if ($object->isInitialized('email') && null !== $object->getEmail()) { - $data['email'] = $object->getEmail(); - } - if ($object->isInitialized('phoneOffice') && null !== $object->getPhoneOffice()) { - $data['phone_office'] = $object->getPhoneOffice(); - } - if ($object->isInitialized('phoneMobile') && null !== $object->getPhoneMobile()) { - $data['phone_mobile'] = $object->getPhoneMobile(); - } - if ($object->isInitialized('fax') && null !== $object->getFax()) { - $data['fax'] = $object->getFax(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Contact' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Contact' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Contact(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ContactClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('title', $data) && null !== $data['title']) { + $object->setTitle($data['title']); + unset($data['title']); + } elseif (\array_key_exists('title', $data) && null === $data['title']) { + $object->setTitle(null); + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('phone_office', $data) && null !== $data['phone_office']) { + $object->setPhoneOffice($data['phone_office']); + unset($data['phone_office']); + } elseif (\array_key_exists('phone_office', $data) && null === $data['phone_office']) { + $object->setPhoneOffice(null); + } + if (\array_key_exists('phone_mobile', $data) && null !== $data['phone_mobile']) { + $object->setPhoneMobile($data['phone_mobile']); + unset($data['phone_mobile']); + } elseif (\array_key_exists('phone_mobile', $data) && null === $data['phone_mobile']) { + $object->setPhoneMobile(null); } + if (\array_key_exists('fax', $data) && null !== $data['fax']) { + $object->setFax($data['fax']); + unset($data['fax']); + } elseif (\array_key_exists('fax', $data) && null === $data['fax']) { + $object->setFax(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('title') && null !== $object->getTitle()) { + $data['title'] = $object->getTitle(); + } + if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { + $data['first_name'] = $object->getFirstName(); + } + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + if ($object->isInitialized('phoneOffice') && null !== $object->getPhoneOffice()) { + $data['phone_office'] = $object->getPhoneOffice(); + } + if ($object->isInitialized('phoneMobile') && null !== $object->getPhoneMobile()) { + $data['phone_mobile'] = $object->getPhoneMobile(); + } + if ($object->isInitialized('fax') && null !== $object->getFax()) { + $data['fax'] = $object->getFax(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Contact' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Contact' => false]; + } } } diff --git a/generated/Normalizer/ContactsContactIdPatchBodyNormalizer.php b/generated/Normalizer/ContactsContactIdPatchBodyNormalizer.php index 7874759..b6ee002 100644 --- a/generated/Normalizer/ContactsContactIdPatchBodyNormalizer.php +++ b/generated/Normalizer/ContactsContactIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,143 +22,268 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ContactsContactIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ContactsContactIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ContactsContactIdPatchBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ContactsContactIdPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('title', $data) && null !== $data['title']) { + $object->setTitle($data['title']); + unset($data['title']); + } elseif (\array_key_exists('title', $data) && null === $data['title']) { + $object->setTitle(null); + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('phone_office', $data) && null !== $data['phone_office']) { + $object->setPhoneOffice($data['phone_office']); + unset($data['phone_office']); + } elseif (\array_key_exists('phone_office', $data) && null === $data['phone_office']) { + $object->setPhoneOffice(null); + } + if (\array_key_exists('phone_mobile', $data) && null !== $data['phone_mobile']) { + $object->setPhoneMobile($data['phone_mobile']); + unset($data['phone_mobile']); + } elseif (\array_key_exists('phone_mobile', $data) && null === $data['phone_mobile']) { + $object->setPhoneMobile(null); + } + if (\array_key_exists('fax', $data) && null !== $data['fax']) { + $object->setFax($data['fax']); + unset($data['fax']); + } elseif (\array_key_exists('fax', $data) && null === $data['fax']) { + $object->setFax(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('title', $data) && null !== $data['title']) { - $object->setTitle($data['title']); - unset($data['title']); - } elseif (\array_key_exists('title', $data) && null === $data['title']) { - $object->setTitle(null); - } - if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { - $object->setFirstName($data['first_name']); - unset($data['first_name']); - } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { - $object->setFirstName(null); - } - if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { - $object->setLastName($data['last_name']); - unset($data['last_name']); - } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { - $object->setLastName(null); - } - if (\array_key_exists('email', $data) && null !== $data['email']) { - $object->setEmail($data['email']); - unset($data['email']); - } elseif (\array_key_exists('email', $data) && null === $data['email']) { - $object->setEmail(null); - } - if (\array_key_exists('phone_office', $data) && null !== $data['phone_office']) { - $object->setPhoneOffice($data['phone_office']); - unset($data['phone_office']); - } elseif (\array_key_exists('phone_office', $data) && null === $data['phone_office']) { - $object->setPhoneOffice(null); - } - if (\array_key_exists('phone_mobile', $data) && null !== $data['phone_mobile']) { - $object->setPhoneMobile($data['phone_mobile']); - unset($data['phone_mobile']); - } elseif (\array_key_exists('phone_mobile', $data) && null === $data['phone_mobile']) { - $object->setPhoneMobile(null); - } - if (\array_key_exists('fax', $data) && null !== $data['fax']) { - $object->setFax($data['fax']); - unset($data['fax']); - } elseif (\array_key_exists('fax', $data) && null === $data['fax']) { - $object->setFax(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); } + if ($object->isInitialized('title') && null !== $object->getTitle()) { + $data['title'] = $object->getTitle(); + } + if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { + $data['first_name'] = $object->getFirstName(); + } + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + if ($object->isInitialized('phoneOffice') && null !== $object->getPhoneOffice()) { + $data['phone_office'] = $object->getPhoneOffice(); + } + if ($object->isInitialized('phoneMobile') && null !== $object->getPhoneMobile()) { + $data['phone_mobile'] = $object->getPhoneMobile(); + } + if ($object->isInitialized('fax') && null !== $object->getFax()) { + $data['fax'] = $object->getFax(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ContactsContactIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('title') && null !== $object->getTitle()) { - $data['title'] = $object->getTitle(); - } - if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { - $data['first_name'] = $object->getFirstName(); - } - if ($object->isInitialized('lastName') && null !== $object->getLastName()) { - $data['last_name'] = $object->getLastName(); - } - if ($object->isInitialized('email') && null !== $object->getEmail()) { - $data['email'] = $object->getEmail(); - } - if ($object->isInitialized('phoneOffice') && null !== $object->getPhoneOffice()) { - $data['phone_office'] = $object->getPhoneOffice(); - } - if ($object->isInitialized('phoneMobile') && null !== $object->getPhoneMobile()) { - $data['phone_mobile'] = $object->getPhoneMobile(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' === $type; } - if ($object->isInitialized('fax') && null !== $object->getFax()) { - $data['fax'] = $object->getFax(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ContactsContactIdPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('title', $data) && null !== $data['title']) { + $object->setTitle($data['title']); + unset($data['title']); + } elseif (\array_key_exists('title', $data) && null === $data['title']) { + $object->setTitle(null); + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('phone_office', $data) && null !== $data['phone_office']) { + $object->setPhoneOffice($data['phone_office']); + unset($data['phone_office']); + } elseif (\array_key_exists('phone_office', $data) && null === $data['phone_office']) { + $object->setPhoneOffice(null); } + if (\array_key_exists('phone_mobile', $data) && null !== $data['phone_mobile']) { + $object->setPhoneMobile($data['phone_mobile']); + unset($data['phone_mobile']); + } elseif (\array_key_exists('phone_mobile', $data) && null === $data['phone_mobile']) { + $object->setPhoneMobile(null); + } + if (\array_key_exists('fax', $data) && null !== $data['fax']) { + $object->setFax($data['fax']); + unset($data['fax']); + } elseif (\array_key_exists('fax', $data) && null === $data['fax']) { + $object->setFax(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('title') && null !== $object->getTitle()) { + $data['title'] = $object->getTitle(); + } + if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { + $data['first_name'] = $object->getFirstName(); + } + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + if ($object->isInitialized('phoneOffice') && null !== $object->getPhoneOffice()) { + $data['phone_office'] = $object->getPhoneOffice(); + } + if ($object->isInitialized('phoneMobile') && null !== $object->getPhoneMobile()) { + $data['phone_mobile'] = $object->getPhoneMobile(); + } + if ($object->isInitialized('fax') && null !== $object->getFax()) { + $data['fax'] = $object->getFax(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/ContactsNormalizer.php b/generated/Normalizer/ContactsNormalizer.php index 96d9ca5..dd9560b 100644 --- a/generated/Normalizer/ContactsNormalizer.php +++ b/generated/Normalizer/ContactsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ContactsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Contacts' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ContactsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Contacts' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Contacts' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Contacts' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Contacts(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Contacts(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('contacts', $data)) { + $values = []; + foreach ($data['contacts'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Contact', 'json', $context); + } + $object->setContacts($values); + unset($data['contacts']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('contacts', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['contacts'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Contact', 'json', $context); + foreach ($object->getContacts() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setContacts($values); - unset($data['contacts']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['contacts'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Contacts' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ContactsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getContacts() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Contacts' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Contacts' === $data::class; } - $data['contacts'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Contacts(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('contacts', $data)) { + $values = []; + foreach ($data['contacts'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Contact', 'json', $context); + } + $object->setContacts($values); + unset($data['contacts']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getContacts() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['contacts'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Contacts' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Contacts' => false]; + } } } diff --git a/generated/Normalizer/ContactsPostBodyNormalizer.php b/generated/Normalizer/ContactsPostBodyNormalizer.php index 304df4e..9b3f192 100644 --- a/generated/Normalizer/ContactsPostBodyNormalizer.php +++ b/generated/Normalizer/ContactsPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,139 +22,260 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ContactsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ContactsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ContactsPostBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ContactsPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('title', $data) && null !== $data['title']) { + $object->setTitle($data['title']); + unset($data['title']); + } elseif (\array_key_exists('title', $data) && null === $data['title']) { + $object->setTitle(null); + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('phone_office', $data) && null !== $data['phone_office']) { + $object->setPhoneOffice($data['phone_office']); + unset($data['phone_office']); + } elseif (\array_key_exists('phone_office', $data) && null === $data['phone_office']) { + $object->setPhoneOffice(null); + } + if (\array_key_exists('phone_mobile', $data) && null !== $data['phone_mobile']) { + $object->setPhoneMobile($data['phone_mobile']); + unset($data['phone_mobile']); + } elseif (\array_key_exists('phone_mobile', $data) && null === $data['phone_mobile']) { + $object->setPhoneMobile(null); + } + if (\array_key_exists('fax', $data) && null !== $data['fax']) { + $object->setFax($data['fax']); + unset($data['fax']); + } elseif (\array_key_exists('fax', $data) && null === $data['fax']) { + $object->setFax(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('title', $data) && null !== $data['title']) { - $object->setTitle($data['title']); - unset($data['title']); - } elseif (\array_key_exists('title', $data) && null === $data['title']) { - $object->setTitle(null); - } - if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { - $object->setFirstName($data['first_name']); - unset($data['first_name']); - } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { - $object->setFirstName(null); - } - if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { - $object->setLastName($data['last_name']); - unset($data['last_name']); - } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { - $object->setLastName(null); - } - if (\array_key_exists('email', $data) && null !== $data['email']) { - $object->setEmail($data['email']); - unset($data['email']); - } elseif (\array_key_exists('email', $data) && null === $data['email']) { - $object->setEmail(null); - } - if (\array_key_exists('phone_office', $data) && null !== $data['phone_office']) { - $object->setPhoneOffice($data['phone_office']); - unset($data['phone_office']); - } elseif (\array_key_exists('phone_office', $data) && null === $data['phone_office']) { - $object->setPhoneOffice(null); - } - if (\array_key_exists('phone_mobile', $data) && null !== $data['phone_mobile']) { - $object->setPhoneMobile($data['phone_mobile']); - unset($data['phone_mobile']); - } elseif (\array_key_exists('phone_mobile', $data) && null === $data['phone_mobile']) { - $object->setPhoneMobile(null); - } - if (\array_key_exists('fax', $data) && null !== $data['fax']) { - $object->setFax($data['fax']); - unset($data['fax']); - } elseif (\array_key_exists('fax', $data) && null === $data['fax']) { - $object->setFax(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['client_id'] = $object->getClientId(); + if ($object->isInitialized('title') && null !== $object->getTitle()) { + $data['title'] = $object->getTitle(); + } + $data['first_name'] = $object->getFirstName(); + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + if ($object->isInitialized('phoneOffice') && null !== $object->getPhoneOffice()) { + $data['phone_office'] = $object->getPhoneOffice(); + } + if ($object->isInitialized('phoneMobile') && null !== $object->getPhoneMobile()) { + $data['phone_mobile'] = $object->getPhoneMobile(); + } + if ($object->isInitialized('fax') && null !== $object->getFax()) { + $data['fax'] = $object->getFax(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ContactsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['client_id'] = $object->getClientId(); - if ($object->isInitialized('title') && null !== $object->getTitle()) { - $data['title'] = $object->getTitle(); - } - $data['first_name'] = $object->getFirstName(); - if ($object->isInitialized('lastName') && null !== $object->getLastName()) { - $data['last_name'] = $object->getLastName(); - } - if ($object->isInitialized('email') && null !== $object->getEmail()) { - $data['email'] = $object->getEmail(); - } - if ($object->isInitialized('phoneOffice') && null !== $object->getPhoneOffice()) { - $data['phone_office'] = $object->getPhoneOffice(); - } - if ($object->isInitialized('phoneMobile') && null !== $object->getPhoneMobile()) { - $data['phone_mobile'] = $object->getPhoneMobile(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' === $type; } - if ($object->isInitialized('fax') && null !== $object->getFax()) { - $data['fax'] = $object->getFax(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ContactsPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('title', $data) && null !== $data['title']) { + $object->setTitle($data['title']); + unset($data['title']); + } elseif (\array_key_exists('title', $data) && null === $data['title']) { + $object->setTitle(null); + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('phone_office', $data) && null !== $data['phone_office']) { + $object->setPhoneOffice($data['phone_office']); + unset($data['phone_office']); + } elseif (\array_key_exists('phone_office', $data) && null === $data['phone_office']) { + $object->setPhoneOffice(null); } + if (\array_key_exists('phone_mobile', $data) && null !== $data['phone_mobile']) { + $object->setPhoneMobile($data['phone_mobile']); + unset($data['phone_mobile']); + } elseif (\array_key_exists('phone_mobile', $data) && null === $data['phone_mobile']) { + $object->setPhoneMobile(null); + } + if (\array_key_exists('fax', $data) && null !== $data['fax']) { + $object->setFax($data['fax']); + unset($data['fax']); + } elseif (\array_key_exists('fax', $data) && null === $data['fax']) { + $object->setFax(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['client_id'] = $object->getClientId(); + if ($object->isInitialized('title') && null !== $object->getTitle()) { + $data['title'] = $object->getTitle(); + } + $data['first_name'] = $object->getFirstName(); + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + if ($object->isInitialized('phoneOffice') && null !== $object->getPhoneOffice()) { + $data['phone_office'] = $object->getPhoneOffice(); + } + if ($object->isInitialized('phoneMobile') && null !== $object->getPhoneMobile()) { + $data['phone_mobile'] = $object->getPhoneMobile(); + } + if ($object->isInitialized('fax') && null !== $object->getFax()) { + $data['fax'] = $object->getFax(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' => false]; + } } } diff --git a/generated/Normalizer/CostRateNormalizer.php b/generated/Normalizer/CostRateNormalizer.php index 50d4894..a897bf6 100644 --- a/generated/Normalizer/CostRateNormalizer.php +++ b/generated/Normalizer/CostRateNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,128 +22,238 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CostRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class CostRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\CostRate' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\CostRate' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\CostRate' === $type; } - $object = new \JoliCode\Harvest\Api\Model\CostRate(); - if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { - $data['amount'] = (float) $data['amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\CostRate' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\CostRate(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { + $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); + unset($data['start_date']); + } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { + $object->setStartDate(null); + } + if (\array_key_exists('end_date', $data) && null !== $data['end_date']) { + $object->setEndDate(\DateTime::createFromFormat('Y-m-d', $data['end_date'])->setTime(0, 0, 0)); + unset($data['end_date']); + } elseif (\array_key_exists('end_date', $data) && null === $data['end_date']) { + $object->setEndDate(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('amount', $data) && null !== $data['amount']) { - $object->setAmount($data['amount']); - unset($data['amount']); - } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { - $object->setAmount(null); - } - if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { - $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); - unset($data['start_date']); - } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { - $object->setStartDate(null); - } - if (\array_key_exists('end_date', $data) && null !== $data['end_date']) { - $object->setEndDate(\DateTime::createFromFormat('Y-m-d', $data['end_date'])->setTime(0, 0, 0)); - unset($data['end_date']); - } elseif (\array_key_exists('end_date', $data) && null === $data['end_date']) { - $object->setEndDate(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { + $data['start_date'] = $object->getStartDate()->format('Y-m-d'); + } + if ($object->isInitialized('endDate') && null !== $object->getEndDate()) { + $data['end_date'] = $object->getEndDate()->format('Y-m-d'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\CostRate' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class CostRateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['amount'] = $object->getAmount(); - } - if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { - $data['start_date'] = $object->getStartDate()->format('Y-m-d'); - } - if ($object->isInitialized('endDate') && null !== $object->getEndDate()) { - $data['end_date'] = $object->getEndDate()->format('Y-m-d'); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\CostRate' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\CostRate' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\CostRate(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { + $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); + unset($data['start_date']); + } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { + $object->setStartDate(null); + } + if (\array_key_exists('end_date', $data) && null !== $data['end_date']) { + $object->setEndDate(\DateTime::createFromFormat('Y-m-d', $data['end_date'])->setTime(0, 0, 0)); + unset($data['end_date']); + } elseif (\array_key_exists('end_date', $data) && null === $data['end_date']) { + $object->setEndDate(null); } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { + $data['start_date'] = $object->getStartDate()->format('Y-m-d'); + } + if ($object->isInitialized('endDate') && null !== $object->getEndDate()) { + $data['end_date'] = $object->getEndDate()->format('Y-m-d'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\CostRate' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\CostRate' => false]; + } } } diff --git a/generated/Normalizer/CostRatesNormalizer.php b/generated/Normalizer/CostRatesNormalizer.php index 676c38e..a8a5139 100644 --- a/generated/Normalizer/CostRatesNormalizer.php +++ b/generated/Normalizer/CostRatesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CostRatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\CostRates' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class CostRatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\CostRates' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\CostRates' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\CostRates' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\CostRates(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\CostRates(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('cost_rates', $data)) { + $values = []; + foreach ($data['cost_rates'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\CostRate', 'json', $context); + } + $object->setCostRates($values); + unset($data['cost_rates']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('cost_rates', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['cost_rates'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\CostRate', 'json', $context); + foreach ($object->getCostRates() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setCostRates($values); - unset($data['cost_rates']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['cost_rates'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\CostRates' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class CostRatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getCostRates() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\CostRates' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\CostRates' === $data::class; } - $data['cost_rates'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\CostRates(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('cost_rates', $data)) { + $values = []; + foreach ($data['cost_rates'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\CostRate', 'json', $context); + } + $object->setCostRates($values); + unset($data['cost_rates']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getCostRates() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['cost_rates'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\CostRates' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\CostRates' => false]; + } } } diff --git a/generated/Normalizer/ErrorNormalizer.php b/generated/Normalizer/ErrorNormalizer.php index 4ece617..906e5f4 100644 --- a/generated/Normalizer/ErrorNormalizer.php +++ b/generated/Normalizer/ErrorNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,85 +22,152 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Error' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Error' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Error' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Error' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Error(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Error(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('code', $data)) { + $object->setCode($data['code']); + unset($data['code']); + } + if (\array_key_exists('message', $data)) { + $object->setMessage($data['message']); + unset($data['message']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('code', $data)) { - $object->setCode($data['code']); - unset($data['code']); - } - if (\array_key_exists('message', $data)) { - $object->setMessage($data['message']); - unset($data['message']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + if ($object->isInitialized('message') && null !== $object->getMessage()) { + $data['message'] = $object->getMessage(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Error' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Error' === $type; } - if ($object->isInitialized('message') && null !== $object->getMessage()) { - $data['message'] = $object->getMessage(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Error' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Error(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('code', $data)) { + $object->setCode($data['code']); + unset($data['code']); + } + if (\array_key_exists('message', $data)) { + $object->setMessage($data['message']); + unset($data['message']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + if ($object->isInitialized('message') && null !== $object->getMessage()) { + $data['message'] = $object->getMessage(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Error' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Error' => false]; + } } } diff --git a/generated/Normalizer/EstimateClientNormalizer.php b/generated/Normalizer/EstimateClientNormalizer.php index e3a1299..4ae8a5b 100644 --- a/generated/Normalizer/EstimateClientNormalizer.php +++ b/generated/Normalizer/EstimateClientNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateClient(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateClient' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateClient' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateClient' => false]; + } } } diff --git a/generated/Normalizer/EstimateCreatorNormalizer.php b/generated/Normalizer/EstimateCreatorNormalizer.php index ac4d98c..25cd65d 100644 --- a/generated/Normalizer/EstimateCreatorNormalizer.php +++ b/generated/Normalizer/EstimateCreatorNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateCreatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateCreatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateCreator(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateCreator(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateCreator' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateCreatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateCreator(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateCreator' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateCreator' => false]; + } } } diff --git a/generated/Normalizer/EstimateItemCategoriesEstimateItemCategoryIdPatchBodyNormalizer.php b/generated/Normalizer/EstimateItemCategoriesEstimateItemCategoryIdPatchBodyNormalizer.php index fa338c1..669dac6 100644 --- a/generated/Normalizer/EstimateItemCategoriesEstimateItemCategoryIdPatchBodyNormalizer.php +++ b/generated/Normalizer/EstimateItemCategoriesEstimateItemCategoryIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,80 +22,142 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateItemCategoriesEstimateItemCategoryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateItemCategoriesEstimateItemCategoryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategoriesEstimateItemCategoryIdPatchBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategoriesEstimateItemCategoryIdPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateItemCategoriesEstimateItemCategoryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' === $type; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' === $data::class; + } + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategoriesEstimateItemCategoryIdPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/EstimateItemCategoriesNormalizer.php b/generated/Normalizer/EstimateItemCategoriesNormalizer.php index 388b44e..321790e 100644 --- a/generated/Normalizer/EstimateItemCategoriesNormalizer.php +++ b/generated/Normalizer/EstimateItemCategoriesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateItemCategoriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateItemCategoriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategories(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategories(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('estimate_item_categories', $data)) { + $values = []; + foreach ($data['estimate_item_categories'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory', 'json', $context); + } + $object->setEstimateItemCategories($values); + unset($data['estimate_item_categories']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('estimate_item_categories', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['estimate_item_categories'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory', 'json', $context); + foreach ($object->getEstimateItemCategories() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setEstimateItemCategories($values); - unset($data['estimate_item_categories']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['estimate_item_categories'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateItemCategoriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getEstimateItemCategories() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' === $data::class; } - $data['estimate_item_categories'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategories(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('estimate_item_categories', $data)) { + $values = []; + foreach ($data['estimate_item_categories'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory', 'json', $context); + } + $object->setEstimateItemCategories($values); + unset($data['estimate_item_categories']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getEstimateItemCategories() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['estimate_item_categories'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' => false]; + } } } diff --git a/generated/Normalizer/EstimateItemCategoriesPostBodyNormalizer.php b/generated/Normalizer/EstimateItemCategoriesPostBodyNormalizer.php index e444d24..471bcc8 100644 --- a/generated/Normalizer/EstimateItemCategoriesPostBodyNormalizer.php +++ b/generated/Normalizer/EstimateItemCategoriesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,78 +22,138 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateItemCategoriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateItemCategoriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategoriesPostBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategoriesPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['name'] = $object->getName(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateItemCategoriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['name'] = $object->getName(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' === $data::class; + } + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategoriesPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' => false]; + } } } diff --git a/generated/Normalizer/EstimateItemCategoryNormalizer.php b/generated/Normalizer/EstimateItemCategoryNormalizer.php index f38fbaf..f6c3ce8 100644 --- a/generated/Normalizer/EstimateItemCategoryNormalizer.php +++ b/generated/Normalizer/EstimateItemCategoryNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,107 +22,196 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateItemCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateItemCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategory(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategory(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateItemCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateItemCategory(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' => false]; + } } } diff --git a/generated/Normalizer/EstimateLineItemNormalizer.php b/generated/Normalizer/EstimateLineItemNormalizer.php index fe1e3f7..67ae0a7 100644 --- a/generated/Normalizer/EstimateLineItemNormalizer.php +++ b/generated/Normalizer/EstimateLineItemNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,152 +22,286 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateLineItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateLineItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\EstimateLineItem(); - if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { - $data['quantity'] = (float) $data['quantity']; - } - if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { - $data['unit_price'] = (float) $data['unit_price']; - } - if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { - $data['amount'] = (float) $data['amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateLineItem(); + if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { + $data['quantity'] = (float) $data['quantity']; + } + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('kind', $data) && null !== $data['kind']) { + $object->setKind($data['kind']); + unset($data['kind']); + } elseif (\array_key_exists('kind', $data) && null === $data['kind']) { + $object->setKind(null); + } + if (\array_key_exists('description', $data) && null !== $data['description']) { + $object->setDescription($data['description']); + unset($data['description']); + } elseif (\array_key_exists('description', $data) && null === $data['description']) { + $object->setDescription(null); + } + if (\array_key_exists('quantity', $data) && null !== $data['quantity']) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); + } elseif (\array_key_exists('quantity', $data) && null === $data['quantity']) { + $object->setQuantity(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('taxed', $data) && null !== $data['taxed']) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } elseif (\array_key_exists('taxed', $data) && null === $data['taxed']) { + $object->setTaxed(null); + } + if (\array_key_exists('taxed2', $data) && null !== $data['taxed2']) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } elseif (\array_key_exists('taxed2', $data) && null === $data['taxed2']) { + $object->setTaxed2(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('kind', $data) && null !== $data['kind']) { - $object->setKind($data['kind']); - unset($data['kind']); - } elseif (\array_key_exists('kind', $data) && null === $data['kind']) { - $object->setKind(null); - } - if (\array_key_exists('description', $data) && null !== $data['description']) { - $object->setDescription($data['description']); - unset($data['description']); - } elseif (\array_key_exists('description', $data) && null === $data['description']) { - $object->setDescription(null); - } - if (\array_key_exists('quantity', $data) && null !== $data['quantity']) { - $object->setQuantity($data['quantity']); - unset($data['quantity']); - } elseif (\array_key_exists('quantity', $data) && null === $data['quantity']) { - $object->setQuantity(null); - } - if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { - $object->setUnitPrice($data['unit_price']); - unset($data['unit_price']); - } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { - $object->setUnitPrice(null); - } - if (\array_key_exists('amount', $data) && null !== $data['amount']) { - $object->setAmount($data['amount']); - unset($data['amount']); - } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { - $object->setAmount(null); - } - if (\array_key_exists('taxed', $data) && null !== $data['taxed']) { - $object->setTaxed($data['taxed']); - unset($data['taxed']); - } elseif (\array_key_exists('taxed', $data) && null === $data['taxed']) { - $object->setTaxed(null); - } - if (\array_key_exists('taxed2', $data) && null !== $data['taxed2']) { - $object->setTaxed2($data['taxed2']); - unset($data['taxed2']); - } elseif (\array_key_exists('taxed2', $data) && null === $data['taxed2']) { - $object->setTaxed2(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('kind') && null !== $object->getKind()) { + $data['kind'] = $object->getKind(); + } + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateLineItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('kind') && null !== $object->getKind()) { - $data['kind'] = $object->getKind(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { - $data['unit_price'] = $object->getUnitPrice(); - } - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['amount'] = $object->getAmount(); - } - if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { - $data['taxed'] = $object->getTaxed(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' === $type; } - if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { - $data['taxed2'] = $object->getTaxed2(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateLineItem(); + if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { + $data['quantity'] = (float) $data['quantity']; + } + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('kind', $data) && null !== $data['kind']) { + $object->setKind($data['kind']); + unset($data['kind']); + } elseif (\array_key_exists('kind', $data) && null === $data['kind']) { + $object->setKind(null); + } + if (\array_key_exists('description', $data) && null !== $data['description']) { + $object->setDescription($data['description']); + unset($data['description']); + } elseif (\array_key_exists('description', $data) && null === $data['description']) { + $object->setDescription(null); + } + if (\array_key_exists('quantity', $data) && null !== $data['quantity']) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); + } elseif (\array_key_exists('quantity', $data) && null === $data['quantity']) { + $object->setQuantity(null); } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('taxed', $data) && null !== $data['taxed']) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } elseif (\array_key_exists('taxed', $data) && null === $data['taxed']) { + $object->setTaxed(null); + } + if (\array_key_exists('taxed2', $data) && null !== $data['taxed2']) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } elseif (\array_key_exists('taxed2', $data) && null === $data['taxed2']) { + $object->setTaxed2(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('kind') && null !== $object->getKind()) { + $data['kind'] = $object->getKind(); + } + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' => false]; + } } } diff --git a/generated/Normalizer/EstimateLineItemsNormalizer.php b/generated/Normalizer/EstimateLineItemsNormalizer.php index 2f1dbf6..23de8ff 100644 --- a/generated/Normalizer/EstimateLineItemsNormalizer.php +++ b/generated/Normalizer/EstimateLineItemsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateLineItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateLineItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateLineItems(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateLineItems(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('estimate_line_items', $data)) { + $values = []; + foreach ($data['estimate_line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem', 'json', $context); + } + $object->setEstimateLineItems($values); + unset($data['estimate_line_items']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('estimate_line_items', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['estimate_line_items'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem', 'json', $context); + foreach ($object->getEstimateLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setEstimateLineItems($values); - unset($data['estimate_line_items']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['estimate_line_items'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateLineItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getEstimateLineItems() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' === $data::class; } - $data['estimate_line_items'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateLineItems(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('estimate_line_items', $data)) { + $values = []; + foreach ($data['estimate_line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem', 'json', $context); + } + $object->setEstimateLineItems($values); + unset($data['estimate_line_items']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getEstimateLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['estimate_line_items'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' => false]; + } } } diff --git a/generated/Normalizer/EstimateMessageNormalizer.php b/generated/Normalizer/EstimateMessageNormalizer.php index 7840d59..4b096a9 100644 --- a/generated/Normalizer/EstimateMessageNormalizer.php +++ b/generated/Normalizer/EstimateMessageNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,187 +22,356 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateMessage(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateMessage(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('sent_by', $data) && null !== $data['sent_by']) { + $object->setSentBy($data['sent_by']); + unset($data['sent_by']); + } elseif (\array_key_exists('sent_by', $data) && null === $data['sent_by']) { + $object->setSentBy(null); + } + if (\array_key_exists('sent_by_email', $data) && null !== $data['sent_by_email']) { + $object->setSentByEmail($data['sent_by_email']); + unset($data['sent_by_email']); + } elseif (\array_key_exists('sent_by_email', $data) && null === $data['sent_by_email']) { + $object->setSentByEmail(null); + } + if (\array_key_exists('sent_from', $data) && null !== $data['sent_from']) { + $object->setSentFrom($data['sent_from']); + unset($data['sent_from']); + } elseif (\array_key_exists('sent_from', $data) && null === $data['sent_from']) { + $object->setSentFrom(null); + } + if (\array_key_exists('sent_from_email', $data) && null !== $data['sent_from_email']) { + $object->setSentFromEmail($data['sent_from_email']); + unset($data['sent_from_email']); + } elseif (\array_key_exists('sent_from_email', $data) && null === $data['sent_from_email']) { + $object->setSentFromEmail(null); + } + if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { + $values = []; + foreach ($data['recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient', 'json', $context); + } + $object->setRecipients($values); + unset($data['recipients']); + } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { + $object->setRecipients(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('body', $data) && null !== $data['body']) { + $object->setBody($data['body']); + unset($data['body']); + } elseif (\array_key_exists('body', $data) && null === $data['body']) { + $object->setBody(null); + } + if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { + $object->setSendMeACopy($data['send_me_a_copy']); + unset($data['send_me_a_copy']); + } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { + $object->setSendMeACopy(null); + } + if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { + $object->setEventType($data['event_type']); + unset($data['event_type']); + } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { + $object->setEventType(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('sent_by', $data) && null !== $data['sent_by']) { - $object->setSentBy($data['sent_by']); - unset($data['sent_by']); - } elseif (\array_key_exists('sent_by', $data) && null === $data['sent_by']) { - $object->setSentBy(null); - } - if (\array_key_exists('sent_by_email', $data) && null !== $data['sent_by_email']) { - $object->setSentByEmail($data['sent_by_email']); - unset($data['sent_by_email']); - } elseif (\array_key_exists('sent_by_email', $data) && null === $data['sent_by_email']) { - $object->setSentByEmail(null); - } - if (\array_key_exists('sent_from', $data) && null !== $data['sent_from']) { - $object->setSentFrom($data['sent_from']); - unset($data['sent_from']); - } elseif (\array_key_exists('sent_from', $data) && null === $data['sent_from']) { - $object->setSentFrom(null); - } - if (\array_key_exists('sent_from_email', $data) && null !== $data['sent_from_email']) { - $object->setSentFromEmail($data['sent_from_email']); - unset($data['sent_from_email']); - } elseif (\array_key_exists('sent_from_email', $data) && null === $data['sent_from_email']) { - $object->setSentFromEmail(null); - } - if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { - $values = []; - foreach ($data['recipients'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient', 'json', $context); - } - $object->setRecipients($values); - unset($data['recipients']); - } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { - $object->setRecipients(null); - } - if (\array_key_exists('subject', $data) && null !== $data['subject']) { - $object->setSubject($data['subject']); - unset($data['subject']); - } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { - $object->setSubject(null); - } - if (\array_key_exists('body', $data) && null !== $data['body']) { - $object->setBody($data['body']); - unset($data['body']); - } elseif (\array_key_exists('body', $data) && null === $data['body']) { - $object->setBody(null); - } - if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { - $object->setSendMeACopy($data['send_me_a_copy']); - unset($data['send_me_a_copy']); - } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { - $object->setSendMeACopy(null); - } - if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { - $object->setEventType($data['event_type']); - unset($data['event_type']); - } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { - $object->setEventType(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('sentBy') && null !== $object->getSentBy()) { + $data['sent_by'] = $object->getSentBy(); + } + if ($object->isInitialized('sentByEmail') && null !== $object->getSentByEmail()) { + $data['sent_by_email'] = $object->getSentByEmail(); + } + if ($object->isInitialized('sentFrom') && null !== $object->getSentFrom()) { + $data['sent_from'] = $object->getSentFrom(); + } + if ($object->isInitialized('sentFromEmail') && null !== $object->getSentFromEmail()) { + $data['sent_from_email'] = $object->getSentFromEmail(); + } + if ($object->isInitialized('recipients') && null !== $object->getRecipients()) { + $values = []; + foreach ($object->getRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['recipients'] = $values; + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('body') && null !== $object->getBody()) { + $data['body'] = $object->getBody(); + } + if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { + $data['send_me_a_copy'] = $object->getSendMeACopy(); + } + if ($object->isInitialized('eventType') && null !== $object->getEventType()) { + $data['event_type'] = $object->getEventType(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessage' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('sentBy') && null !== $object->getSentBy()) { - $data['sent_by'] = $object->getSentBy(); - } - if ($object->isInitialized('sentByEmail') && null !== $object->getSentByEmail()) { - $data['sent_by_email'] = $object->getSentByEmail(); - } - if ($object->isInitialized('sentFrom') && null !== $object->getSentFrom()) { - $data['sent_from'] = $object->getSentFrom(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' === $type; } - if ($object->isInitialized('sentFromEmail') && null !== $object->getSentFromEmail()) { - $data['sent_from_email'] = $object->getSentFromEmail(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' === $data::class; } - if ($object->isInitialized('recipients') && null !== $object->getRecipients()) { - $values = []; - foreach ($object->getRecipients() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['recipients'] = $values; - } - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['subject'] = $object->getSubject(); - } - if ($object->isInitialized('body') && null !== $object->getBody()) { - $data['body'] = $object->getBody(); - } - if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { - $data['send_me_a_copy'] = $object->getSendMeACopy(); - } - if ($object->isInitialized('eventType') && null !== $object->getEventType()) { - $data['event_type'] = $object->getEventType(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateMessage(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('sent_by', $data) && null !== $data['sent_by']) { + $object->setSentBy($data['sent_by']); + unset($data['sent_by']); + } elseif (\array_key_exists('sent_by', $data) && null === $data['sent_by']) { + $object->setSentBy(null); + } + if (\array_key_exists('sent_by_email', $data) && null !== $data['sent_by_email']) { + $object->setSentByEmail($data['sent_by_email']); + unset($data['sent_by_email']); + } elseif (\array_key_exists('sent_by_email', $data) && null === $data['sent_by_email']) { + $object->setSentByEmail(null); + } + if (\array_key_exists('sent_from', $data) && null !== $data['sent_from']) { + $object->setSentFrom($data['sent_from']); + unset($data['sent_from']); + } elseif (\array_key_exists('sent_from', $data) && null === $data['sent_from']) { + $object->setSentFrom(null); + } + if (\array_key_exists('sent_from_email', $data) && null !== $data['sent_from_email']) { + $object->setSentFromEmail($data['sent_from_email']); + unset($data['sent_from_email']); + } elseif (\array_key_exists('sent_from_email', $data) && null === $data['sent_from_email']) { + $object->setSentFromEmail(null); + } + if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { + $values = []; + foreach ($data['recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient', 'json', $context); + } + $object->setRecipients($values); + unset($data['recipients']); + } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { + $object->setRecipients(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('body', $data) && null !== $data['body']) { + $object->setBody($data['body']); + unset($data['body']); + } elseif (\array_key_exists('body', $data) && null === $data['body']) { + $object->setBody(null); } + if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { + $object->setSendMeACopy($data['send_me_a_copy']); + unset($data['send_me_a_copy']); + } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { + $object->setSendMeACopy(null); + } + if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { + $object->setEventType($data['event_type']); + unset($data['event_type']); + } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { + $object->setEventType(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('sentBy') && null !== $object->getSentBy()) { + $data['sent_by'] = $object->getSentBy(); + } + if ($object->isInitialized('sentByEmail') && null !== $object->getSentByEmail()) { + $data['sent_by_email'] = $object->getSentByEmail(); + } + if ($object->isInitialized('sentFrom') && null !== $object->getSentFrom()) { + $data['sent_from'] = $object->getSentFrom(); + } + if ($object->isInitialized('sentFromEmail') && null !== $object->getSentFromEmail()) { + $data['sent_from_email'] = $object->getSentFromEmail(); + } + if ($object->isInitialized('recipients') && null !== $object->getRecipients()) { + $values = []; + foreach ($object->getRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['recipients'] = $values; + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('body') && null !== $object->getBody()) { + $data['body'] = $object->getBody(); + } + if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { + $data['send_me_a_copy'] = $object->getSendMeACopy(); + } + if ($object->isInitialized('eventType') && null !== $object->getEventType()) { + $data['event_type'] = $object->getEventType(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessage' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessage' => false]; + } } } diff --git a/generated/Normalizer/EstimateMessageRecipientNormalizer.php b/generated/Normalizer/EstimateMessageRecipientNormalizer.php index 7e00217..8848525 100644 --- a/generated/Normalizer/EstimateMessageRecipientNormalizer.php +++ b/generated/Normalizer/EstimateMessageRecipientNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateMessageRecipientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateMessageRecipientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateMessageRecipient(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateMessageRecipient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('email', $data) && null !== $data['email']) { - $object->setEmail($data['email']); - unset($data['email']); - } elseif (\array_key_exists('email', $data) && null === $data['email']) { - $object->setEmail(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateMessageRecipientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' === $type; } - if ($object->isInitialized('email') && null !== $object->getEmail()) { - $data['email'] = $object->getEmail(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateMessageRecipient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' => false]; + } } } diff --git a/generated/Normalizer/EstimateMessageRecipientsNormalizer.php b/generated/Normalizer/EstimateMessageRecipientsNormalizer.php index 00cb4ef..fade864 100644 --- a/generated/Normalizer/EstimateMessageRecipientsNormalizer.php +++ b/generated/Normalizer/EstimateMessageRecipientsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateMessageRecipientsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateMessageRecipientsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateMessageRecipients(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateMessageRecipients(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('estimate_message_recipients', $data)) { + $values = []; + foreach ($data['estimate_message_recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient', 'json', $context); + } + $object->setEstimateMessageRecipients($values); + unset($data['estimate_message_recipients']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('estimate_message_recipients', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['estimate_message_recipients'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient', 'json', $context); + foreach ($object->getEstimateMessageRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setEstimateMessageRecipients($values); - unset($data['estimate_message_recipients']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['estimate_message_recipients'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateMessageRecipientsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getEstimateMessageRecipients() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' === $data::class; } - $data['estimate_message_recipients'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateMessageRecipients(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('estimate_message_recipients', $data)) { + $values = []; + foreach ($data['estimate_message_recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient', 'json', $context); + } + $object->setEstimateMessageRecipients($values); + unset($data['estimate_message_recipients']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getEstimateMessageRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['estimate_message_recipients'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' => false]; + } } } diff --git a/generated/Normalizer/EstimateMessagesNormalizer.php b/generated/Normalizer/EstimateMessagesNormalizer.php index 4dc869a..9daca11 100644 --- a/generated/Normalizer/EstimateMessagesNormalizer.php +++ b/generated/Normalizer/EstimateMessagesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateMessagesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateMessagesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimateMessages(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateMessages(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('estimate_messages', $data)) { + $values = []; + foreach ($data['estimate_messages'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage', 'json', $context); + } + $object->setEstimateMessages($values); + unset($data['estimate_messages']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('estimate_messages', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['estimate_messages'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage', 'json', $context); + foreach ($object->getEstimateMessages() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setEstimateMessages($values); - unset($data['estimate_messages']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['estimate_messages'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessages' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateMessagesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getEstimateMessages() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' === $data::class; } - $data['estimate_messages'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimateMessages(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('estimate_messages', $data)) { + $values = []; + foreach ($data['estimate_messages'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage', 'json', $context); + } + $object->setEstimateMessages($values); + unset($data['estimate_messages']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getEstimateMessages() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['estimate_messages'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessages' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimateMessages' => false]; + } } } diff --git a/generated/Normalizer/EstimateNormalizer.php b/generated/Normalizer/EstimateNormalizer.php index 7c76b9e..ab40819 100644 --- a/generated/Normalizer/EstimateNormalizer.php +++ b/generated/Normalizer/EstimateNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,316 +22,614 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\Estimate' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Estimate' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\Estimate(); - if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { - $data['amount'] = (float) $data['amount']; - } - if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { - $data['tax'] = (float) $data['tax']; - } - if (\array_key_exists('tax_amount', $data) && \is_int($data['tax_amount'])) { - $data['tax_amount'] = (float) $data['tax_amount']; - } - if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { - $data['tax2'] = (float) $data['tax2']; - } - if (\array_key_exists('tax2_amount', $data) && \is_int($data['tax2_amount'])) { - $data['tax2_amount'] = (float) $data['tax2_amount']; - } - if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { - $data['discount'] = (float) $data['discount']; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Estimate' === $type; } - if (\array_key_exists('discount_amount', $data) && \is_int($data['discount_amount'])) { - $data['discount_amount'] = (float) $data['discount_amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Estimate' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Estimate(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax_amount', $data) && \is_int($data['tax_amount'])) { + $data['tax_amount'] = (float) $data['tax_amount']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('tax2_amount', $data) && \is_int($data['tax2_amount'])) { + $data['tax2_amount'] = (float) $data['tax2_amount']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (\array_key_exists('discount_amount', $data) && \is_int($data['discount_amount'])) { + $data['discount_amount'] = (float) $data['discount_amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\EstimateClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values = []; + foreach ($data['line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem', 'json', $context); + } + $object->setLineItems($values); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + if (\array_key_exists('creator', $data) && null !== $data['creator']) { + $object->setCreator($this->denormalizer->denormalize($data['creator'], 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator', 'json', $context)); + unset($data['creator']); + } elseif (\array_key_exists('creator', $data) && null === $data['creator']) { + $object->setCreator(null); + } + if (\array_key_exists('client_key', $data) && null !== $data['client_key']) { + $object->setClientKey($data['client_key']); + unset($data['client_key']); + } elseif (\array_key_exists('client_key', $data) && null === $data['client_key']) { + $object->setClientKey(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax_amount', $data) && null !== $data['tax_amount']) { + $object->setTaxAmount($data['tax_amount']); + unset($data['tax_amount']); + } elseif (\array_key_exists('tax_amount', $data) && null === $data['tax_amount']) { + $object->setTaxAmount(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); + } + if (\array_key_exists('tax2_amount', $data) && null !== $data['tax2_amount']) { + $object->setTax2Amount($data['tax2_amount']); + unset($data['tax2_amount']); + } elseif (\array_key_exists('tax2_amount', $data) && null === $data['tax2_amount']) { + $object->setTax2Amount(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); + } + if (\array_key_exists('discount_amount', $data) && null !== $data['discount_amount']) { + $object->setDiscountAmount($data['discount_amount']); + unset($data['discount_amount']); + } elseif (\array_key_exists('discount_amount', $data) && null === $data['discount_amount']) { + $object->setDiscountAmount(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('state', $data) && null !== $data['state']) { + $object->setState($data['state']); + unset($data['state']); + } elseif (\array_key_exists('state', $data) && null === $data['state']) { + $object->setState(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('sent_at', $data) && null !== $data['sent_at']) { + $object->setSentAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['sent_at'])); + unset($data['sent_at']); + } elseif (\array_key_exists('sent_at', $data) && null === $data['sent_at']) { + $object->setSentAt(null); + } + if (\array_key_exists('accepted_at', $data) && null !== $data['accepted_at']) { + $object->setAcceptedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['accepted_at'])); + unset($data['accepted_at']); + } elseif (\array_key_exists('accepted_at', $data) && null === $data['accepted_at']) { + $object->setAcceptedAt(null); + } + if (\array_key_exists('declined_at', $data) && null !== $data['declined_at']) { + $object->setDeclinedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['declined_at'])); + unset($data['declined_at']); + } elseif (\array_key_exists('declined_at', $data) && null === $data['declined_at']) { + $object->setDeclinedAt(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('client', $data) && null !== $data['client']) { - $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\EstimateClient', 'json', $context)); - unset($data['client']); - } elseif (\array_key_exists('client', $data) && null === $data['client']) { - $object->setClient(null); - } - if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { - $values = []; - foreach ($data['line_items'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem', 'json', $context); - } - $object->setLineItems($values); - unset($data['line_items']); - } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { - $object->setLineItems(null); - } - if (\array_key_exists('creator', $data) && null !== $data['creator']) { - $object->setCreator($this->denormalizer->denormalize($data['creator'], 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator', 'json', $context)); - unset($data['creator']); - } elseif (\array_key_exists('creator', $data) && null === $data['creator']) { - $object->setCreator(null); - } - if (\array_key_exists('client_key', $data) && null !== $data['client_key']) { - $object->setClientKey($data['client_key']); - unset($data['client_key']); - } elseif (\array_key_exists('client_key', $data) && null === $data['client_key']) { - $object->setClientKey(null); - } - if (\array_key_exists('number', $data) && null !== $data['number']) { - $object->setNumber($data['number']); - unset($data['number']); - } elseif (\array_key_exists('number', $data) && null === $data['number']) { - $object->setNumber(null); - } - if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { - $object->setPurchaseOrder($data['purchase_order']); - unset($data['purchase_order']); - } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { - $object->setPurchaseOrder(null); - } - if (\array_key_exists('amount', $data) && null !== $data['amount']) { - $object->setAmount($data['amount']); - unset($data['amount']); - } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { - $object->setAmount(null); - } - if (\array_key_exists('tax', $data) && null !== $data['tax']) { - $object->setTax($data['tax']); - unset($data['tax']); - } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { - $object->setTax(null); - } - if (\array_key_exists('tax_amount', $data) && null !== $data['tax_amount']) { - $object->setTaxAmount($data['tax_amount']); - unset($data['tax_amount']); - } elseif (\array_key_exists('tax_amount', $data) && null === $data['tax_amount']) { - $object->setTaxAmount(null); - } - if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { - $object->setTax2($data['tax2']); - unset($data['tax2']); - } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { - $object->setTax2(null); - } - if (\array_key_exists('tax2_amount', $data) && null !== $data['tax2_amount']) { - $object->setTax2Amount($data['tax2_amount']); - unset($data['tax2_amount']); - } elseif (\array_key_exists('tax2_amount', $data) && null === $data['tax2_amount']) { - $object->setTax2Amount(null); - } - if (\array_key_exists('discount', $data) && null !== $data['discount']) { - $object->setDiscount($data['discount']); - unset($data['discount']); - } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { - $object->setDiscount(null); - } - if (\array_key_exists('discount_amount', $data) && null !== $data['discount_amount']) { - $object->setDiscountAmount($data['discount_amount']); - unset($data['discount_amount']); - } elseif (\array_key_exists('discount_amount', $data) && null === $data['discount_amount']) { - $object->setDiscountAmount(null); - } - if (\array_key_exists('subject', $data) && null !== $data['subject']) { - $object->setSubject($data['subject']); - unset($data['subject']); - } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { - $object->setSubject(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - if (\array_key_exists('state', $data) && null !== $data['state']) { - $object->setState($data['state']); - unset($data['state']); - } elseif (\array_key_exists('state', $data) && null === $data['state']) { - $object->setState(null); - } - if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { - $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); - unset($data['issue_date']); - } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { - $object->setIssueDate(null); - } - if (\array_key_exists('sent_at', $data) && null !== $data['sent_at']) { - $object->setSentAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['sent_at'])); - unset($data['sent_at']); - } elseif (\array_key_exists('sent_at', $data) && null === $data['sent_at']) { - $object->setSentAt(null); - } - if (\array_key_exists('accepted_at', $data) && null !== $data['accepted_at']) { - $object->setAcceptedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['accepted_at'])); - unset($data['accepted_at']); - } elseif (\array_key_exists('accepted_at', $data) && null === $data['accepted_at']) { - $object->setAcceptedAt(null); - } - if (\array_key_exists('declined_at', $data) && null !== $data['declined_at']) { - $object->setDeclinedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['declined_at'])); - unset($data['declined_at']); - } elseif (\array_key_exists('declined_at', $data) && null === $data['declined_at']) { - $object->setDeclinedAt(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values = []; + foreach ($object->getLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['line_items'] = $values; + } + if ($object->isInitialized('creator') && null !== $object->getCreator()) { + $data['creator'] = $this->normalizer->normalize($object->getCreator(), 'json', $context); + } + if ($object->isInitialized('clientKey') && null !== $object->getClientKey()) { + $data['client_key'] = $object->getClientKey(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('taxAmount') && null !== $object->getTaxAmount()) { + $data['tax_amount'] = $object->getTaxAmount(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('tax2Amount') && null !== $object->getTax2Amount()) { + $data['tax2_amount'] = $object->getTax2Amount(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('discountAmount') && null !== $object->getDiscountAmount()) { + $data['discount_amount'] = $object->getDiscountAmount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('state') && null !== $object->getState()) { + $data['state'] = $object->getState(); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('sentAt') && null !== $object->getSentAt()) { + $data['sent_at'] = $object->getSentAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('acceptedAt') && null !== $object->getAcceptedAt()) { + $data['accepted_at'] = $object->getAcceptedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('declinedAt') && null !== $object->getDeclinedAt()) { + $data['declined_at'] = $object->getDeclinedAt()->format('Y-m-d\\TH:i:s\\Z'); } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Estimate' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Estimate' === $type; } - if ($object->isInitialized('client') && null !== $object->getClient()) { - $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Estimate' === $data::class; } - if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { - $values = []; - foreach ($object->getLineItems() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['line_items'] = $values; - } - if ($object->isInitialized('creator') && null !== $object->getCreator()) { - $data['creator'] = $this->normalizer->normalize($object->getCreator(), 'json', $context); - } - if ($object->isInitialized('clientKey') && null !== $object->getClientKey()) { - $data['client_key'] = $object->getClientKey(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); - } - if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { - $data['purchase_order'] = $object->getPurchaseOrder(); - } - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['amount'] = $object->getAmount(); - } - if ($object->isInitialized('tax') && null !== $object->getTax()) { - $data['tax'] = $object->getTax(); - } - if ($object->isInitialized('taxAmount') && null !== $object->getTaxAmount()) { - $data['tax_amount'] = $object->getTaxAmount(); - } - if ($object->isInitialized('tax2') && null !== $object->getTax2()) { - $data['tax2'] = $object->getTax2(); - } - if ($object->isInitialized('tax2Amount') && null !== $object->getTax2Amount()) { - $data['tax2_amount'] = $object->getTax2Amount(); - } - if ($object->isInitialized('discount') && null !== $object->getDiscount()) { - $data['discount'] = $object->getDiscount(); - } - if ($object->isInitialized('discountAmount') && null !== $object->getDiscountAmount()) { - $data['discount_amount'] = $object->getDiscountAmount(); - } - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['subject'] = $object->getSubject(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); - } - if ($object->isInitialized('state') && null !== $object->getState()) { - $data['state'] = $object->getState(); - } - if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { - $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); - } - if ($object->isInitialized('sentAt') && null !== $object->getSentAt()) { - $data['sent_at'] = $object->getSentAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('acceptedAt') && null !== $object->getAcceptedAt()) { - $data['accepted_at'] = $object->getAcceptedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('declinedAt') && null !== $object->getDeclinedAt()) { - $data['declined_at'] = $object->getDeclinedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Estimate(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax_amount', $data) && \is_int($data['tax_amount'])) { + $data['tax_amount'] = (float) $data['tax_amount']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('tax2_amount', $data) && \is_int($data['tax2_amount'])) { + $data['tax2_amount'] = (float) $data['tax2_amount']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (\array_key_exists('discount_amount', $data) && \is_int($data['discount_amount'])) { + $data['discount_amount'] = (float) $data['discount_amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\EstimateClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values = []; + foreach ($data['line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem', 'json', $context); + } + $object->setLineItems($values); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + if (\array_key_exists('creator', $data) && null !== $data['creator']) { + $object->setCreator($this->denormalizer->denormalize($data['creator'], 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator', 'json', $context)); + unset($data['creator']); + } elseif (\array_key_exists('creator', $data) && null === $data['creator']) { + $object->setCreator(null); + } + if (\array_key_exists('client_key', $data) && null !== $data['client_key']) { + $object->setClientKey($data['client_key']); + unset($data['client_key']); + } elseif (\array_key_exists('client_key', $data) && null === $data['client_key']) { + $object->setClientKey(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); } + if (\array_key_exists('tax_amount', $data) && null !== $data['tax_amount']) { + $object->setTaxAmount($data['tax_amount']); + unset($data['tax_amount']); + } elseif (\array_key_exists('tax_amount', $data) && null === $data['tax_amount']) { + $object->setTaxAmount(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); + } + if (\array_key_exists('tax2_amount', $data) && null !== $data['tax2_amount']) { + $object->setTax2Amount($data['tax2_amount']); + unset($data['tax2_amount']); + } elseif (\array_key_exists('tax2_amount', $data) && null === $data['tax2_amount']) { + $object->setTax2Amount(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); + } + if (\array_key_exists('discount_amount', $data) && null !== $data['discount_amount']) { + $object->setDiscountAmount($data['discount_amount']); + unset($data['discount_amount']); + } elseif (\array_key_exists('discount_amount', $data) && null === $data['discount_amount']) { + $object->setDiscountAmount(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('state', $data) && null !== $data['state']) { + $object->setState($data['state']); + unset($data['state']); + } elseif (\array_key_exists('state', $data) && null === $data['state']) { + $object->setState(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('sent_at', $data) && null !== $data['sent_at']) { + $object->setSentAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['sent_at'])); + unset($data['sent_at']); + } elseif (\array_key_exists('sent_at', $data) && null === $data['sent_at']) { + $object->setSentAt(null); + } + if (\array_key_exists('accepted_at', $data) && null !== $data['accepted_at']) { + $object->setAcceptedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['accepted_at'])); + unset($data['accepted_at']); + } elseif (\array_key_exists('accepted_at', $data) && null === $data['accepted_at']) { + $object->setAcceptedAt(null); + } + if (\array_key_exists('declined_at', $data) && null !== $data['declined_at']) { + $object->setDeclinedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['declined_at'])); + unset($data['declined_at']); + } elseif (\array_key_exists('declined_at', $data) && null === $data['declined_at']) { + $object->setDeclinedAt(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values = []; + foreach ($object->getLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['line_items'] = $values; + } + if ($object->isInitialized('creator') && null !== $object->getCreator()) { + $data['creator'] = $this->normalizer->normalize($object->getCreator(), 'json', $context); + } + if ($object->isInitialized('clientKey') && null !== $object->getClientKey()) { + $data['client_key'] = $object->getClientKey(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('taxAmount') && null !== $object->getTaxAmount()) { + $data['tax_amount'] = $object->getTaxAmount(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('tax2Amount') && null !== $object->getTax2Amount()) { + $data['tax2_amount'] = $object->getTax2Amount(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('discountAmount') && null !== $object->getDiscountAmount()) { + $data['discount_amount'] = $object->getDiscountAmount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('state') && null !== $object->getState()) { + $data['state'] = $object->getState(); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('sentAt') && null !== $object->getSentAt()) { + $data['sent_at'] = $object->getSentAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('acceptedAt') && null !== $object->getAcceptedAt()) { + $data['accepted_at'] = $object->getAcceptedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('declinedAt') && null !== $object->getDeclinedAt()) { + $data['declined_at'] = $object->getDeclinedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Estimate' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Estimate' => false]; + } } } diff --git a/generated/Normalizer/EstimatesEstimateIdMessagesPostBodyNormalizer.php b/generated/Normalizer/EstimatesEstimateIdMessagesPostBodyNormalizer.php index 6ebcdb6..6751efc 100644 --- a/generated/Normalizer/EstimatesEstimateIdMessagesPostBodyNormalizer.php +++ b/generated/Normalizer/EstimatesEstimateIdMessagesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,122 +22,226 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimatesEstimateIdMessagesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimatesEstimateIdMessagesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdMessagesPostBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdMessagesPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { + $object->setEventType($data['event_type']); + unset($data['event_type']); + } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { + $object->setEventType(null); + } + if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { + $values = []; + foreach ($data['recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem', 'json', $context); + } + $object->setRecipients($values); + unset($data['recipients']); + } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { + $object->setRecipients(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('body', $data) && null !== $data['body']) { + $object->setBody($data['body']); + unset($data['body']); + } elseif (\array_key_exists('body', $data) && null === $data['body']) { + $object->setBody(null); + } + if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { + $object->setSendMeACopy($data['send_me_a_copy']); + unset($data['send_me_a_copy']); + } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { + $object->setSendMeACopy(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { - $object->setEventType($data['event_type']); - unset($data['event_type']); - } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { - $object->setEventType(null); - } - if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('eventType') && null !== $object->getEventType()) { + $data['event_type'] = $object->getEventType(); + } $values = []; - foreach ($data['recipients'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem', 'json', $context); + foreach ($object->getRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setRecipients($values); - unset($data['recipients']); - } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { - $object->setRecipients(null); - } - if (\array_key_exists('subject', $data) && null !== $data['subject']) { - $object->setSubject($data['subject']); - unset($data['subject']); - } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { - $object->setSubject(null); - } - if (\array_key_exists('body', $data) && null !== $data['body']) { - $object->setBody($data['body']); - unset($data['body']); - } elseif (\array_key_exists('body', $data) && null === $data['body']) { - $object->setBody(null); - } - if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { - $object->setSendMeACopy($data['send_me_a_copy']); - unset($data['send_me_a_copy']); - } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { - $object->setSendMeACopy(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['recipients'] = $values; + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('body') && null !== $object->getBody()) { + $data['body'] = $object->getBody(); + } + if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { + $data['send_me_a_copy'] = $object->getSendMeACopy(); } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimatesEstimateIdMessagesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('eventType') && null !== $object->getEventType()) { - $data['event_type'] = $object->getEventType(); - } - $values = []; - foreach ($object->getRecipients() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['recipients'] = $values; - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['subject'] = $object->getSubject(); - } - if ($object->isInitialized('body') && null !== $object->getBody()) { - $data['body'] = $object->getBody(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' === $type; } - if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { - $data['send_me_a_copy'] = $object->getSendMeACopy(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' === $data::class; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdMessagesPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { + $object->setEventType($data['event_type']); + unset($data['event_type']); + } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { + $object->setEventType(null); + } + if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { + $values = []; + foreach ($data['recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem', 'json', $context); + } + $object->setRecipients($values); + unset($data['recipients']); + } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { + $object->setRecipients(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('body', $data) && null !== $data['body']) { + $object->setBody($data['body']); + unset($data['body']); + } elseif (\array_key_exists('body', $data) && null === $data['body']) { + $object->setBody(null); + } + if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { + $object->setSendMeACopy($data['send_me_a_copy']); + unset($data['send_me_a_copy']); + } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { + $object->setSendMeACopy(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('eventType') && null !== $object->getEventType()) { + $data['event_type'] = $object->getEventType(); + } + $values = []; + foreach ($object->getRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['recipients'] = $values; + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('body') && null !== $object->getBody()) { + $data['body'] = $object->getBody(); + } + if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { + $data['send_me_a_copy'] = $object->getSendMeACopy(); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' => false]; + } } } diff --git a/generated/Normalizer/EstimatesEstimateIdMessagesPostBodyRecipientsItemNormalizer.php b/generated/Normalizer/EstimatesEstimateIdMessagesPostBodyRecipientsItemNormalizer.php index c474b85..13c7986 100644 --- a/generated/Normalizer/EstimatesEstimateIdMessagesPostBodyRecipientsItemNormalizer.php +++ b/generated/Normalizer/EstimatesEstimateIdMessagesPostBodyRecipientsItemNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,83 +22,148 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimatesEstimateIdMessagesPostBodyRecipientsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimatesEstimateIdMessagesPostBodyRecipientsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdMessagesPostBodyRecipientsItem(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdMessagesPostBodyRecipientsItem(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } + if (\array_key_exists('email', $data)) { + $object->setEmail($data['email']); + unset($data['email']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data)) { - $object->setName($data['name']); - unset($data['name']); - } - if (\array_key_exists('email', $data)) { - $object->setEmail($data['email']); - unset($data['email']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + $data['email'] = $object->getEmail(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimatesEstimateIdMessagesPostBodyRecipientsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' === $data::class; } - $data['email'] = $object->getEmail(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdMessagesPostBodyRecipientsItem(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } + if (\array_key_exists('email', $data)) { + $object->setEmail($data['email']); + unset($data['email']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + $data['email'] = $object->getEmail(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' => false]; + } } } diff --git a/generated/Normalizer/EstimatesEstimateIdPatchBodyLineItemsItemNormalizer.php b/generated/Normalizer/EstimatesEstimateIdPatchBodyLineItemsItemNormalizer.php index 43545f8..7386518 100644 --- a/generated/Normalizer/EstimatesEstimateIdPatchBodyLineItemsItemNormalizer.php +++ b/generated/Normalizer/EstimatesEstimateIdPatchBodyLineItemsItemNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimatesEstimateIdPatchBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimatesEstimateIdPatchBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' === $type; } - $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdPatchBodyLineItemsItem(); - if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { - $data['unit_price'] = (float) $data['unit_price']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdPatchBodyLineItemsItem(); + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data)) { + $object->setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('kind', $data)) { + $object->setKind($data['kind']); + unset($data['kind']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('quantity', $data)) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); + } + if (\array_key_exists('unit_price', $data)) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } + if (\array_key_exists('taxed', $data)) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } + if (\array_key_exists('taxed2', $data)) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data)) { - $object->setId($data['id']); - unset($data['id']); - } - if (\array_key_exists('kind', $data)) { - $object->setKind($data['kind']); - unset($data['kind']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('quantity', $data)) { - $object->setQuantity($data['quantity']); - unset($data['quantity']); - } - if (\array_key_exists('unit_price', $data)) { - $object->setUnitPrice($data['unit_price']); - unset($data['unit_price']); - } - if (\array_key_exists('taxed', $data)) { - $object->setTaxed($data['taxed']); - unset($data['taxed']); - } - if (\array_key_exists('taxed2', $data)) { - $object->setTaxed2($data['taxed2']); - unset($data['taxed2']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('kind') && null !== $object->getKind()) { + $data['kind'] = $object->getKind(); + } + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimatesEstimateIdPatchBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('kind') && null !== $object->getKind()) { - $data['kind'] = $object->getKind(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { - $data['unit_price'] = $object->getUnitPrice(); - } - if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { - $data['taxed'] = $object->getTaxed(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' === $type; } - if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { - $data['taxed2'] = $object->getTaxed2(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdPatchBodyLineItemsItem(); + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data)) { + $object->setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('kind', $data)) { + $object->setKind($data['kind']); + unset($data['kind']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('quantity', $data)) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); + } + if (\array_key_exists('unit_price', $data)) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); } + if (\array_key_exists('taxed', $data)) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } + if (\array_key_exists('taxed2', $data)) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('kind') && null !== $object->getKind()) { + $data['kind'] = $object->getKind(); + } + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' => false]; + } } } diff --git a/generated/Normalizer/EstimatesEstimateIdPatchBodyNormalizer.php b/generated/Normalizer/EstimatesEstimateIdPatchBodyNormalizer.php index bd458b7..f17441f 100644 --- a/generated/Normalizer/EstimatesEstimateIdPatchBodyNormalizer.php +++ b/generated/Normalizer/EstimatesEstimateIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,187 +22,356 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimatesEstimateIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimatesEstimateIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' === $type; } - $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdPatchBody(); - if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { - $data['tax'] = (float) $data['tax']; - } - if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { - $data['tax2'] = (float) $data['tax2']; - } - if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { - $data['discount'] = (float) $data['discount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdPatchBody(); + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values = []; + foreach ($data['line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem', 'json', $context); + } + $object->setLineItems($values); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('number', $data) && null !== $data['number']) { - $object->setNumber($data['number']); - unset($data['number']); - } elseif (\array_key_exists('number', $data) && null === $data['number']) { - $object->setNumber(null); - } - if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { - $object->setPurchaseOrder($data['purchase_order']); - unset($data['purchase_order']); - } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { - $object->setPurchaseOrder(null); - } - if (\array_key_exists('tax', $data) && null !== $data['tax']) { - $object->setTax($data['tax']); - unset($data['tax']); - } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { - $object->setTax(null); - } - if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { - $object->setTax2($data['tax2']); - unset($data['tax2']); - } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { - $object->setTax2(null); - } - if (\array_key_exists('discount', $data) && null !== $data['discount']) { - $object->setDiscount($data['discount']); - unset($data['discount']); - } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { - $object->setDiscount(null); - } - if (\array_key_exists('subject', $data) && null !== $data['subject']) { - $object->setSubject($data['subject']); - unset($data['subject']); - } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { - $object->setSubject(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { - $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); - unset($data['issue_date']); - } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { - $object->setIssueDate(null); - } - if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { - $values = []; - foreach ($data['line_items'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem', 'json', $context); - } - $object->setLineItems($values); - unset($data['line_items']); - } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { - $object->setLineItems(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values = []; + foreach ($object->getLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['line_items'] = $values; } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimatesEstimateIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); - } - if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { - $data['purchase_order'] = $object->getPurchaseOrder(); - } - if ($object->isInitialized('tax') && null !== $object->getTax()) { - $data['tax'] = $object->getTax(); - } - if ($object->isInitialized('tax2') && null !== $object->getTax2()) { - $data['tax2'] = $object->getTax2(); - } - if ($object->isInitialized('discount') && null !== $object->getDiscount()) { - $data['discount'] = $object->getDiscount(); - } - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['subject'] = $object->getSubject(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' === $type; } - if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { - $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' === $data::class; } - if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { - $values = []; - foreach ($object->getLineItems() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['line_items'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesEstimateIdPatchBody(); + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values = []; + foreach ($data['line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem', 'json', $context); + } + $object->setLineItems($values); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values = []; + foreach ($object->getLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['line_items'] = $values; + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/EstimatesNormalizer.php b/generated/Normalizer/EstimatesNormalizer.php index e2f98e2..c56122c 100644 --- a/generated/Normalizer/EstimatesNormalizer.php +++ b/generated/Normalizer/EstimatesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Estimates' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Estimates' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Estimates' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Estimates' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Estimates(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Estimates(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('estimates', $data)) { + $values = []; + foreach ($data['estimates'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Estimate', 'json', $context); + } + $object->setEstimates($values); + unset($data['estimates']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('estimates', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['estimates'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Estimate', 'json', $context); + foreach ($object->getEstimates() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setEstimates($values); - unset($data['estimates']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['estimates'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Estimates' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getEstimates() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Estimates' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Estimates' === $data::class; } - $data['estimates'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Estimates(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('estimates', $data)) { + $values = []; + foreach ($data['estimates'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Estimate', 'json', $context); + } + $object->setEstimates($values); + unset($data['estimates']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getEstimates() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['estimates'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Estimates' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Estimates' => false]; + } } } diff --git a/generated/Normalizer/EstimatesPostBodyLineItemsItemNormalizer.php b/generated/Normalizer/EstimatesPostBodyLineItemsItemNormalizer.php index b9e0ad4..bb25d70 100644 --- a/generated/Normalizer/EstimatesPostBodyLineItemsItemNormalizer.php +++ b/generated/Normalizer/EstimatesPostBodyLineItemsItemNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,112 +22,206 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimatesPostBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimatesPostBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\EstimatesPostBodyLineItemsItem(); - if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { - $data['unit_price'] = (float) $data['unit_price']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesPostBodyLineItemsItem(); + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('kind', $data)) { + $object->setKind($data['kind']); + unset($data['kind']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('quantity', $data)) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); + } + if (\array_key_exists('unit_price', $data)) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } + if (\array_key_exists('taxed', $data)) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } + if (\array_key_exists('taxed2', $data)) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('kind', $data)) { - $object->setKind($data['kind']); - unset($data['kind']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('quantity', $data)) { - $object->setQuantity($data['quantity']); - unset($data['quantity']); - } - if (\array_key_exists('unit_price', $data)) { - $object->setUnitPrice($data['unit_price']); - unset($data['unit_price']); - } - if (\array_key_exists('taxed', $data)) { - $object->setTaxed($data['taxed']); - unset($data['taxed']); - } - if (\array_key_exists('taxed2', $data)) { - $object->setTaxed2($data['taxed2']); - unset($data['taxed2']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['kind'] = $object->getKind(); + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + $data['unit_price'] = $object->getUnitPrice(); + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimatesPostBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['kind'] = $object->getKind(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['quantity'] = $object->getQuantity(); - } - $data['unit_price'] = $object->getUnitPrice(); - if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { - $data['taxed'] = $object->getTaxed(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' === $type; } - if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { - $data['taxed2'] = $object->getTaxed2(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesPostBodyLineItemsItem(); + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('kind', $data)) { + $object->setKind($data['kind']); + unset($data['kind']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('quantity', $data)) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); + } + if (\array_key_exists('unit_price', $data)) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); } + if (\array_key_exists('taxed', $data)) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } + if (\array_key_exists('taxed2', $data)) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['kind'] = $object->getKind(); + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + $data['unit_price'] = $object->getUnitPrice(); + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' => false]; + } } } diff --git a/generated/Normalizer/EstimatesPostBodyNormalizer.php b/generated/Normalizer/EstimatesPostBodyNormalizer.php index eed8618..a18fbb4 100644 --- a/generated/Normalizer/EstimatesPostBodyNormalizer.php +++ b/generated/Normalizer/EstimatesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,185 +22,352 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EstimatesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class EstimatesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' === $type; } - $object = new \JoliCode\Harvest\Api\Model\EstimatesPostBody(); - if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { - $data['tax'] = (float) $data['tax']; - } - if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { - $data['tax2'] = (float) $data['tax2']; - } - if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { - $data['discount'] = (float) $data['discount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesPostBody(); + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values = []; + foreach ($data['line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem', 'json', $context); + } + $object->setLineItems($values); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('number', $data) && null !== $data['number']) { - $object->setNumber($data['number']); - unset($data['number']); - } elseif (\array_key_exists('number', $data) && null === $data['number']) { - $object->setNumber(null); - } - if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { - $object->setPurchaseOrder($data['purchase_order']); - unset($data['purchase_order']); - } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { - $object->setPurchaseOrder(null); - } - if (\array_key_exists('tax', $data) && null !== $data['tax']) { - $object->setTax($data['tax']); - unset($data['tax']); - } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { - $object->setTax(null); - } - if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { - $object->setTax2($data['tax2']); - unset($data['tax2']); - } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { - $object->setTax2(null); - } - if (\array_key_exists('discount', $data) && null !== $data['discount']) { - $object->setDiscount($data['discount']); - unset($data['discount']); - } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { - $object->setDiscount(null); - } - if (\array_key_exists('subject', $data) && null !== $data['subject']) { - $object->setSubject($data['subject']); - unset($data['subject']); - } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { - $object->setSubject(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { - $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); - unset($data['issue_date']); - } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { - $object->setIssueDate(null); - } - if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { - $values = []; - foreach ($data['line_items'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem', 'json', $context); - } - $object->setLineItems($values); - unset($data['line_items']); - } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { - $object->setLineItems(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['client_id'] = $object->getClientId(); + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values = []; + foreach ($object->getLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['line_items'] = $values; + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class EstimatesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['client_id'] = $object->getClientId(); - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); - } - if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { - $data['purchase_order'] = $object->getPurchaseOrder(); - } - if ($object->isInitialized('tax') && null !== $object->getTax()) { - $data['tax'] = $object->getTax(); - } - if ($object->isInitialized('tax2') && null !== $object->getTax2()) { - $data['tax2'] = $object->getTax2(); - } - if ($object->isInitialized('discount') && null !== $object->getDiscount()) { - $data['discount'] = $object->getDiscount(); - } - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['subject'] = $object->getSubject(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' === $type; } - if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { - $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' === $data::class; } - if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { - $values = []; - foreach ($object->getLineItems() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['line_items'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\EstimatesPostBody(); + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values = []; + foreach ($data['line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem', 'json', $context); + } + $object->setLineItems($values); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['client_id'] = $object->getClientId(); + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values = []; + foreach ($object->getLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['line_items'] = $values; + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' => false]; + } } } diff --git a/generated/Normalizer/ExpenseCategoriesExpenseCategoryIdPatchBodyNormalizer.php b/generated/Normalizer/ExpenseCategoriesExpenseCategoryIdPatchBodyNormalizer.php index eccdc84..1c5d7fd 100644 --- a/generated/Normalizer/ExpenseCategoriesExpenseCategoryIdPatchBodyNormalizer.php +++ b/generated/Normalizer/ExpenseCategoriesExpenseCategoryIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,110 +22,202 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseCategoriesExpenseCategoryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseCategoriesExpenseCategoryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' === $type; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseCategoriesExpenseCategoryIdPatchBody(); - if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { - $data['unit_price'] = (float) $data['unit_price']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseCategoriesExpenseCategoryIdPatchBody(); + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { + $object->setUnitName($data['unit_name']); + unset($data['unit_name']); + } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { + $object->setUnitName(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { - $object->setUnitName($data['unit_name']); - unset($data['unit_name']); - } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { - $object->setUnitName(null); - } - if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { - $object->setUnitPrice($data['unit_price']); - unset($data['unit_price']); - } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { - $object->setUnitPrice(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { + $data['unit_name'] = $object->getUnitName(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseCategoriesExpenseCategoryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { - $data['unit_name'] = $object->getUnitName(); - } - if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { - $data['unit_price'] = $object->getUnitPrice(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' === $type; } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseCategoriesExpenseCategoryIdPatchBody(); + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { + $object->setUnitName($data['unit_name']); + unset($data['unit_name']); + } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { + $object->setUnitName(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { + $data['unit_name'] = $object->getUnitName(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/ExpenseCategoriesNormalizer.php b/generated/Normalizer/ExpenseCategoriesNormalizer.php index 5a6d472..27eef2d 100644 --- a/generated/Normalizer/ExpenseCategoriesNormalizer.php +++ b/generated/Normalizer/ExpenseCategoriesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseCategoriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseCategoriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseCategories(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseCategories(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('expense_categories', $data)) { + $values = []; + foreach ($data['expense_categories'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory', 'json', $context); + } + $object->setExpenseCategories($values); + unset($data['expense_categories']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('expense_categories', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['expense_categories'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory', 'json', $context); + foreach ($object->getExpenseCategories() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setExpenseCategories($values); - unset($data['expense_categories']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['expense_categories'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseCategoriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getExpenseCategories() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' === $data::class; } - $data['expense_categories'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseCategories(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('expense_categories', $data)) { + $values = []; + foreach ($data['expense_categories'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory', 'json', $context); + } + $object->setExpenseCategories($values); + unset($data['expense_categories']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getExpenseCategories() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['expense_categories'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' => false]; + } } } diff --git a/generated/Normalizer/ExpenseCategoriesPostBodyNormalizer.php b/generated/Normalizer/ExpenseCategoriesPostBodyNormalizer.php index ca271e0..cefa110 100644 --- a/generated/Normalizer/ExpenseCategoriesPostBodyNormalizer.php +++ b/generated/Normalizer/ExpenseCategoriesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,108 +22,198 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseCategoriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseCategoriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' === $type; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseCategoriesPostBody(); - if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { - $data['unit_price'] = (float) $data['unit_price']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseCategoriesPostBody(); + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { + $object->setUnitName($data['unit_name']); + unset($data['unit_name']); + } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { + $object->setUnitName(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { - $object->setUnitName($data['unit_name']); - unset($data['unit_name']); - } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { - $object->setUnitName(null); - } - if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { - $object->setUnitPrice($data['unit_price']); - unset($data['unit_price']); - } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { - $object->setUnitPrice(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['name'] = $object->getName(); + if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { + $data['unit_name'] = $object->getUnitName(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseCategoriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['name'] = $object->getName(); - if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { - $data['unit_name'] = $object->getUnitName(); - } - if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { - $data['unit_price'] = $object->getUnitPrice(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' === $type; } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseCategoriesPostBody(); + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { + $object->setUnitName($data['unit_name']); + unset($data['unit_name']); + } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { + $object->setUnitName(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { + $data['unit_name'] = $object->getUnitName(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' => false]; + } } } diff --git a/generated/Normalizer/ExpenseCategoryNormalizer.php b/generated/Normalizer/ExpenseCategoryNormalizer.php index c077ebe..051d9ca 100644 --- a/generated/Normalizer/ExpenseCategoryNormalizer.php +++ b/generated/Normalizer/ExpenseCategoryNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,137 +22,256 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' === $type; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseCategory(); - if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { - $data['unit_price'] = (float) $data['unit_price']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseCategory(); + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { + $object->setUnitName($data['unit_name']); + unset($data['unit_name']); + } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { + $object->setUnitName(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { - $object->setUnitName($data['unit_name']); - unset($data['unit_name']); - } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { - $object->setUnitName(null); - } - if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { - $object->setUnitPrice($data['unit_price']); - unset($data['unit_price']); - } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { - $object->setUnitPrice(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { + $data['unit_name'] = $object->getUnitName(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { - $data['unit_name'] = $object->getUnitName(); - } - if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { - $data['unit_price'] = $object->getUnitPrice(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseCategory(); + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { + $object->setUnitName($data['unit_name']); + unset($data['unit_name']); + } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { + $object->setUnitName(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { + $data['unit_name'] = $object->getUnitName(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' => false]; + } } } diff --git a/generated/Normalizer/ExpenseClientNormalizer.php b/generated/Normalizer/ExpenseClientNormalizer.php index cc056a4..3057bf7 100644 --- a/generated/Normalizer/ExpenseClientNormalizer.php +++ b/generated/Normalizer/ExpenseClientNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,98 +22,178 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseClient(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseClient' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' === $type; } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseClient' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseClient' => false]; + } } } diff --git a/generated/Normalizer/ExpenseExpenseCategoryNormalizer.php b/generated/Normalizer/ExpenseExpenseCategoryNormalizer.php index 736189a..197c389 100644 --- a/generated/Normalizer/ExpenseExpenseCategoryNormalizer.php +++ b/generated/Normalizer/ExpenseExpenseCategoryNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,107 +22,196 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseExpenseCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseExpenseCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseExpenseCategory(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseExpenseCategory(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); + } + if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { + $object->setUnitName($data['unit_name']); + unset($data['unit_name']); + } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { + $object->setUnitName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { - $object->setUnitPrice($data['unit_price']); - unset($data['unit_price']); - } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { - $object->setUnitPrice(null); - } - if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { - $object->setUnitName($data['unit_name']); - unset($data['unit_name']); - } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { - $object->setUnitName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); } + if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { + $data['unit_name'] = $object->getUnitName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseExpenseCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { - $data['unit_price'] = $object->getUnitPrice(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' === $type; } - if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { - $data['unit_name'] = $object->getUnitName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseExpenseCategory(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); + } + if (\array_key_exists('unit_name', $data) && null !== $data['unit_name']) { + $object->setUnitName($data['unit_name']); + unset($data['unit_name']); + } elseif (\array_key_exists('unit_name', $data) && null === $data['unit_name']) { + $object->setUnitName(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('unitName') && null !== $object->getUnitName()) { + $data['unit_name'] = $object->getUnitName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' => false]; + } } } diff --git a/generated/Normalizer/ExpenseInvoiceNormalizer.php b/generated/Normalizer/ExpenseInvoiceNormalizer.php index 25b262e..6fe220f 100644 --- a/generated/Normalizer/ExpenseInvoiceNormalizer.php +++ b/generated/Normalizer/ExpenseInvoiceNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseInvoiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseInvoiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseInvoice(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseInvoice(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('number', $data) && null !== $data['number']) { - $object->setNumber($data['number']); - unset($data['number']); - } elseif (\array_key_exists('number', $data) && null === $data['number']) { - $object->setNumber(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseInvoiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' === $type; } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseInvoice(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' => false]; + } } } diff --git a/generated/Normalizer/ExpenseNormalizer.php b/generated/Normalizer/ExpenseNormalizer.php index 5e4449a..62a39c6 100644 --- a/generated/Normalizer/ExpenseNormalizer.php +++ b/generated/Normalizer/ExpenseNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,243 +22,468 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\Expense' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Expense' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Expense' === $type; } - $object = new \JoliCode\Harvest\Api\Model\Expense(); - if (\array_key_exists('total_cost', $data) && \is_int($data['total_cost'])) { - $data['total_cost'] = (float) $data['total_cost']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Expense' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Expense(); + if (\array_key_exists('total_cost', $data) && \is_int($data['total_cost'])) { + $data['total_cost'] = (float) $data['total_cost']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('expense_category', $data) && null !== $data['expense_category']) { + $object->setExpenseCategory($this->denormalizer->denormalize($data['expense_category'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory', 'json', $context)); + unset($data['expense_category']); + } elseif (\array_key_exists('expense_category', $data) && null === $data['expense_category']) { + $object->setExpenseCategory(null); + } + if (\array_key_exists('user', $data) && null !== $data['user']) { + $object->setUser($this->denormalizer->denormalize($data['user'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser', 'json', $context)); + unset($data['user']); + } elseif (\array_key_exists('user', $data) && null === $data['user']) { + $object->setUser(null); + } + if (\array_key_exists('user_assignment', $data)) { + $object->setUserAssignment($this->denormalizer->denormalize($data['user_assignment'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignment', 'json', $context)); + unset($data['user_assignment']); + } + if (\array_key_exists('receipt', $data) && null !== $data['receipt']) { + $object->setReceipt($this->denormalizer->denormalize($data['receipt'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt', 'json', $context)); + unset($data['receipt']); + } elseif (\array_key_exists('receipt', $data) && null === $data['receipt']) { + $object->setReceipt(null); + } + if (\array_key_exists('invoice', $data) && null !== $data['invoice']) { + $object->setInvoice($this->denormalizer->denormalize($data['invoice'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice', 'json', $context)); + unset($data['invoice']); + } elseif (\array_key_exists('invoice', $data) && null === $data['invoice']) { + $object->setInvoice(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('units', $data) && null !== $data['units']) { + $object->setUnits($data['units']); + unset($data['units']); + } elseif (\array_key_exists('units', $data) && null === $data['units']) { + $object->setUnits(null); + } + if (\array_key_exists('total_cost', $data) && null !== $data['total_cost']) { + $object->setTotalCost($data['total_cost']); + unset($data['total_cost']); + } elseif (\array_key_exists('total_cost', $data) && null === $data['total_cost']) { + $object->setTotalCost(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('is_closed', $data) && null !== $data['is_closed']) { + $object->setIsClosed($data['is_closed']); + unset($data['is_closed']); + } elseif (\array_key_exists('is_closed', $data) && null === $data['is_closed']) { + $object->setIsClosed(null); + } + if (\array_key_exists('is_locked', $data) && null !== $data['is_locked']) { + $object->setIsLocked($data['is_locked']); + unset($data['is_locked']); + } elseif (\array_key_exists('is_locked', $data) && null === $data['is_locked']) { + $object->setIsLocked(null); + } + if (\array_key_exists('is_billed', $data) && null !== $data['is_billed']) { + $object->setIsBilled($data['is_billed']); + unset($data['is_billed']); + } elseif (\array_key_exists('is_billed', $data) && null === $data['is_billed']) { + $object->setIsBilled(null); + } + if (\array_key_exists('locked_reason', $data) && null !== $data['locked_reason']) { + $object->setLockedReason($data['locked_reason']); + unset($data['locked_reason']); + } elseif (\array_key_exists('locked_reason', $data) && null === $data['locked_reason']) { + $object->setLockedReason(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('client', $data) && null !== $data['client']) { - $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient', 'json', $context)); - unset($data['client']); - } elseif (\array_key_exists('client', $data) && null === $data['client']) { - $object->setClient(null); - } - if (\array_key_exists('project', $data) && null !== $data['project']) { - $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject', 'json', $context)); - unset($data['project']); - } elseif (\array_key_exists('project', $data) && null === $data['project']) { - $object->setProject(null); - } - if (\array_key_exists('expense_category', $data) && null !== $data['expense_category']) { - $object->setExpenseCategory($this->denormalizer->denormalize($data['expense_category'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory', 'json', $context)); - unset($data['expense_category']); - } elseif (\array_key_exists('expense_category', $data) && null === $data['expense_category']) { - $object->setExpenseCategory(null); - } - if (\array_key_exists('user', $data) && null !== $data['user']) { - $object->setUser($this->denormalizer->denormalize($data['user'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser', 'json', $context)); - unset($data['user']); - } elseif (\array_key_exists('user', $data) && null === $data['user']) { - $object->setUser(null); - } - if (\array_key_exists('user_assignment', $data)) { - $object->setUserAssignment($this->denormalizer->denormalize($data['user_assignment'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignment', 'json', $context)); - unset($data['user_assignment']); - } - if (\array_key_exists('receipt', $data) && null !== $data['receipt']) { - $object->setReceipt($this->denormalizer->denormalize($data['receipt'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt', 'json', $context)); - unset($data['receipt']); - } elseif (\array_key_exists('receipt', $data) && null === $data['receipt']) { - $object->setReceipt(null); - } - if (\array_key_exists('invoice', $data) && null !== $data['invoice']) { - $object->setInvoice($this->denormalizer->denormalize($data['invoice'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice', 'json', $context)); - unset($data['invoice']); - } elseif (\array_key_exists('invoice', $data) && null === $data['invoice']) { - $object->setInvoice(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('units', $data) && null !== $data['units']) { - $object->setUnits($data['units']); - unset($data['units']); - } elseif (\array_key_exists('units', $data) && null === $data['units']) { - $object->setUnits(null); - } - if (\array_key_exists('total_cost', $data) && null !== $data['total_cost']) { - $object->setTotalCost($data['total_cost']); - unset($data['total_cost']); - } elseif (\array_key_exists('total_cost', $data) && null === $data['total_cost']) { - $object->setTotalCost(null); - } - if (\array_key_exists('billable', $data) && null !== $data['billable']) { - $object->setBillable($data['billable']); - unset($data['billable']); - } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { - $object->setBillable(null); - } - if (\array_key_exists('is_closed', $data) && null !== $data['is_closed']) { - $object->setIsClosed($data['is_closed']); - unset($data['is_closed']); - } elseif (\array_key_exists('is_closed', $data) && null === $data['is_closed']) { - $object->setIsClosed(null); - } - if (\array_key_exists('is_locked', $data) && null !== $data['is_locked']) { - $object->setIsLocked($data['is_locked']); - unset($data['is_locked']); - } elseif (\array_key_exists('is_locked', $data) && null === $data['is_locked']) { - $object->setIsLocked(null); - } - if (\array_key_exists('is_billed', $data) && null !== $data['is_billed']) { - $object->setIsBilled($data['is_billed']); - unset($data['is_billed']); - } elseif (\array_key_exists('is_billed', $data) && null === $data['is_billed']) { - $object->setIsBilled(null); - } - if (\array_key_exists('locked_reason', $data) && null !== $data['locked_reason']) { - $object->setLockedReason($data['locked_reason']); - unset($data['locked_reason']); - } elseif (\array_key_exists('locked_reason', $data) && null === $data['locked_reason']) { - $object->setLockedReason(null); - } - if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { - $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); - unset($data['spent_date']); - } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { - $object->setSpentDate(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('expenseCategory') && null !== $object->getExpenseCategory()) { + $data['expense_category'] = $this->normalizer->normalize($object->getExpenseCategory(), 'json', $context); + } + if ($object->isInitialized('user') && null !== $object->getUser()) { + $data['user'] = $this->normalizer->normalize($object->getUser(), 'json', $context); + } + if ($object->isInitialized('userAssignment') && null !== $object->getUserAssignment()) { + $data['user_assignment'] = $this->normalizer->normalize($object->getUserAssignment(), 'json', $context); + } + if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { + $data['receipt'] = $this->normalizer->normalize($object->getReceipt(), 'json', $context); + } + if ($object->isInitialized('invoice') && null !== $object->getInvoice()) { + $data['invoice'] = $this->normalizer->normalize($object->getInvoice(), 'json', $context); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('units') && null !== $object->getUnits()) { + $data['units'] = $object->getUnits(); + } + if ($object->isInitialized('totalCost') && null !== $object->getTotalCost()) { + $data['total_cost'] = $object->getTotalCost(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('isClosed') && null !== $object->getIsClosed()) { + $data['is_closed'] = $object->getIsClosed(); + } + if ($object->isInitialized('isLocked') && null !== $object->getIsLocked()) { + $data['is_locked'] = $object->getIsLocked(); + } + if ($object->isInitialized('isBilled') && null !== $object->getIsBilled()) { + $data['is_billed'] = $object->getIsBilled(); + } + if ($object->isInitialized('lockedReason') && null !== $object->getLockedReason()) { + $data['locked_reason'] = $object->getLockedReason(); + } + if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Expense' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('client') && null !== $object->getClient()) { - $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); - } - if ($object->isInitialized('project') && null !== $object->getProject()) { - $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); - } - if ($object->isInitialized('expenseCategory') && null !== $object->getExpenseCategory()) { - $data['expense_category'] = $this->normalizer->normalize($object->getExpenseCategory(), 'json', $context); - } - if ($object->isInitialized('user') && null !== $object->getUser()) { - $data['user'] = $this->normalizer->normalize($object->getUser(), 'json', $context); - } - if ($object->isInitialized('userAssignment') && null !== $object->getUserAssignment()) { - $data['user_assignment'] = $this->normalizer->normalize($object->getUserAssignment(), 'json', $context); - } - if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { - $data['receipt'] = $this->normalizer->normalize($object->getReceipt(), 'json', $context); - } - if ($object->isInitialized('invoice') && null !== $object->getInvoice()) { - $data['invoice'] = $this->normalizer->normalize($object->getInvoice(), 'json', $context); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('units') && null !== $object->getUnits()) { - $data['units'] = $object->getUnits(); - } - if ($object->isInitialized('totalCost') && null !== $object->getTotalCost()) { - $data['total_cost'] = $object->getTotalCost(); - } - if ($object->isInitialized('billable') && null !== $object->getBillable()) { - $data['billable'] = $object->getBillable(); - } - if ($object->isInitialized('isClosed') && null !== $object->getIsClosed()) { - $data['is_closed'] = $object->getIsClosed(); - } - if ($object->isInitialized('isLocked') && null !== $object->getIsLocked()) { - $data['is_locked'] = $object->getIsLocked(); - } - if ($object->isInitialized('isBilled') && null !== $object->getIsBilled()) { - $data['is_billed'] = $object->getIsBilled(); - } - if ($object->isInitialized('lockedReason') && null !== $object->getLockedReason()) { - $data['locked_reason'] = $object->getLockedReason(); - } - if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { - $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Expense' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Expense' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Expense(); + if (\array_key_exists('total_cost', $data) && \is_int($data['total_cost'])) { + $data['total_cost'] = (float) $data['total_cost']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('expense_category', $data) && null !== $data['expense_category']) { + $object->setExpenseCategory($this->denormalizer->denormalize($data['expense_category'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory', 'json', $context)); + unset($data['expense_category']); + } elseif (\array_key_exists('expense_category', $data) && null === $data['expense_category']) { + $object->setExpenseCategory(null); + } + if (\array_key_exists('user', $data) && null !== $data['user']) { + $object->setUser($this->denormalizer->denormalize($data['user'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser', 'json', $context)); + unset($data['user']); + } elseif (\array_key_exists('user', $data) && null === $data['user']) { + $object->setUser(null); + } + if (\array_key_exists('user_assignment', $data)) { + $object->setUserAssignment($this->denormalizer->denormalize($data['user_assignment'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignment', 'json', $context)); + unset($data['user_assignment']); + } + if (\array_key_exists('receipt', $data) && null !== $data['receipt']) { + $object->setReceipt($this->denormalizer->denormalize($data['receipt'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt', 'json', $context)); + unset($data['receipt']); + } elseif (\array_key_exists('receipt', $data) && null === $data['receipt']) { + $object->setReceipt(null); + } + if (\array_key_exists('invoice', $data) && null !== $data['invoice']) { + $object->setInvoice($this->denormalizer->denormalize($data['invoice'], 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice', 'json', $context)); + unset($data['invoice']); + } elseif (\array_key_exists('invoice', $data) && null === $data['invoice']) { + $object->setInvoice(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('units', $data) && null !== $data['units']) { + $object->setUnits($data['units']); + unset($data['units']); + } elseif (\array_key_exists('units', $data) && null === $data['units']) { + $object->setUnits(null); + } + if (\array_key_exists('total_cost', $data) && null !== $data['total_cost']) { + $object->setTotalCost($data['total_cost']); + unset($data['total_cost']); + } elseif (\array_key_exists('total_cost', $data) && null === $data['total_cost']) { + $object->setTotalCost(null); } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('is_closed', $data) && null !== $data['is_closed']) { + $object->setIsClosed($data['is_closed']); + unset($data['is_closed']); + } elseif (\array_key_exists('is_closed', $data) && null === $data['is_closed']) { + $object->setIsClosed(null); + } + if (\array_key_exists('is_locked', $data) && null !== $data['is_locked']) { + $object->setIsLocked($data['is_locked']); + unset($data['is_locked']); + } elseif (\array_key_exists('is_locked', $data) && null === $data['is_locked']) { + $object->setIsLocked(null); + } + if (\array_key_exists('is_billed', $data) && null !== $data['is_billed']) { + $object->setIsBilled($data['is_billed']); + unset($data['is_billed']); + } elseif (\array_key_exists('is_billed', $data) && null === $data['is_billed']) { + $object->setIsBilled(null); + } + if (\array_key_exists('locked_reason', $data) && null !== $data['locked_reason']) { + $object->setLockedReason($data['locked_reason']); + unset($data['locked_reason']); + } elseif (\array_key_exists('locked_reason', $data) && null === $data['locked_reason']) { + $object->setLockedReason(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('expenseCategory') && null !== $object->getExpenseCategory()) { + $data['expense_category'] = $this->normalizer->normalize($object->getExpenseCategory(), 'json', $context); + } + if ($object->isInitialized('user') && null !== $object->getUser()) { + $data['user'] = $this->normalizer->normalize($object->getUser(), 'json', $context); + } + if ($object->isInitialized('userAssignment') && null !== $object->getUserAssignment()) { + $data['user_assignment'] = $this->normalizer->normalize($object->getUserAssignment(), 'json', $context); + } + if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { + $data['receipt'] = $this->normalizer->normalize($object->getReceipt(), 'json', $context); + } + if ($object->isInitialized('invoice') && null !== $object->getInvoice()) { + $data['invoice'] = $this->normalizer->normalize($object->getInvoice(), 'json', $context); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('units') && null !== $object->getUnits()) { + $data['units'] = $object->getUnits(); + } + if ($object->isInitialized('totalCost') && null !== $object->getTotalCost()) { + $data['total_cost'] = $object->getTotalCost(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('isClosed') && null !== $object->getIsClosed()) { + $data['is_closed'] = $object->getIsClosed(); + } + if ($object->isInitialized('isLocked') && null !== $object->getIsLocked()) { + $data['is_locked'] = $object->getIsLocked(); + } + if ($object->isInitialized('isBilled') && null !== $object->getIsBilled()) { + $data['is_billed'] = $object->getIsBilled(); + } + if ($object->isInitialized('lockedReason') && null !== $object->getLockedReason()) { + $data['locked_reason'] = $object->getLockedReason(); + } + if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Expense' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Expense' => false]; + } } } diff --git a/generated/Normalizer/ExpenseProjectNormalizer.php b/generated/Normalizer/ExpenseProjectNormalizer.php index 64ca2af..6a023a0 100644 --- a/generated/Normalizer/ExpenseProjectNormalizer.php +++ b/generated/Normalizer/ExpenseProjectNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,98 +22,178 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseProject(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('code', $data) && null !== $data['code']) { - $object->setCode($data['code']); - unset($data['code']); - } elseif (\array_key_exists('code', $data) && null === $data['code']) { - $object->setCode(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseProject' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' === $type; } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseProject' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseProject' => false]; + } } } diff --git a/generated/Normalizer/ExpenseReceiptNormalizer.php b/generated/Normalizer/ExpenseReceiptNormalizer.php index d9e638e..96c94ae 100644 --- a/generated/Normalizer/ExpenseReceiptNormalizer.php +++ b/generated/Normalizer/ExpenseReceiptNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,107 +22,196 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseReceipt(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseReceipt(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('url', $data) && null !== $data['url']) { + $object->setUrl($data['url']); + unset($data['url']); + } elseif (\array_key_exists('url', $data) && null === $data['url']) { + $object->setUrl(null); + } + if (\array_key_exists('file_name', $data) && null !== $data['file_name']) { + $object->setFileName($data['file_name']); + unset($data['file_name']); + } elseif (\array_key_exists('file_name', $data) && null === $data['file_name']) { + $object->setFileName(null); + } + if (\array_key_exists('file_size', $data) && null !== $data['file_size']) { + $object->setFileSize($data['file_size']); + unset($data['file_size']); + } elseif (\array_key_exists('file_size', $data) && null === $data['file_size']) { + $object->setFileSize(null); + } + if (\array_key_exists('content_type', $data) && null !== $data['content_type']) { + $object->setContentType($data['content_type']); + unset($data['content_type']); + } elseif (\array_key_exists('content_type', $data) && null === $data['content_type']) { + $object->setContentType(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('url', $data) && null !== $data['url']) { - $object->setUrl($data['url']); - unset($data['url']); - } elseif (\array_key_exists('url', $data) && null === $data['url']) { - $object->setUrl(null); - } - if (\array_key_exists('file_name', $data) && null !== $data['file_name']) { - $object->setFileName($data['file_name']); - unset($data['file_name']); - } elseif (\array_key_exists('file_name', $data) && null === $data['file_name']) { - $object->setFileName(null); - } - if (\array_key_exists('file_size', $data) && null !== $data['file_size']) { - $object->setFileSize($data['file_size']); - unset($data['file_size']); - } elseif (\array_key_exists('file_size', $data) && null === $data['file_size']) { - $object->setFileSize(null); - } - if (\array_key_exists('content_type', $data) && null !== $data['content_type']) { - $object->setContentType($data['content_type']); - unset($data['content_type']); - } elseif (\array_key_exists('content_type', $data) && null === $data['content_type']) { - $object->setContentType(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('url') && null !== $object->getUrl()) { + $data['url'] = $object->getUrl(); + } + if ($object->isInitialized('fileName') && null !== $object->getFileName()) { + $data['file_name'] = $object->getFileName(); + } + if ($object->isInitialized('fileSize') && null !== $object->getFileSize()) { + $data['file_size'] = $object->getFileSize(); } + if ($object->isInitialized('contentType') && null !== $object->getContentType()) { + $data['content_type'] = $object->getContentType(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseReceiptNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('url') && null !== $object->getUrl()) { - $data['url'] = $object->getUrl(); - } - if ($object->isInitialized('fileName') && null !== $object->getFileName()) { - $data['file_name'] = $object->getFileName(); - } - if ($object->isInitialized('fileSize') && null !== $object->getFileSize()) { - $data['file_size'] = $object->getFileSize(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' === $type; } - if ($object->isInitialized('contentType') && null !== $object->getContentType()) { - $data['content_type'] = $object->getContentType(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseReceipt(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('url', $data) && null !== $data['url']) { + $object->setUrl($data['url']); + unset($data['url']); + } elseif (\array_key_exists('url', $data) && null === $data['url']) { + $object->setUrl(null); + } + if (\array_key_exists('file_name', $data) && null !== $data['file_name']) { + $object->setFileName($data['file_name']); + unset($data['file_name']); + } elseif (\array_key_exists('file_name', $data) && null === $data['file_name']) { + $object->setFileName(null); + } + if (\array_key_exists('file_size', $data) && null !== $data['file_size']) { + $object->setFileSize($data['file_size']); + unset($data['file_size']); + } elseif (\array_key_exists('file_size', $data) && null === $data['file_size']) { + $object->setFileSize(null); + } + if (\array_key_exists('content_type', $data) && null !== $data['content_type']) { + $object->setContentType($data['content_type']); + unset($data['content_type']); + } elseif (\array_key_exists('content_type', $data) && null === $data['content_type']) { + $object->setContentType(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('url') && null !== $object->getUrl()) { + $data['url'] = $object->getUrl(); + } + if ($object->isInitialized('fileName') && null !== $object->getFileName()) { + $data['file_name'] = $object->getFileName(); + } + if ($object->isInitialized('fileSize') && null !== $object->getFileSize()) { + $data['file_size'] = $object->getFileSize(); + } + if ($object->isInitialized('contentType') && null !== $object->getContentType()) { + $data['content_type'] = $object->getContentType(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' => false]; + } } } diff --git a/generated/Normalizer/ExpenseReportsResultNormalizer.php b/generated/Normalizer/ExpenseReportsResultNormalizer.php index a8559c2..0823c32 100644 --- a/generated/Normalizer/ExpenseReportsResultNormalizer.php +++ b/generated/Normalizer/ExpenseReportsResultNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,185 +22,352 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseReportsResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseReportsResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' === $type; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseReportsResult(); - if (\array_key_exists('total_amount', $data) && \is_int($data['total_amount'])) { - $data['total_amount'] = (float) $data['total_amount']; - } - if (\array_key_exists('billable_amount', $data) && \is_int($data['billable_amount'])) { - $data['billable_amount'] = (float) $data['billable_amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseReportsResult(); + if (\array_key_exists('total_amount', $data) && \is_int($data['total_amount'])) { + $data['total_amount'] = (float) $data['total_amount']; + } + if (\array_key_exists('billable_amount', $data) && \is_int($data['billable_amount'])) { + $data['billable_amount'] = (float) $data['billable_amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { + $object->setClientName($data['client_name']); + unset($data['client_name']); + } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { + $object->setClientName(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { + $object->setProjectName($data['project_name']); + unset($data['project_name']); + } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { + $object->setProjectName(null); + } + if (\array_key_exists('expense_category_id', $data) && null !== $data['expense_category_id']) { + $object->setExpenseCategoryId($data['expense_category_id']); + unset($data['expense_category_id']); + } elseif (\array_key_exists('expense_category_id', $data) && null === $data['expense_category_id']) { + $object->setExpenseCategoryId(null); + } + if (\array_key_exists('expense_category_name', $data) && null !== $data['expense_category_name']) { + $object->setExpenseCategoryName($data['expense_category_name']); + unset($data['expense_category_name']); + } elseif (\array_key_exists('expense_category_name', $data) && null === $data['expense_category_name']) { + $object->setExpenseCategoryName(null); + } + if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { + $object->setUserId($data['user_id']); + unset($data['user_id']); + } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { + $object->setUserId(null); + } + if (\array_key_exists('user_name', $data) && null !== $data['user_name']) { + $object->setUserName($data['user_name']); + unset($data['user_name']); + } elseif (\array_key_exists('user_name', $data) && null === $data['user_name']) { + $object->setUserName(null); + } + if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { + $object->setIsContractor($data['is_contractor']); + unset($data['is_contractor']); + } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { + $object->setIsContractor(null); + } + if (\array_key_exists('total_amount', $data) && null !== $data['total_amount']) { + $object->setTotalAmount($data['total_amount']); + unset($data['total_amount']); + } elseif (\array_key_exists('total_amount', $data) && null === $data['total_amount']) { + $object->setTotalAmount(null); + } + if (\array_key_exists('billable_amount', $data) && null !== $data['billable_amount']) { + $object->setBillableAmount($data['billable_amount']); + unset($data['billable_amount']); + } elseif (\array_key_exists('billable_amount', $data) && null === $data['billable_amount']) { + $object->setBillableAmount(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { - $object->setClientName($data['client_name']); - unset($data['client_name']); - } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { - $object->setClientName(null); - } - if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { - $object->setProjectId($data['project_id']); - unset($data['project_id']); - } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { - $object->setProjectId(null); - } - if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { - $object->setProjectName($data['project_name']); - unset($data['project_name']); - } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { - $object->setProjectName(null); - } - if (\array_key_exists('expense_category_id', $data) && null !== $data['expense_category_id']) { - $object->setExpenseCategoryId($data['expense_category_id']); - unset($data['expense_category_id']); - } elseif (\array_key_exists('expense_category_id', $data) && null === $data['expense_category_id']) { - $object->setExpenseCategoryId(null); - } - if (\array_key_exists('expense_category_name', $data) && null !== $data['expense_category_name']) { - $object->setExpenseCategoryName($data['expense_category_name']); - unset($data['expense_category_name']); - } elseif (\array_key_exists('expense_category_name', $data) && null === $data['expense_category_name']) { - $object->setExpenseCategoryName(null); - } - if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { - $object->setUserId($data['user_id']); - unset($data['user_id']); - } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { - $object->setUserId(null); - } - if (\array_key_exists('user_name', $data) && null !== $data['user_name']) { - $object->setUserName($data['user_name']); - unset($data['user_name']); - } elseif (\array_key_exists('user_name', $data) && null === $data['user_name']) { - $object->setUserName(null); - } - if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { - $object->setIsContractor($data['is_contractor']); - unset($data['is_contractor']); - } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { - $object->setIsContractor(null); - } - if (\array_key_exists('total_amount', $data) && null !== $data['total_amount']) { - $object->setTotalAmount($data['total_amount']); - unset($data['total_amount']); - } elseif (\array_key_exists('total_amount', $data) && null === $data['total_amount']) { - $object->setTotalAmount(null); - } - if (\array_key_exists('billable_amount', $data) && null !== $data['billable_amount']) { - $object->setBillableAmount($data['billable_amount']); - unset($data['billable_amount']); - } elseif (\array_key_exists('billable_amount', $data) && null === $data['billable_amount']) { - $object->setBillableAmount(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('clientName') && null !== $object->getClientName()) { + $data['client_name'] = $object->getClientName(); + } + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { + $data['project_name'] = $object->getProjectName(); + } + if ($object->isInitialized('expenseCategoryId') && null !== $object->getExpenseCategoryId()) { + $data['expense_category_id'] = $object->getExpenseCategoryId(); + } + if ($object->isInitialized('expenseCategoryName') && null !== $object->getExpenseCategoryName()) { + $data['expense_category_name'] = $object->getExpenseCategoryName(); + } + if ($object->isInitialized('userId') && null !== $object->getUserId()) { + $data['user_id'] = $object->getUserId(); + } + if ($object->isInitialized('userName') && null !== $object->getUserName()) { + $data['user_name'] = $object->getUserName(); + } + if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { + $data['is_contractor'] = $object->getIsContractor(); + } + if ($object->isInitialized('totalAmount') && null !== $object->getTotalAmount()) { + $data['total_amount'] = $object->getTotalAmount(); + } + if ($object->isInitialized('billableAmount') && null !== $object->getBillableAmount()) { + $data['billable_amount'] = $object->getBillableAmount(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseReportsResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('clientName') && null !== $object->getClientName()) { - $data['client_name'] = $object->getClientName(); - } - if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { - $data['project_id'] = $object->getProjectId(); - } - if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { - $data['project_name'] = $object->getProjectName(); - } - if ($object->isInitialized('expenseCategoryId') && null !== $object->getExpenseCategoryId()) { - $data['expense_category_id'] = $object->getExpenseCategoryId(); - } - if ($object->isInitialized('expenseCategoryName') && null !== $object->getExpenseCategoryName()) { - $data['expense_category_name'] = $object->getExpenseCategoryName(); - } - if ($object->isInitialized('userId') && null !== $object->getUserId()) { - $data['user_id'] = $object->getUserId(); - } - if ($object->isInitialized('userName') && null !== $object->getUserName()) { - $data['user_name'] = $object->getUserName(); - } - if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { - $data['is_contractor'] = $object->getIsContractor(); - } - if ($object->isInitialized('totalAmount') && null !== $object->getTotalAmount()) { - $data['total_amount'] = $object->getTotalAmount(); - } - if ($object->isInitialized('billableAmount') && null !== $object->getBillableAmount()) { - $data['billable_amount'] = $object->getBillableAmount(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' === $type; } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseReportsResult(); + if (\array_key_exists('total_amount', $data) && \is_int($data['total_amount'])) { + $data['total_amount'] = (float) $data['total_amount']; + } + if (\array_key_exists('billable_amount', $data) && \is_int($data['billable_amount'])) { + $data['billable_amount'] = (float) $data['billable_amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { + $object->setClientName($data['client_name']); + unset($data['client_name']); + } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { + $object->setClientName(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { + $object->setProjectName($data['project_name']); + unset($data['project_name']); + } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { + $object->setProjectName(null); + } + if (\array_key_exists('expense_category_id', $data) && null !== $data['expense_category_id']) { + $object->setExpenseCategoryId($data['expense_category_id']); + unset($data['expense_category_id']); + } elseif (\array_key_exists('expense_category_id', $data) && null === $data['expense_category_id']) { + $object->setExpenseCategoryId(null); + } + if (\array_key_exists('expense_category_name', $data) && null !== $data['expense_category_name']) { + $object->setExpenseCategoryName($data['expense_category_name']); + unset($data['expense_category_name']); + } elseif (\array_key_exists('expense_category_name', $data) && null === $data['expense_category_name']) { + $object->setExpenseCategoryName(null); + } + if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { + $object->setUserId($data['user_id']); + unset($data['user_id']); + } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { + $object->setUserId(null); } + if (\array_key_exists('user_name', $data) && null !== $data['user_name']) { + $object->setUserName($data['user_name']); + unset($data['user_name']); + } elseif (\array_key_exists('user_name', $data) && null === $data['user_name']) { + $object->setUserName(null); + } + if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { + $object->setIsContractor($data['is_contractor']); + unset($data['is_contractor']); + } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { + $object->setIsContractor(null); + } + if (\array_key_exists('total_amount', $data) && null !== $data['total_amount']) { + $object->setTotalAmount($data['total_amount']); + unset($data['total_amount']); + } elseif (\array_key_exists('total_amount', $data) && null === $data['total_amount']) { + $object->setTotalAmount(null); + } + if (\array_key_exists('billable_amount', $data) && null !== $data['billable_amount']) { + $object->setBillableAmount($data['billable_amount']); + unset($data['billable_amount']); + } elseif (\array_key_exists('billable_amount', $data) && null === $data['billable_amount']) { + $object->setBillableAmount(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('clientName') && null !== $object->getClientName()) { + $data['client_name'] = $object->getClientName(); + } + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { + $data['project_name'] = $object->getProjectName(); + } + if ($object->isInitialized('expenseCategoryId') && null !== $object->getExpenseCategoryId()) { + $data['expense_category_id'] = $object->getExpenseCategoryId(); + } + if ($object->isInitialized('expenseCategoryName') && null !== $object->getExpenseCategoryName()) { + $data['expense_category_name'] = $object->getExpenseCategoryName(); + } + if ($object->isInitialized('userId') && null !== $object->getUserId()) { + $data['user_id'] = $object->getUserId(); + } + if ($object->isInitialized('userName') && null !== $object->getUserName()) { + $data['user_name'] = $object->getUserName(); + } + if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { + $data['is_contractor'] = $object->getIsContractor(); + } + if ($object->isInitialized('totalAmount') && null !== $object->getTotalAmount()) { + $data['total_amount'] = $object->getTotalAmount(); + } + if ($object->isInitialized('billableAmount') && null !== $object->getBillableAmount()) { + $data['billable_amount'] = $object->getBillableAmount(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' => false]; + } } } diff --git a/generated/Normalizer/ExpenseReportsResultsNormalizer.php b/generated/Normalizer/ExpenseReportsResultsNormalizer.php index 58fc10f..df22b43 100644 --- a/generated/Normalizer/ExpenseReportsResultsNormalizer.php +++ b/generated/Normalizer/ExpenseReportsResultsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseReportsResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseReportsResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseReportsResults(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseReportsResults(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('results', $data)) { + $values = []; + foreach ($data['results'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult', 'json', $context); + } + $object->setResults($values); + unset($data['results']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('results', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['results'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult', 'json', $context); + foreach ($object->getResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setResults($values); - unset($data['results']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['results'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseReportsResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getResults() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' === $data::class; } - $data['results'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseReportsResults(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('results', $data)) { + $values = []; + foreach ($data['results'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult', 'json', $context); + } + $object->setResults($values); + unset($data['results']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['results'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' => false]; + } } } diff --git a/generated/Normalizer/ExpenseUserNormalizer.php b/generated/Normalizer/ExpenseUserNormalizer.php index 5b8f3ea..a7f6865 100644 --- a/generated/Normalizer/ExpenseUserNormalizer.php +++ b/generated/Normalizer/ExpenseUserNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpenseUserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpenseUserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ExpenseUser(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseUser(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseUser' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpenseUserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpenseUser(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpenseUser' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpenseUser' => false]; + } } } diff --git a/generated/Normalizer/ExpensesExpenseIdPatchBodyNormalizer.php b/generated/Normalizer/ExpensesExpenseIdPatchBodyNormalizer.php index 27bbb0d..53a2313 100644 --- a/generated/Normalizer/ExpensesExpenseIdPatchBodyNormalizer.php +++ b/generated/Normalizer/ExpensesExpenseIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,155 +22,292 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpensesExpenseIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpensesExpenseIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\ExpensesExpenseIdPatchBody(); - if (\array_key_exists('total_cost', $data) && \is_int($data['total_cost'])) { - $data['total_cost'] = (float) $data['total_cost']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpensesExpenseIdPatchBody(); + if (\array_key_exists('total_cost', $data) && \is_int($data['total_cost'])) { + $data['total_cost'] = (float) $data['total_cost']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('expense_category_id', $data) && null !== $data['expense_category_id']) { + $object->setExpenseCategoryId($data['expense_category_id']); + unset($data['expense_category_id']); + } elseif (\array_key_exists('expense_category_id', $data) && null === $data['expense_category_id']) { + $object->setExpenseCategoryId(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('units', $data) && null !== $data['units']) { + $object->setUnits($data['units']); + unset($data['units']); + } elseif (\array_key_exists('units', $data) && null === $data['units']) { + $object->setUnits(null); + } + if (\array_key_exists('total_cost', $data) && null !== $data['total_cost']) { + $object->setTotalCost($data['total_cost']); + unset($data['total_cost']); + } elseif (\array_key_exists('total_cost', $data) && null === $data['total_cost']) { + $object->setTotalCost(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('receipt', $data) && null !== $data['receipt']) { + $object->setReceipt($data['receipt']); + unset($data['receipt']); + } elseif (\array_key_exists('receipt', $data) && null === $data['receipt']) { + $object->setReceipt(null); + } + if (\array_key_exists('delete_receipt', $data) && null !== $data['delete_receipt']) { + $object->setDeleteReceipt($data['delete_receipt']); + unset($data['delete_receipt']); + } elseif (\array_key_exists('delete_receipt', $data) && null === $data['delete_receipt']) { + $object->setDeleteReceipt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { - $object->setProjectId($data['project_id']); - unset($data['project_id']); - } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { - $object->setProjectId(null); - } - if (\array_key_exists('expense_category_id', $data) && null !== $data['expense_category_id']) { - $object->setExpenseCategoryId($data['expense_category_id']); - unset($data['expense_category_id']); - } elseif (\array_key_exists('expense_category_id', $data) && null === $data['expense_category_id']) { - $object->setExpenseCategoryId(null); - } - if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { - $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); - unset($data['spent_date']); - } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { - $object->setSpentDate(null); - } - if (\array_key_exists('units', $data) && null !== $data['units']) { - $object->setUnits($data['units']); - unset($data['units']); - } elseif (\array_key_exists('units', $data) && null === $data['units']) { - $object->setUnits(null); - } - if (\array_key_exists('total_cost', $data) && null !== $data['total_cost']) { - $object->setTotalCost($data['total_cost']); - unset($data['total_cost']); - } elseif (\array_key_exists('total_cost', $data) && null === $data['total_cost']) { - $object->setTotalCost(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('billable', $data) && null !== $data['billable']) { - $object->setBillable($data['billable']); - unset($data['billable']); - } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { - $object->setBillable(null); - } - if (\array_key_exists('receipt', $data) && null !== $data['receipt']) { - $object->setReceipt($data['receipt']); - unset($data['receipt']); - } elseif (\array_key_exists('receipt', $data) && null === $data['receipt']) { - $object->setReceipt(null); - } - if (\array_key_exists('delete_receipt', $data) && null !== $data['delete_receipt']) { - $object->setDeleteReceipt($data['delete_receipt']); - unset($data['delete_receipt']); - } elseif (\array_key_exists('delete_receipt', $data) && null === $data['delete_receipt']) { - $object->setDeleteReceipt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('expenseCategoryId') && null !== $object->getExpenseCategoryId()) { + $data['expense_category_id'] = $object->getExpenseCategoryId(); + } + if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + } + if ($object->isInitialized('units') && null !== $object->getUnits()) { + $data['units'] = $object->getUnits(); + } + if ($object->isInitialized('totalCost') && null !== $object->getTotalCost()) { + $data['total_cost'] = $object->getTotalCost(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { + $data['receipt'] = $object->getReceipt(); + } + if ($object->isInitialized('deleteReceipt') && null !== $object->getDeleteReceipt()) { + $data['delete_receipt'] = $object->getDeleteReceipt(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpensesExpenseIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { - $data['project_id'] = $object->getProjectId(); - } - if ($object->isInitialized('expenseCategoryId') && null !== $object->getExpenseCategoryId()) { - $data['expense_category_id'] = $object->getExpenseCategoryId(); - } - if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { - $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); - } - if ($object->isInitialized('units') && null !== $object->getUnits()) { - $data['units'] = $object->getUnits(); - } - if ($object->isInitialized('totalCost') && null !== $object->getTotalCost()) { - $data['total_cost'] = $object->getTotalCost(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('billable') && null !== $object->getBillable()) { - $data['billable'] = $object->getBillable(); - } - if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { - $data['receipt'] = $object->getReceipt(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' === $type; } - if ($object->isInitialized('deleteReceipt') && null !== $object->getDeleteReceipt()) { - $data['delete_receipt'] = $object->getDeleteReceipt(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpensesExpenseIdPatchBody(); + if (\array_key_exists('total_cost', $data) && \is_int($data['total_cost'])) { + $data['total_cost'] = (float) $data['total_cost']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('expense_category_id', $data) && null !== $data['expense_category_id']) { + $object->setExpenseCategoryId($data['expense_category_id']); + unset($data['expense_category_id']); + } elseif (\array_key_exists('expense_category_id', $data) && null === $data['expense_category_id']) { + $object->setExpenseCategoryId(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('units', $data) && null !== $data['units']) { + $object->setUnits($data['units']); + unset($data['units']); + } elseif (\array_key_exists('units', $data) && null === $data['units']) { + $object->setUnits(null); + } + if (\array_key_exists('total_cost', $data) && null !== $data['total_cost']) { + $object->setTotalCost($data['total_cost']); + unset($data['total_cost']); + } elseif (\array_key_exists('total_cost', $data) && null === $data['total_cost']) { + $object->setTotalCost(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('receipt', $data) && null !== $data['receipt']) { + $object->setReceipt($data['receipt']); + unset($data['receipt']); + } elseif (\array_key_exists('receipt', $data) && null === $data['receipt']) { + $object->setReceipt(null); + } + if (\array_key_exists('delete_receipt', $data) && null !== $data['delete_receipt']) { + $object->setDeleteReceipt($data['delete_receipt']); + unset($data['delete_receipt']); + } elseif (\array_key_exists('delete_receipt', $data) && null === $data['delete_receipt']) { + $object->setDeleteReceipt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('expenseCategoryId') && null !== $object->getExpenseCategoryId()) { + $data['expense_category_id'] = $object->getExpenseCategoryId(); + } + if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + } + if ($object->isInitialized('units') && null !== $object->getUnits()) { + $data['units'] = $object->getUnits(); + } + if ($object->isInitialized('totalCost') && null !== $object->getTotalCost()) { + $data['total_cost'] = $object->getTotalCost(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { + $data['receipt'] = $object->getReceipt(); + } + if ($object->isInitialized('deleteReceipt') && null !== $object->getDeleteReceipt()) { + $data['delete_receipt'] = $object->getDeleteReceipt(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/ExpensesNormalizer.php b/generated/Normalizer/ExpensesNormalizer.php index d5b29dc..6583f8a 100644 --- a/generated/Normalizer/ExpensesNormalizer.php +++ b/generated/Normalizer/ExpensesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpensesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Expenses' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpensesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Expenses' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Expenses' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Expenses' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Expenses(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Expenses(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('expenses', $data)) { + $values = []; + foreach ($data['expenses'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Expense', 'json', $context); + } + $object->setExpenses($values); + unset($data['expenses']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('expenses', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['expenses'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Expense', 'json', $context); + foreach ($object->getExpenses() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setExpenses($values); - unset($data['expenses']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['expenses'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Expenses' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpensesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getExpenses() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Expenses' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Expenses' === $data::class; } - $data['expenses'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Expenses(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('expenses', $data)) { + $values = []; + foreach ($data['expenses'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Expense', 'json', $context); + } + $object->setExpenses($values); + unset($data['expenses']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getExpenses() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['expenses'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Expenses' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Expenses' => false]; + } } } diff --git a/generated/Normalizer/ExpensesPostBodyNormalizer.php b/generated/Normalizer/ExpensesPostBodyNormalizer.php index 4c0ee87..25b7dbe 100644 --- a/generated/Normalizer/ExpensesPostBodyNormalizer.php +++ b/generated/Normalizer/ExpensesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,149 +22,280 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ExpensesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ExpensesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' === $type; } - $object = new \JoliCode\Harvest\Api\Model\ExpensesPostBody(); - if (\array_key_exists('total_cost', $data) && \is_int($data['total_cost'])) { - $data['total_cost'] = (float) $data['total_cost']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpensesPostBody(); + if (\array_key_exists('total_cost', $data) && \is_int($data['total_cost'])) { + $data['total_cost'] = (float) $data['total_cost']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { + $object->setUserId($data['user_id']); + unset($data['user_id']); + } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { + $object->setUserId(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('expense_category_id', $data) && null !== $data['expense_category_id']) { + $object->setExpenseCategoryId($data['expense_category_id']); + unset($data['expense_category_id']); + } elseif (\array_key_exists('expense_category_id', $data) && null === $data['expense_category_id']) { + $object->setExpenseCategoryId(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('units', $data) && null !== $data['units']) { + $object->setUnits($data['units']); + unset($data['units']); + } elseif (\array_key_exists('units', $data) && null === $data['units']) { + $object->setUnits(null); + } + if (\array_key_exists('total_cost', $data) && null !== $data['total_cost']) { + $object->setTotalCost($data['total_cost']); + unset($data['total_cost']); + } elseif (\array_key_exists('total_cost', $data) && null === $data['total_cost']) { + $object->setTotalCost(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('receipt', $data) && null !== $data['receipt']) { + $object->setReceipt($data['receipt']); + unset($data['receipt']); + } elseif (\array_key_exists('receipt', $data) && null === $data['receipt']) { + $object->setReceipt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { - $object->setUserId($data['user_id']); - unset($data['user_id']); - } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { - $object->setUserId(null); - } - if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { - $object->setProjectId($data['project_id']); - unset($data['project_id']); - } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { - $object->setProjectId(null); - } - if (\array_key_exists('expense_category_id', $data) && null !== $data['expense_category_id']) { - $object->setExpenseCategoryId($data['expense_category_id']); - unset($data['expense_category_id']); - } elseif (\array_key_exists('expense_category_id', $data) && null === $data['expense_category_id']) { - $object->setExpenseCategoryId(null); - } - if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { - $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); - unset($data['spent_date']); - } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { - $object->setSpentDate(null); - } - if (\array_key_exists('units', $data) && null !== $data['units']) { - $object->setUnits($data['units']); - unset($data['units']); - } elseif (\array_key_exists('units', $data) && null === $data['units']) { - $object->setUnits(null); - } - if (\array_key_exists('total_cost', $data) && null !== $data['total_cost']) { - $object->setTotalCost($data['total_cost']); - unset($data['total_cost']); - } elseif (\array_key_exists('total_cost', $data) && null === $data['total_cost']) { - $object->setTotalCost(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('billable', $data) && null !== $data['billable']) { - $object->setBillable($data['billable']); - unset($data['billable']); - } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { - $object->setBillable(null); - } - if (\array_key_exists('receipt', $data) && null !== $data['receipt']) { - $object->setReceipt($data['receipt']); - unset($data['receipt']); - } elseif (\array_key_exists('receipt', $data) && null === $data['receipt']) { - $object->setReceipt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('userId') && null !== $object->getUserId()) { + $data['user_id'] = $object->getUserId(); + } + $data['project_id'] = $object->getProjectId(); + $data['expense_category_id'] = $object->getExpenseCategoryId(); + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + if ($object->isInitialized('units') && null !== $object->getUnits()) { + $data['units'] = $object->getUnits(); + } + if ($object->isInitialized('totalCost') && null !== $object->getTotalCost()) { + $data['total_cost'] = $object->getTotalCost(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { + $data['receipt'] = $object->getReceipt(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ExpensesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('userId') && null !== $object->getUserId()) { - $data['user_id'] = $object->getUserId(); - } - $data['project_id'] = $object->getProjectId(); - $data['expense_category_id'] = $object->getExpenseCategoryId(); - $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); - if ($object->isInitialized('units') && null !== $object->getUnits()) { - $data['units'] = $object->getUnits(); - } - if ($object->isInitialized('totalCost') && null !== $object->getTotalCost()) { - $data['total_cost'] = $object->getTotalCost(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('billable') && null !== $object->getBillable()) { - $data['billable'] = $object->getBillable(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' === $type; } - if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { - $data['receipt'] = $object->getReceipt(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ExpensesPostBody(); + if (\array_key_exists('total_cost', $data) && \is_int($data['total_cost'])) { + $data['total_cost'] = (float) $data['total_cost']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { + $object->setUserId($data['user_id']); + unset($data['user_id']); + } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { + $object->setUserId(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('expense_category_id', $data) && null !== $data['expense_category_id']) { + $object->setExpenseCategoryId($data['expense_category_id']); + unset($data['expense_category_id']); + } elseif (\array_key_exists('expense_category_id', $data) && null === $data['expense_category_id']) { + $object->setExpenseCategoryId(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('units', $data) && null !== $data['units']) { + $object->setUnits($data['units']); + unset($data['units']); + } elseif (\array_key_exists('units', $data) && null === $data['units']) { + $object->setUnits(null); } + if (\array_key_exists('total_cost', $data) && null !== $data['total_cost']) { + $object->setTotalCost($data['total_cost']); + unset($data['total_cost']); + } elseif (\array_key_exists('total_cost', $data) && null === $data['total_cost']) { + $object->setTotalCost(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('receipt', $data) && null !== $data['receipt']) { + $object->setReceipt($data['receipt']); + unset($data['receipt']); + } elseif (\array_key_exists('receipt', $data) && null === $data['receipt']) { + $object->setReceipt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('userId') && null !== $object->getUserId()) { + $data['user_id'] = $object->getUserId(); + } + $data['project_id'] = $object->getProjectId(); + $data['expense_category_id'] = $object->getExpenseCategoryId(); + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + if ($object->isInitialized('units') && null !== $object->getUnits()) { + $data['units'] = $object->getUnits(); + } + if ($object->isInitialized('totalCost') && null !== $object->getTotalCost()) { + $data['total_cost'] = $object->getTotalCost(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('receipt') && null !== $object->getReceipt()) { + $data['receipt'] = $object->getReceipt(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' => false]; + } } } diff --git a/generated/Normalizer/InvoiceClientNormalizer.php b/generated/Normalizer/InvoiceClientNormalizer.php index 7e60b3e..ab4de76 100644 --- a/generated/Normalizer/InvoiceClientNormalizer.php +++ b/generated/Normalizer/InvoiceClientNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceClient(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceClient' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceClient' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceClient' => false]; + } } } diff --git a/generated/Normalizer/InvoiceCreatorNormalizer.php b/generated/Normalizer/InvoiceCreatorNormalizer.php index 98aeb64..ceb6cc9 100644 --- a/generated/Normalizer/InvoiceCreatorNormalizer.php +++ b/generated/Normalizer/InvoiceCreatorNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceCreatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceCreatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceCreator(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceCreator(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceCreatorNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceCreator(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' => false]; + } } } diff --git a/generated/Normalizer/InvoiceEstimateNormalizer.php b/generated/Normalizer/InvoiceEstimateNormalizer.php index 6228ef5..c03ea65 100644 --- a/generated/Normalizer/InvoiceEstimateNormalizer.php +++ b/generated/Normalizer/InvoiceEstimateNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,80 +22,142 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceEstimateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceEstimateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceEstimate(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceEstimate(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceEstimateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' === $type; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' === $data::class; + } + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceEstimate(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' => false]; + } } } diff --git a/generated/Normalizer/InvoiceItemCategoriesInvoiceItemCategoryIdPatchBodyNormalizer.php b/generated/Normalizer/InvoiceItemCategoriesInvoiceItemCategoryIdPatchBodyNormalizer.php index ea6ffb9..d781131 100644 --- a/generated/Normalizer/InvoiceItemCategoriesInvoiceItemCategoryIdPatchBodyNormalizer.php +++ b/generated/Normalizer/InvoiceItemCategoriesInvoiceItemCategoryIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,80 +22,142 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceItemCategoriesInvoiceItemCategoryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceItemCategoriesInvoiceItemCategoryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceItemCategoriesInvoiceItemCategoryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' === $type; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' === $data::class; + } + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/InvoiceItemCategoriesNormalizer.php b/generated/Normalizer/InvoiceItemCategoriesNormalizer.php index 5a0110d..158f54f 100644 --- a/generated/Normalizer/InvoiceItemCategoriesNormalizer.php +++ b/generated/Normalizer/InvoiceItemCategoriesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceItemCategoriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceItemCategoriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategories(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategories(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_item_categories', $data)) { + $values = []; + foreach ($data['invoice_item_categories'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory', 'json', $context); + } + $object->setInvoiceItemCategories($values); + unset($data['invoice_item_categories']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('invoice_item_categories', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['invoice_item_categories'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory', 'json', $context); + foreach ($object->getInvoiceItemCategories() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setInvoiceItemCategories($values); - unset($data['invoice_item_categories']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['invoice_item_categories'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceItemCategoriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getInvoiceItemCategories() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' === $data::class; } - $data['invoice_item_categories'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategories(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_item_categories', $data)) { + $values = []; + foreach ($data['invoice_item_categories'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory', 'json', $context); + } + $object->setInvoiceItemCategories($values); + unset($data['invoice_item_categories']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getInvoiceItemCategories() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['invoice_item_categories'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' => false]; + } } } diff --git a/generated/Normalizer/InvoiceItemCategoriesPostBodyNormalizer.php b/generated/Normalizer/InvoiceItemCategoriesPostBodyNormalizer.php index 9abaea7..71f9a22 100644 --- a/generated/Normalizer/InvoiceItemCategoriesPostBodyNormalizer.php +++ b/generated/Normalizer/InvoiceItemCategoriesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,78 +22,138 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceItemCategoriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceItemCategoriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategoriesPostBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategoriesPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['name'] = $object->getName(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceItemCategoriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['name'] = $object->getName(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' === $data::class; + } + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategoriesPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' => false]; + } } } diff --git a/generated/Normalizer/InvoiceItemCategoryNormalizer.php b/generated/Normalizer/InvoiceItemCategoryNormalizer.php index 36bcffb..0b0ae43 100644 --- a/generated/Normalizer/InvoiceItemCategoryNormalizer.php +++ b/generated/Normalizer/InvoiceItemCategoryNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,125 +22,232 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceItemCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceItemCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategory(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategory(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('use_as_service', $data) && null !== $data['use_as_service']) { + $object->setUseAsService($data['use_as_service']); + unset($data['use_as_service']); + } elseif (\array_key_exists('use_as_service', $data) && null === $data['use_as_service']) { + $object->setUseAsService(null); + } + if (\array_key_exists('use_as_expense', $data) && null !== $data['use_as_expense']) { + $object->setUseAsExpense($data['use_as_expense']); + unset($data['use_as_expense']); + } elseif (\array_key_exists('use_as_expense', $data) && null === $data['use_as_expense']) { + $object->setUseAsExpense(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('use_as_service', $data) && null !== $data['use_as_service']) { - $object->setUseAsService($data['use_as_service']); - unset($data['use_as_service']); - } elseif (\array_key_exists('use_as_service', $data) && null === $data['use_as_service']) { - $object->setUseAsService(null); - } - if (\array_key_exists('use_as_expense', $data) && null !== $data['use_as_expense']) { - $object->setUseAsExpense($data['use_as_expense']); - unset($data['use_as_expense']); - } elseif (\array_key_exists('use_as_expense', $data) && null === $data['use_as_expense']) { - $object->setUseAsExpense(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('useAsService') && null !== $object->getUseAsService()) { + $data['use_as_service'] = $object->getUseAsService(); + } + if ($object->isInitialized('useAsExpense') && null !== $object->getUseAsExpense()) { + $data['use_as_expense'] = $object->getUseAsExpense(); } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceItemCategoryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('useAsService') && null !== $object->getUseAsService()) { - $data['use_as_service'] = $object->getUseAsService(); - } - if ($object->isInitialized('useAsExpense') && null !== $object->getUseAsExpense()) { - $data['use_as_expense'] = $object->getUseAsExpense(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceItemCategory(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('use_as_service', $data) && null !== $data['use_as_service']) { + $object->setUseAsService($data['use_as_service']); + unset($data['use_as_service']); + } elseif (\array_key_exists('use_as_service', $data) && null === $data['use_as_service']) { + $object->setUseAsService(null); + } + if (\array_key_exists('use_as_expense', $data) && null !== $data['use_as_expense']) { + $object->setUseAsExpense($data['use_as_expense']); + unset($data['use_as_expense']); + } elseif (\array_key_exists('use_as_expense', $data) && null === $data['use_as_expense']) { + $object->setUseAsExpense(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('useAsService') && null !== $object->getUseAsService()) { + $data['use_as_service'] = $object->getUseAsService(); + } + if ($object->isInitialized('useAsExpense') && null !== $object->getUseAsExpense()) { + $data['use_as_expense'] = $object->getUseAsExpense(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' => false]; + } } } diff --git a/generated/Normalizer/InvoiceLineItemNormalizer.php b/generated/Normalizer/InvoiceLineItemNormalizer.php index fbf940e..59d2d90 100644 --- a/generated/Normalizer/InvoiceLineItemNormalizer.php +++ b/generated/Normalizer/InvoiceLineItemNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,161 +22,304 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceLineItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceLineItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\InvoiceLineItem(); - if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { - $data['quantity'] = (float) $data['quantity']; - } - if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { - $data['unit_price'] = (float) $data['unit_price']; - } - if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { - $data['amount'] = (float) $data['amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceLineItem(); + if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { + $data['quantity'] = (float) $data['quantity']; + } + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('kind', $data) && null !== $data['kind']) { + $object->setKind($data['kind']); + unset($data['kind']); + } elseif (\array_key_exists('kind', $data) && null === $data['kind']) { + $object->setKind(null); + } + if (\array_key_exists('description', $data) && null !== $data['description']) { + $object->setDescription($data['description']); + unset($data['description']); + } elseif (\array_key_exists('description', $data) && null === $data['description']) { + $object->setDescription(null); + } + if (\array_key_exists('quantity', $data) && null !== $data['quantity']) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); + } elseif (\array_key_exists('quantity', $data) && null === $data['quantity']) { + $object->setQuantity(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('taxed', $data) && null !== $data['taxed']) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } elseif (\array_key_exists('taxed', $data) && null === $data['taxed']) { + $object->setTaxed(null); + } + if (\array_key_exists('taxed2', $data) && null !== $data['taxed2']) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } elseif (\array_key_exists('taxed2', $data) && null === $data['taxed2']) { + $object->setTaxed2(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('project', $data) && null !== $data['project']) { - $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject', 'json', $context)); - unset($data['project']); - } elseif (\array_key_exists('project', $data) && null === $data['project']) { - $object->setProject(null); - } - if (\array_key_exists('kind', $data) && null !== $data['kind']) { - $object->setKind($data['kind']); - unset($data['kind']); - } elseif (\array_key_exists('kind', $data) && null === $data['kind']) { - $object->setKind(null); - } - if (\array_key_exists('description', $data) && null !== $data['description']) { - $object->setDescription($data['description']); - unset($data['description']); - } elseif (\array_key_exists('description', $data) && null === $data['description']) { - $object->setDescription(null); - } - if (\array_key_exists('quantity', $data) && null !== $data['quantity']) { - $object->setQuantity($data['quantity']); - unset($data['quantity']); - } elseif (\array_key_exists('quantity', $data) && null === $data['quantity']) { - $object->setQuantity(null); - } - if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { - $object->setUnitPrice($data['unit_price']); - unset($data['unit_price']); - } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { - $object->setUnitPrice(null); - } - if (\array_key_exists('amount', $data) && null !== $data['amount']) { - $object->setAmount($data['amount']); - unset($data['amount']); - } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { - $object->setAmount(null); - } - if (\array_key_exists('taxed', $data) && null !== $data['taxed']) { - $object->setTaxed($data['taxed']); - unset($data['taxed']); - } elseif (\array_key_exists('taxed', $data) && null === $data['taxed']) { - $object->setTaxed(null); - } - if (\array_key_exists('taxed2', $data) && null !== $data['taxed2']) { - $object->setTaxed2($data['taxed2']); - unset($data['taxed2']); - } elseif (\array_key_exists('taxed2', $data) && null === $data['taxed2']) { - $object->setTaxed2(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('kind') && null !== $object->getKind()) { + $data['kind'] = $object->getKind(); + } + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceLineItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('project') && null !== $object->getProject()) { - $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); - } - if ($object->isInitialized('kind') && null !== $object->getKind()) { - $data['kind'] = $object->getKind(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { - $data['unit_price'] = $object->getUnitPrice(); - } - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['amount'] = $object->getAmount(); - } - if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { - $data['taxed'] = $object->getTaxed(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' === $type; } - if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { - $data['taxed2'] = $object->getTaxed2(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceLineItem(); + if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { + $data['quantity'] = (float) $data['quantity']; + } + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('kind', $data) && null !== $data['kind']) { + $object->setKind($data['kind']); + unset($data['kind']); + } elseif (\array_key_exists('kind', $data) && null === $data['kind']) { + $object->setKind(null); + } + if (\array_key_exists('description', $data) && null !== $data['description']) { + $object->setDescription($data['description']); + unset($data['description']); + } elseif (\array_key_exists('description', $data) && null === $data['description']) { + $object->setDescription(null); } + if (\array_key_exists('quantity', $data) && null !== $data['quantity']) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); + } elseif (\array_key_exists('quantity', $data) && null === $data['quantity']) { + $object->setQuantity(null); + } + if (\array_key_exists('unit_price', $data) && null !== $data['unit_price']) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } elseif (\array_key_exists('unit_price', $data) && null === $data['unit_price']) { + $object->setUnitPrice(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('taxed', $data) && null !== $data['taxed']) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } elseif (\array_key_exists('taxed', $data) && null === $data['taxed']) { + $object->setTaxed(null); + } + if (\array_key_exists('taxed2', $data) && null !== $data['taxed2']) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } elseif (\array_key_exists('taxed2', $data) && null === $data['taxed2']) { + $object->setTaxed2(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('kind') && null !== $object->getKind()) { + $data['kind'] = $object->getKind(); + } + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' => false]; + } } } diff --git a/generated/Normalizer/InvoiceLineItemProjectNormalizer.php b/generated/Normalizer/InvoiceLineItemProjectNormalizer.php index cad1916..a6b711a 100644 --- a/generated/Normalizer/InvoiceLineItemProjectNormalizer.php +++ b/generated/Normalizer/InvoiceLineItemProjectNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,98 +22,178 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceLineItemProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceLineItemProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceLineItemProject(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceLineItemProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('code', $data) && null !== $data['code']) { - $object->setCode($data['code']); - unset($data['code']); - } elseif (\array_key_exists('code', $data) && null === $data['code']) { - $object->setCode(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceLineItemProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' === $type; } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceLineItemProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' => false]; + } } } diff --git a/generated/Normalizer/InvoiceLineItemsNormalizer.php b/generated/Normalizer/InvoiceLineItemsNormalizer.php index 7cf0419..f44f629 100644 --- a/generated/Normalizer/InvoiceLineItemsNormalizer.php +++ b/generated/Normalizer/InvoiceLineItemsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceLineItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceLineItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceLineItems(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceLineItems(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_line_items', $data)) { + $values = []; + foreach ($data['invoice_line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem', 'json', $context); + } + $object->setInvoiceLineItems($values); + unset($data['invoice_line_items']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('invoice_line_items', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['invoice_line_items'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem', 'json', $context); + foreach ($object->getInvoiceLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setInvoiceLineItems($values); - unset($data['invoice_line_items']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['invoice_line_items'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceLineItemsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getInvoiceLineItems() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' === $data::class; } - $data['invoice_line_items'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceLineItems(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_line_items', $data)) { + $values = []; + foreach ($data['invoice_line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem', 'json', $context); + } + $object->setInvoiceLineItems($values); + unset($data['invoice_line_items']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getInvoiceLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['invoice_line_items'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' => false]; + } } } diff --git a/generated/Normalizer/InvoiceMessageNormalizer.php b/generated/Normalizer/InvoiceMessageNormalizer.php index e60a60e..204ff85 100644 --- a/generated/Normalizer/InvoiceMessageNormalizer.php +++ b/generated/Normalizer/InvoiceMessageNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,232 +22,446 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceMessage(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceMessage(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('sent_by', $data) && null !== $data['sent_by']) { + $object->setSentBy($data['sent_by']); + unset($data['sent_by']); + } elseif (\array_key_exists('sent_by', $data) && null === $data['sent_by']) { + $object->setSentBy(null); + } + if (\array_key_exists('sent_by_email', $data) && null !== $data['sent_by_email']) { + $object->setSentByEmail($data['sent_by_email']); + unset($data['sent_by_email']); + } elseif (\array_key_exists('sent_by_email', $data) && null === $data['sent_by_email']) { + $object->setSentByEmail(null); + } + if (\array_key_exists('sent_from', $data) && null !== $data['sent_from']) { + $object->setSentFrom($data['sent_from']); + unset($data['sent_from']); + } elseif (\array_key_exists('sent_from', $data) && null === $data['sent_from']) { + $object->setSentFrom(null); + } + if (\array_key_exists('sent_from_email', $data) && null !== $data['sent_from_email']) { + $object->setSentFromEmail($data['sent_from_email']); + unset($data['sent_from_email']); + } elseif (\array_key_exists('sent_from_email', $data) && null === $data['sent_from_email']) { + $object->setSentFromEmail(null); + } + if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { + $values = []; + foreach ($data['recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient', 'json', $context); + } + $object->setRecipients($values); + unset($data['recipients']); + } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { + $object->setRecipients(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('body', $data) && null !== $data['body']) { + $object->setBody($data['body']); + unset($data['body']); + } elseif (\array_key_exists('body', $data) && null === $data['body']) { + $object->setBody(null); + } + if (\array_key_exists('include_link_to_client_invoice', $data) && null !== $data['include_link_to_client_invoice']) { + $object->setIncludeLinkToClientInvoice($data['include_link_to_client_invoice']); + unset($data['include_link_to_client_invoice']); + } elseif (\array_key_exists('include_link_to_client_invoice', $data) && null === $data['include_link_to_client_invoice']) { + $object->setIncludeLinkToClientInvoice(null); + } + if (\array_key_exists('attach_pdf', $data) && null !== $data['attach_pdf']) { + $object->setAttachPdf($data['attach_pdf']); + unset($data['attach_pdf']); + } elseif (\array_key_exists('attach_pdf', $data) && null === $data['attach_pdf']) { + $object->setAttachPdf(null); + } + if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { + $object->setSendMeACopy($data['send_me_a_copy']); + unset($data['send_me_a_copy']); + } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { + $object->setSendMeACopy(null); + } + if (\array_key_exists('thank_you', $data) && null !== $data['thank_you']) { + $object->setThankYou($data['thank_you']); + unset($data['thank_you']); + } elseif (\array_key_exists('thank_you', $data) && null === $data['thank_you']) { + $object->setThankYou(null); + } + if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { + $object->setEventType($data['event_type']); + unset($data['event_type']); + } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { + $object->setEventType(null); + } + if (\array_key_exists('reminder', $data) && null !== $data['reminder']) { + $object->setReminder($data['reminder']); + unset($data['reminder']); + } elseif (\array_key_exists('reminder', $data) && null === $data['reminder']) { + $object->setReminder(null); + } + if (\array_key_exists('send_reminder_on', $data) && null !== $data['send_reminder_on']) { + $object->setSendReminderOn(\DateTime::createFromFormat('Y-m-d', $data['send_reminder_on'])->setTime(0, 0, 0)); + unset($data['send_reminder_on']); + } elseif (\array_key_exists('send_reminder_on', $data) && null === $data['send_reminder_on']) { + $object->setSendReminderOn(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('sent_by', $data) && null !== $data['sent_by']) { - $object->setSentBy($data['sent_by']); - unset($data['sent_by']); - } elseif (\array_key_exists('sent_by', $data) && null === $data['sent_by']) { - $object->setSentBy(null); - } - if (\array_key_exists('sent_by_email', $data) && null !== $data['sent_by_email']) { - $object->setSentByEmail($data['sent_by_email']); - unset($data['sent_by_email']); - } elseif (\array_key_exists('sent_by_email', $data) && null === $data['sent_by_email']) { - $object->setSentByEmail(null); - } - if (\array_key_exists('sent_from', $data) && null !== $data['sent_from']) { - $object->setSentFrom($data['sent_from']); - unset($data['sent_from']); - } elseif (\array_key_exists('sent_from', $data) && null === $data['sent_from']) { - $object->setSentFrom(null); - } - if (\array_key_exists('sent_from_email', $data) && null !== $data['sent_from_email']) { - $object->setSentFromEmail($data['sent_from_email']); - unset($data['sent_from_email']); - } elseif (\array_key_exists('sent_from_email', $data) && null === $data['sent_from_email']) { - $object->setSentFromEmail(null); - } - if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { - $values = []; - foreach ($data['recipients'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient', 'json', $context); - } - $object->setRecipients($values); - unset($data['recipients']); - } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { - $object->setRecipients(null); - } - if (\array_key_exists('subject', $data) && null !== $data['subject']) { - $object->setSubject($data['subject']); - unset($data['subject']); - } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { - $object->setSubject(null); - } - if (\array_key_exists('body', $data) && null !== $data['body']) { - $object->setBody($data['body']); - unset($data['body']); - } elseif (\array_key_exists('body', $data) && null === $data['body']) { - $object->setBody(null); - } - if (\array_key_exists('include_link_to_client_invoice', $data) && null !== $data['include_link_to_client_invoice']) { - $object->setIncludeLinkToClientInvoice($data['include_link_to_client_invoice']); - unset($data['include_link_to_client_invoice']); - } elseif (\array_key_exists('include_link_to_client_invoice', $data) && null === $data['include_link_to_client_invoice']) { - $object->setIncludeLinkToClientInvoice(null); - } - if (\array_key_exists('attach_pdf', $data) && null !== $data['attach_pdf']) { - $object->setAttachPdf($data['attach_pdf']); - unset($data['attach_pdf']); - } elseif (\array_key_exists('attach_pdf', $data) && null === $data['attach_pdf']) { - $object->setAttachPdf(null); - } - if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { - $object->setSendMeACopy($data['send_me_a_copy']); - unset($data['send_me_a_copy']); - } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { - $object->setSendMeACopy(null); - } - if (\array_key_exists('thank_you', $data) && null !== $data['thank_you']) { - $object->setThankYou($data['thank_you']); - unset($data['thank_you']); - } elseif (\array_key_exists('thank_you', $data) && null === $data['thank_you']) { - $object->setThankYou(null); - } - if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { - $object->setEventType($data['event_type']); - unset($data['event_type']); - } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { - $object->setEventType(null); - } - if (\array_key_exists('reminder', $data) && null !== $data['reminder']) { - $object->setReminder($data['reminder']); - unset($data['reminder']); - } elseif (\array_key_exists('reminder', $data) && null === $data['reminder']) { - $object->setReminder(null); - } - if (\array_key_exists('send_reminder_on', $data) && null !== $data['send_reminder_on']) { - $object->setSendReminderOn(\DateTime::createFromFormat('Y-m-d', $data['send_reminder_on'])->setTime(0, 0, 0)); - unset($data['send_reminder_on']); - } elseif (\array_key_exists('send_reminder_on', $data) && null === $data['send_reminder_on']) { - $object->setSendReminderOn(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('sentBy') && null !== $object->getSentBy()) { + $data['sent_by'] = $object->getSentBy(); + } + if ($object->isInitialized('sentByEmail') && null !== $object->getSentByEmail()) { + $data['sent_by_email'] = $object->getSentByEmail(); + } + if ($object->isInitialized('sentFrom') && null !== $object->getSentFrom()) { + $data['sent_from'] = $object->getSentFrom(); + } + if ($object->isInitialized('sentFromEmail') && null !== $object->getSentFromEmail()) { + $data['sent_from_email'] = $object->getSentFromEmail(); + } + if ($object->isInitialized('recipients') && null !== $object->getRecipients()) { + $values = []; + foreach ($object->getRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['recipients'] = $values; + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('body') && null !== $object->getBody()) { + $data['body'] = $object->getBody(); + } + if ($object->isInitialized('includeLinkToClientInvoice') && null !== $object->getIncludeLinkToClientInvoice()) { + $data['include_link_to_client_invoice'] = $object->getIncludeLinkToClientInvoice(); + } + if ($object->isInitialized('attachPdf') && null !== $object->getAttachPdf()) { + $data['attach_pdf'] = $object->getAttachPdf(); + } + if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { + $data['send_me_a_copy'] = $object->getSendMeACopy(); + } + if ($object->isInitialized('thankYou') && null !== $object->getThankYou()) { + $data['thank_you'] = $object->getThankYou(); + } + if ($object->isInitialized('eventType') && null !== $object->getEventType()) { + $data['event_type'] = $object->getEventType(); + } + if ($object->isInitialized('reminder') && null !== $object->getReminder()) { + $data['reminder'] = $object->getReminder(); + } + if ($object->isInitialized('sendReminderOn') && null !== $object->getSendReminderOn()) { + $data['send_reminder_on'] = $object->getSendReminderOn()->format('Y-m-d'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('sentBy') && null !== $object->getSentBy()) { - $data['sent_by'] = $object->getSentBy(); - } - if ($object->isInitialized('sentByEmail') && null !== $object->getSentByEmail()) { - $data['sent_by_email'] = $object->getSentByEmail(); - } - if ($object->isInitialized('sentFrom') && null !== $object->getSentFrom()) { - $data['sent_from'] = $object->getSentFrom(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' === $type; } - if ($object->isInitialized('sentFromEmail') && null !== $object->getSentFromEmail()) { - $data['sent_from_email'] = $object->getSentFromEmail(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' === $data::class; } - if ($object->isInitialized('recipients') && null !== $object->getRecipients()) { - $values = []; - foreach ($object->getRecipients() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['recipients'] = $values; - } - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['subject'] = $object->getSubject(); - } - if ($object->isInitialized('body') && null !== $object->getBody()) { - $data['body'] = $object->getBody(); - } - if ($object->isInitialized('includeLinkToClientInvoice') && null !== $object->getIncludeLinkToClientInvoice()) { - $data['include_link_to_client_invoice'] = $object->getIncludeLinkToClientInvoice(); - } - if ($object->isInitialized('attachPdf') && null !== $object->getAttachPdf()) { - $data['attach_pdf'] = $object->getAttachPdf(); - } - if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { - $data['send_me_a_copy'] = $object->getSendMeACopy(); - } - if ($object->isInitialized('thankYou') && null !== $object->getThankYou()) { - $data['thank_you'] = $object->getThankYou(); - } - if ($object->isInitialized('eventType') && null !== $object->getEventType()) { - $data['event_type'] = $object->getEventType(); - } - if ($object->isInitialized('reminder') && null !== $object->getReminder()) { - $data['reminder'] = $object->getReminder(); - } - if ($object->isInitialized('sendReminderOn') && null !== $object->getSendReminderOn()) { - $data['send_reminder_on'] = $object->getSendReminderOn()->format('Y-m-d'); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceMessage(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('sent_by', $data) && null !== $data['sent_by']) { + $object->setSentBy($data['sent_by']); + unset($data['sent_by']); + } elseif (\array_key_exists('sent_by', $data) && null === $data['sent_by']) { + $object->setSentBy(null); + } + if (\array_key_exists('sent_by_email', $data) && null !== $data['sent_by_email']) { + $object->setSentByEmail($data['sent_by_email']); + unset($data['sent_by_email']); + } elseif (\array_key_exists('sent_by_email', $data) && null === $data['sent_by_email']) { + $object->setSentByEmail(null); + } + if (\array_key_exists('sent_from', $data) && null !== $data['sent_from']) { + $object->setSentFrom($data['sent_from']); + unset($data['sent_from']); + } elseif (\array_key_exists('sent_from', $data) && null === $data['sent_from']) { + $object->setSentFrom(null); + } + if (\array_key_exists('sent_from_email', $data) && null !== $data['sent_from_email']) { + $object->setSentFromEmail($data['sent_from_email']); + unset($data['sent_from_email']); + } elseif (\array_key_exists('sent_from_email', $data) && null === $data['sent_from_email']) { + $object->setSentFromEmail(null); + } + if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { + $values = []; + foreach ($data['recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient', 'json', $context); + } + $object->setRecipients($values); + unset($data['recipients']); + } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { + $object->setRecipients(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('body', $data) && null !== $data['body']) { + $object->setBody($data['body']); + unset($data['body']); + } elseif (\array_key_exists('body', $data) && null === $data['body']) { + $object->setBody(null); + } + if (\array_key_exists('include_link_to_client_invoice', $data) && null !== $data['include_link_to_client_invoice']) { + $object->setIncludeLinkToClientInvoice($data['include_link_to_client_invoice']); + unset($data['include_link_to_client_invoice']); + } elseif (\array_key_exists('include_link_to_client_invoice', $data) && null === $data['include_link_to_client_invoice']) { + $object->setIncludeLinkToClientInvoice(null); + } + if (\array_key_exists('attach_pdf', $data) && null !== $data['attach_pdf']) { + $object->setAttachPdf($data['attach_pdf']); + unset($data['attach_pdf']); + } elseif (\array_key_exists('attach_pdf', $data) && null === $data['attach_pdf']) { + $object->setAttachPdf(null); + } + if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { + $object->setSendMeACopy($data['send_me_a_copy']); + unset($data['send_me_a_copy']); + } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { + $object->setSendMeACopy(null); } + if (\array_key_exists('thank_you', $data) && null !== $data['thank_you']) { + $object->setThankYou($data['thank_you']); + unset($data['thank_you']); + } elseif (\array_key_exists('thank_you', $data) && null === $data['thank_you']) { + $object->setThankYou(null); + } + if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { + $object->setEventType($data['event_type']); + unset($data['event_type']); + } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { + $object->setEventType(null); + } + if (\array_key_exists('reminder', $data) && null !== $data['reminder']) { + $object->setReminder($data['reminder']); + unset($data['reminder']); + } elseif (\array_key_exists('reminder', $data) && null === $data['reminder']) { + $object->setReminder(null); + } + if (\array_key_exists('send_reminder_on', $data) && null !== $data['send_reminder_on']) { + $object->setSendReminderOn(\DateTime::createFromFormat('Y-m-d', $data['send_reminder_on'])->setTime(0, 0, 0)); + unset($data['send_reminder_on']); + } elseif (\array_key_exists('send_reminder_on', $data) && null === $data['send_reminder_on']) { + $object->setSendReminderOn(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('sentBy') && null !== $object->getSentBy()) { + $data['sent_by'] = $object->getSentBy(); + } + if ($object->isInitialized('sentByEmail') && null !== $object->getSentByEmail()) { + $data['sent_by_email'] = $object->getSentByEmail(); + } + if ($object->isInitialized('sentFrom') && null !== $object->getSentFrom()) { + $data['sent_from'] = $object->getSentFrom(); + } + if ($object->isInitialized('sentFromEmail') && null !== $object->getSentFromEmail()) { + $data['sent_from_email'] = $object->getSentFromEmail(); + } + if ($object->isInitialized('recipients') && null !== $object->getRecipients()) { + $values = []; + foreach ($object->getRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['recipients'] = $values; + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('body') && null !== $object->getBody()) { + $data['body'] = $object->getBody(); + } + if ($object->isInitialized('includeLinkToClientInvoice') && null !== $object->getIncludeLinkToClientInvoice()) { + $data['include_link_to_client_invoice'] = $object->getIncludeLinkToClientInvoice(); + } + if ($object->isInitialized('attachPdf') && null !== $object->getAttachPdf()) { + $data['attach_pdf'] = $object->getAttachPdf(); + } + if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { + $data['send_me_a_copy'] = $object->getSendMeACopy(); + } + if ($object->isInitialized('thankYou') && null !== $object->getThankYou()) { + $data['thank_you'] = $object->getThankYou(); + } + if ($object->isInitialized('eventType') && null !== $object->getEventType()) { + $data['event_type'] = $object->getEventType(); + } + if ($object->isInitialized('reminder') && null !== $object->getReminder()) { + $data['reminder'] = $object->getReminder(); + } + if ($object->isInitialized('sendReminderOn') && null !== $object->getSendReminderOn()) { + $data['send_reminder_on'] = $object->getSendReminderOn()->format('Y-m-d'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' => false]; + } } } diff --git a/generated/Normalizer/InvoiceMessageRecipientNormalizer.php b/generated/Normalizer/InvoiceMessageRecipientNormalizer.php index 83cacf0..52920c9 100644 --- a/generated/Normalizer/InvoiceMessageRecipientNormalizer.php +++ b/generated/Normalizer/InvoiceMessageRecipientNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceMessageRecipientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceMessageRecipientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceMessageRecipient(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceMessageRecipient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('email', $data) && null !== $data['email']) { - $object->setEmail($data['email']); - unset($data['email']); - } elseif (\array_key_exists('email', $data) && null === $data['email']) { - $object->setEmail(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceMessageRecipientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' === $type; } - if ($object->isInitialized('email') && null !== $object->getEmail()) { - $data['email'] = $object->getEmail(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceMessageRecipient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' => false]; + } } } diff --git a/generated/Normalizer/InvoiceMessageRecipientsNormalizer.php b/generated/Normalizer/InvoiceMessageRecipientsNormalizer.php index 5c996eb..cfd0dce 100644 --- a/generated/Normalizer/InvoiceMessageRecipientsNormalizer.php +++ b/generated/Normalizer/InvoiceMessageRecipientsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceMessageRecipientsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceMessageRecipientsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceMessageRecipients(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceMessageRecipients(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_message_recipients', $data)) { + $values = []; + foreach ($data['invoice_message_recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient', 'json', $context); + } + $object->setInvoiceMessageRecipients($values); + unset($data['invoice_message_recipients']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('invoice_message_recipients', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['invoice_message_recipients'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient', 'json', $context); + foreach ($object->getInvoiceMessageRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setInvoiceMessageRecipients($values); - unset($data['invoice_message_recipients']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['invoice_message_recipients'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceMessageRecipientsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getInvoiceMessageRecipients() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' === $data::class; } - $data['invoice_message_recipients'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceMessageRecipients(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_message_recipients', $data)) { + $values = []; + foreach ($data['invoice_message_recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient', 'json', $context); + } + $object->setInvoiceMessageRecipients($values); + unset($data['invoice_message_recipients']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getInvoiceMessageRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['invoice_message_recipients'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' => false]; + } } } diff --git a/generated/Normalizer/InvoiceMessageSubjectAndBodyNormalizer.php b/generated/Normalizer/InvoiceMessageSubjectAndBodyNormalizer.php index b0abd48..a14347b 100644 --- a/generated/Normalizer/InvoiceMessageSubjectAndBodyNormalizer.php +++ b/generated/Normalizer/InvoiceMessageSubjectAndBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,96 +22,174 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceMessageSubjectAndBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceMessageSubjectAndBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceMessageSubjectAndBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceMessageSubjectAndBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_id', $data)) { + $object->setInvoiceId($data['invoice_id']); + unset($data['invoice_id']); + } + if (\array_key_exists('subject', $data)) { + $object->setSubject($data['subject']); + unset($data['subject']); + } + if (\array_key_exists('body', $data)) { + $object->setBody($data['body']); + unset($data['body']); + } + if (\array_key_exists('reminder', $data)) { + $object->setReminder($data['reminder']); + unset($data['reminder']); + } + if (\array_key_exists('thank_you', $data)) { + $object->setThankYou($data['thank_you']); + unset($data['thank_you']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('invoice_id', $data)) { - $object->setInvoiceId($data['invoice_id']); - unset($data['invoice_id']); - } - if (\array_key_exists('subject', $data)) { - $object->setSubject($data['subject']); - unset($data['subject']); + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['invoice_id'] = $object->getInvoiceId(); + $data['subject'] = $object->getSubject(); + $data['body'] = $object->getBody(); + $data['reminder'] = $object->getReminder(); + $data['thank_you'] = $object->getThankYou(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - if (\array_key_exists('body', $data)) { - $object->setBody($data['body']); - unset($data['body']); + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' => false]; } - if (\array_key_exists('reminder', $data)) { - $object->setReminder($data['reminder']); - unset($data['reminder']); + } +} else { + class InvoiceMessageSubjectAndBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface + { + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' === $type; } - if (\array_key_exists('thank_you', $data)) { - $object->setThankYou($data['thank_you']); - unset($data['thank_you']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' === $data::class; } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceMessageSubjectAndBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_id', $data)) { + $object->setInvoiceId($data['invoice_id']); + unset($data['invoice_id']); + } + if (\array_key_exists('subject', $data)) { + $object->setSubject($data['subject']); + unset($data['subject']); + } + if (\array_key_exists('body', $data)) { + $object->setBody($data['body']); + unset($data['body']); + } + if (\array_key_exists('reminder', $data)) { + $object->setReminder($data['reminder']); + unset($data['reminder']); + } + if (\array_key_exists('thank_you', $data)) { + $object->setThankYou($data['thank_you']); + unset($data['thank_you']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } - } - return $object; - } + return $object; + } - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['invoice_id'] = $object->getInvoiceId(); - $data['subject'] = $object->getSubject(); - $data['body'] = $object->getBody(); - $data['reminder'] = $object->getReminder(); - $data['thank_you'] = $object->getThankYou(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['invoice_id'] = $object->getInvoiceId(); + $data['subject'] = $object->getSubject(); + $data['body'] = $object->getBody(); + $data['reminder'] = $object->getReminder(); + $data['thank_you'] = $object->getThankYou(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } - } - return $data; - } + return $data; + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' => false]; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' => false]; + } } } diff --git a/generated/Normalizer/InvoiceMessagesNormalizer.php b/generated/Normalizer/InvoiceMessagesNormalizer.php index 9a3b1c4..e8369fd 100644 --- a/generated/Normalizer/InvoiceMessagesNormalizer.php +++ b/generated/Normalizer/InvoiceMessagesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceMessagesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceMessagesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceMessages(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceMessages(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_messages', $data)) { + $values = []; + foreach ($data['invoice_messages'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage', 'json', $context); + } + $object->setInvoiceMessages($values); + unset($data['invoice_messages']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('invoice_messages', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['invoice_messages'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage', 'json', $context); + foreach ($object->getInvoiceMessages() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setInvoiceMessages($values); - unset($data['invoice_messages']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['invoice_messages'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceMessagesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getInvoiceMessages() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' === $data::class; } - $data['invoice_messages'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceMessages(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_messages', $data)) { + $values = []; + foreach ($data['invoice_messages'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage', 'json', $context); + } + $object->setInvoiceMessages($values); + unset($data['invoice_messages']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getInvoiceMessages() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['invoice_messages'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' => false]; + } } } diff --git a/generated/Normalizer/InvoiceNormalizer.php b/generated/Normalizer/InvoiceNormalizer.php index ee97959..95e3d27 100644 --- a/generated/Normalizer/InvoiceNormalizer.php +++ b/generated/Normalizer/InvoiceNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,417 +22,816 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Invoice' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Invoice' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\Invoice(); - if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { - $data['amount'] = (float) $data['amount']; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Invoice' === $type; } - if (\array_key_exists('due_amount', $data) && \is_int($data['due_amount'])) { - $data['due_amount'] = (float) $data['due_amount']; - } - if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { - $data['tax'] = (float) $data['tax']; - } - if (\array_key_exists('tax_amount', $data) && \is_int($data['tax_amount'])) { - $data['tax_amount'] = (float) $data['tax_amount']; - } - if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { - $data['tax2'] = (float) $data['tax2']; - } - if (\array_key_exists('tax2_amount', $data) && \is_int($data['tax2_amount'])) { - $data['tax2_amount'] = (float) $data['tax2_amount']; - } - if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { - $data['discount'] = (float) $data['discount']; - } - if (\array_key_exists('discount_amount', $data) && \is_int($data['discount_amount'])) { - $data['discount_amount'] = (float) $data['discount_amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Invoice' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Invoice(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (\array_key_exists('due_amount', $data) && \is_int($data['due_amount'])) { + $data['due_amount'] = (float) $data['due_amount']; + } + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax_amount', $data) && \is_int($data['tax_amount'])) { + $data['tax_amount'] = (float) $data['tax_amount']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('tax2_amount', $data) && \is_int($data['tax2_amount'])) { + $data['tax2_amount'] = (float) $data['tax2_amount']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (\array_key_exists('discount_amount', $data) && \is_int($data['discount_amount'])) { + $data['discount_amount'] = (float) $data['discount_amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values = []; + foreach ($data['line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem', 'json', $context); + } + $object->setLineItems($values); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + if (\array_key_exists('estimate', $data) && null !== $data['estimate']) { + $object->setEstimate($this->denormalizer->denormalize($data['estimate'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate', 'json', $context)); + unset($data['estimate']); + } elseif (\array_key_exists('estimate', $data) && null === $data['estimate']) { + $object->setEstimate(null); + } + if (\array_key_exists('retainer', $data) && null !== $data['retainer']) { + $object->setRetainer($this->denormalizer->denormalize($data['retainer'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer', 'json', $context)); + unset($data['retainer']); + } elseif (\array_key_exists('retainer', $data) && null === $data['retainer']) { + $object->setRetainer(null); + } + if (\array_key_exists('creator', $data) && null !== $data['creator']) { + $object->setCreator($this->denormalizer->denormalize($data['creator'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator', 'json', $context)); + unset($data['creator']); + } elseif (\array_key_exists('creator', $data) && null === $data['creator']) { + $object->setCreator(null); + } + if (\array_key_exists('client_key', $data) && null !== $data['client_key']) { + $object->setClientKey($data['client_key']); + unset($data['client_key']); + } elseif (\array_key_exists('client_key', $data) && null === $data['client_key']) { + $object->setClientKey(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('due_amount', $data) && null !== $data['due_amount']) { + $object->setDueAmount($data['due_amount']); + unset($data['due_amount']); + } elseif (\array_key_exists('due_amount', $data) && null === $data['due_amount']) { + $object->setDueAmount(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax_amount', $data) && null !== $data['tax_amount']) { + $object->setTaxAmount($data['tax_amount']); + unset($data['tax_amount']); + } elseif (\array_key_exists('tax_amount', $data) && null === $data['tax_amount']) { + $object->setTaxAmount(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); + } + if (\array_key_exists('tax2_amount', $data) && null !== $data['tax2_amount']) { + $object->setTax2Amount($data['tax2_amount']); + unset($data['tax2_amount']); + } elseif (\array_key_exists('tax2_amount', $data) && null === $data['tax2_amount']) { + $object->setTax2Amount(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); + } + if (\array_key_exists('discount_amount', $data) && null !== $data['discount_amount']) { + $object->setDiscountAmount($data['discount_amount']); + unset($data['discount_amount']); + } elseif (\array_key_exists('discount_amount', $data) && null === $data['discount_amount']) { + $object->setDiscountAmount(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('state', $data) && null !== $data['state']) { + $object->setState($data['state']); + unset($data['state']); + } elseif (\array_key_exists('state', $data) && null === $data['state']) { + $object->setState(null); + } + if (\array_key_exists('period_start', $data) && null !== $data['period_start']) { + $object->setPeriodStart(\DateTime::createFromFormat('Y-m-d', $data['period_start'])->setTime(0, 0, 0)); + unset($data['period_start']); + } elseif (\array_key_exists('period_start', $data) && null === $data['period_start']) { + $object->setPeriodStart(null); + } + if (\array_key_exists('period_end', $data) && null !== $data['period_end']) { + $object->setPeriodEnd(\DateTime::createFromFormat('Y-m-d', $data['period_end'])->setTime(0, 0, 0)); + unset($data['period_end']); + } elseif (\array_key_exists('period_end', $data) && null === $data['period_end']) { + $object->setPeriodEnd(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('due_date', $data) && null !== $data['due_date']) { + $object->setDueDate(\DateTime::createFromFormat('Y-m-d', $data['due_date'])->setTime(0, 0, 0)); + unset($data['due_date']); + } elseif (\array_key_exists('due_date', $data) && null === $data['due_date']) { + $object->setDueDate(null); + } + if (\array_key_exists('payment_term', $data) && null !== $data['payment_term']) { + $object->setPaymentTerm($data['payment_term']); + unset($data['payment_term']); + } elseif (\array_key_exists('payment_term', $data) && null === $data['payment_term']) { + $object->setPaymentTerm(null); + } + if (\array_key_exists('payment_options', $data) && null !== $data['payment_options']) { + $values_1 = []; + foreach ($data['payment_options'] as $value_1) { + $values_1[] = $value_1; + } + $object->setPaymentOptions($values_1); + unset($data['payment_options']); + } elseif (\array_key_exists('payment_options', $data) && null === $data['payment_options']) { + $object->setPaymentOptions(null); + } + if (\array_key_exists('sent_at', $data) && null !== $data['sent_at']) { + $object->setSentAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['sent_at'])); + unset($data['sent_at']); + } elseif (\array_key_exists('sent_at', $data) && null === $data['sent_at']) { + $object->setSentAt(null); + } + if (\array_key_exists('paid_at', $data) && null !== $data['paid_at']) { + $object->setPaidAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['paid_at'])); + unset($data['paid_at']); + } elseif (\array_key_exists('paid_at', $data) && null === $data['paid_at']) { + $object->setPaidAt(null); + } + if (\array_key_exists('paid_date', $data) && null !== $data['paid_date']) { + $object->setPaidDate(\DateTime::createFromFormat('Y-m-d', $data['paid_date'])->setTime(0, 0, 0)); + unset($data['paid_date']); + } elseif (\array_key_exists('paid_date', $data) && null === $data['paid_date']) { + $object->setPaidDate(null); + } + if (\array_key_exists('closed_at', $data) && null !== $data['closed_at']) { + $object->setClosedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['closed_at'])); + unset($data['closed_at']); + } elseif (\array_key_exists('closed_at', $data) && null === $data['closed_at']) { + $object->setClosedAt(null); + } + if (\array_key_exists('recurring_invoice_id', $data) && null !== $data['recurring_invoice_id']) { + $object->setRecurringInvoiceId($data['recurring_invoice_id']); + unset($data['recurring_invoice_id']); + } elseif (\array_key_exists('recurring_invoice_id', $data) && null === $data['recurring_invoice_id']) { + $object->setRecurringInvoiceId(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('client', $data) && null !== $data['client']) { - $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient', 'json', $context)); - unset($data['client']); - } elseif (\array_key_exists('client', $data) && null === $data['client']) { - $object->setClient(null); - } - if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { - $values = []; - foreach ($data['line_items'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem', 'json', $context); - } - $object->setLineItems($values); - unset($data['line_items']); - } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { - $object->setLineItems(null); - } - if (\array_key_exists('estimate', $data) && null !== $data['estimate']) { - $object->setEstimate($this->denormalizer->denormalize($data['estimate'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate', 'json', $context)); - unset($data['estimate']); - } elseif (\array_key_exists('estimate', $data) && null === $data['estimate']) { - $object->setEstimate(null); - } - if (\array_key_exists('retainer', $data) && null !== $data['retainer']) { - $object->setRetainer($this->denormalizer->denormalize($data['retainer'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer', 'json', $context)); - unset($data['retainer']); - } elseif (\array_key_exists('retainer', $data) && null === $data['retainer']) { - $object->setRetainer(null); - } - if (\array_key_exists('creator', $data) && null !== $data['creator']) { - $object->setCreator($this->denormalizer->denormalize($data['creator'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator', 'json', $context)); - unset($data['creator']); - } elseif (\array_key_exists('creator', $data) && null === $data['creator']) { - $object->setCreator(null); - } - if (\array_key_exists('client_key', $data) && null !== $data['client_key']) { - $object->setClientKey($data['client_key']); - unset($data['client_key']); - } elseif (\array_key_exists('client_key', $data) && null === $data['client_key']) { - $object->setClientKey(null); - } - if (\array_key_exists('number', $data) && null !== $data['number']) { - $object->setNumber($data['number']); - unset($data['number']); - } elseif (\array_key_exists('number', $data) && null === $data['number']) { - $object->setNumber(null); - } - if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { - $object->setPurchaseOrder($data['purchase_order']); - unset($data['purchase_order']); - } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { - $object->setPurchaseOrder(null); - } - if (\array_key_exists('amount', $data) && null !== $data['amount']) { - $object->setAmount($data['amount']); - unset($data['amount']); - } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { - $object->setAmount(null); - } - if (\array_key_exists('due_amount', $data) && null !== $data['due_amount']) { - $object->setDueAmount($data['due_amount']); - unset($data['due_amount']); - } elseif (\array_key_exists('due_amount', $data) && null === $data['due_amount']) { - $object->setDueAmount(null); - } - if (\array_key_exists('tax', $data) && null !== $data['tax']) { - $object->setTax($data['tax']); - unset($data['tax']); - } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { - $object->setTax(null); - } - if (\array_key_exists('tax_amount', $data) && null !== $data['tax_amount']) { - $object->setTaxAmount($data['tax_amount']); - unset($data['tax_amount']); - } elseif (\array_key_exists('tax_amount', $data) && null === $data['tax_amount']) { - $object->setTaxAmount(null); - } - if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { - $object->setTax2($data['tax2']); - unset($data['tax2']); - } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { - $object->setTax2(null); - } - if (\array_key_exists('tax2_amount', $data) && null !== $data['tax2_amount']) { - $object->setTax2Amount($data['tax2_amount']); - unset($data['tax2_amount']); - } elseif (\array_key_exists('tax2_amount', $data) && null === $data['tax2_amount']) { - $object->setTax2Amount(null); - } - if (\array_key_exists('discount', $data) && null !== $data['discount']) { - $object->setDiscount($data['discount']); - unset($data['discount']); - } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { - $object->setDiscount(null); - } - if (\array_key_exists('discount_amount', $data) && null !== $data['discount_amount']) { - $object->setDiscountAmount($data['discount_amount']); - unset($data['discount_amount']); - } elseif (\array_key_exists('discount_amount', $data) && null === $data['discount_amount']) { - $object->setDiscountAmount(null); - } - if (\array_key_exists('subject', $data) && null !== $data['subject']) { - $object->setSubject($data['subject']); - unset($data['subject']); - } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { - $object->setSubject(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - if (\array_key_exists('state', $data) && null !== $data['state']) { - $object->setState($data['state']); - unset($data['state']); - } elseif (\array_key_exists('state', $data) && null === $data['state']) { - $object->setState(null); - } - if (\array_key_exists('period_start', $data) && null !== $data['period_start']) { - $object->setPeriodStart(\DateTime::createFromFormat('Y-m-d', $data['period_start'])->setTime(0, 0, 0)); - unset($data['period_start']); - } elseif (\array_key_exists('period_start', $data) && null === $data['period_start']) { - $object->setPeriodStart(null); - } - if (\array_key_exists('period_end', $data) && null !== $data['period_end']) { - $object->setPeriodEnd(\DateTime::createFromFormat('Y-m-d', $data['period_end'])->setTime(0, 0, 0)); - unset($data['period_end']); - } elseif (\array_key_exists('period_end', $data) && null === $data['period_end']) { - $object->setPeriodEnd(null); - } - if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { - $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); - unset($data['issue_date']); - } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { - $object->setIssueDate(null); - } - if (\array_key_exists('due_date', $data) && null !== $data['due_date']) { - $object->setDueDate(\DateTime::createFromFormat('Y-m-d', $data['due_date'])->setTime(0, 0, 0)); - unset($data['due_date']); - } elseif (\array_key_exists('due_date', $data) && null === $data['due_date']) { - $object->setDueDate(null); - } - if (\array_key_exists('payment_term', $data) && null !== $data['payment_term']) { - $object->setPaymentTerm($data['payment_term']); - unset($data['payment_term']); - } elseif (\array_key_exists('payment_term', $data) && null === $data['payment_term']) { - $object->setPaymentTerm(null); - } - if (\array_key_exists('payment_options', $data) && null !== $data['payment_options']) { - $values_1 = []; - foreach ($data['payment_options'] as $value_1) { - $values_1[] = $value_1; - } - $object->setPaymentOptions($values_1); - unset($data['payment_options']); - } elseif (\array_key_exists('payment_options', $data) && null === $data['payment_options']) { - $object->setPaymentOptions(null); - } - if (\array_key_exists('sent_at', $data) && null !== $data['sent_at']) { - $object->setSentAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['sent_at'])); - unset($data['sent_at']); - } elseif (\array_key_exists('sent_at', $data) && null === $data['sent_at']) { - $object->setSentAt(null); - } - if (\array_key_exists('paid_at', $data) && null !== $data['paid_at']) { - $object->setPaidAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['paid_at'])); - unset($data['paid_at']); - } elseif (\array_key_exists('paid_at', $data) && null === $data['paid_at']) { - $object->setPaidAt(null); - } - if (\array_key_exists('paid_date', $data) && null !== $data['paid_date']) { - $object->setPaidDate(\DateTime::createFromFormat('Y-m-d', $data['paid_date'])->setTime(0, 0, 0)); - unset($data['paid_date']); - } elseif (\array_key_exists('paid_date', $data) && null === $data['paid_date']) { - $object->setPaidDate(null); - } - if (\array_key_exists('closed_at', $data) && null !== $data['closed_at']) { - $object->setClosedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['closed_at'])); - unset($data['closed_at']); - } elseif (\array_key_exists('closed_at', $data) && null === $data['closed_at']) { - $object->setClosedAt(null); - } - if (\array_key_exists('recurring_invoice_id', $data) && null !== $data['recurring_invoice_id']) { - $object->setRecurringInvoiceId($data['recurring_invoice_id']); - unset($data['recurring_invoice_id']); - } elseif (\array_key_exists('recurring_invoice_id', $data) && null === $data['recurring_invoice_id']) { - $object->setRecurringInvoiceId(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values = []; + foreach ($object->getLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['line_items'] = $values; + } + if ($object->isInitialized('estimate') && null !== $object->getEstimate()) { + $data['estimate'] = $this->normalizer->normalize($object->getEstimate(), 'json', $context); + } + if ($object->isInitialized('retainer') && null !== $object->getRetainer()) { + $data['retainer'] = $this->normalizer->normalize($object->getRetainer(), 'json', $context); + } + if ($object->isInitialized('creator') && null !== $object->getCreator()) { + $data['creator'] = $this->normalizer->normalize($object->getCreator(), 'json', $context); + } + if ($object->isInitialized('clientKey') && null !== $object->getClientKey()) { + $data['client_key'] = $object->getClientKey(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('dueAmount') && null !== $object->getDueAmount()) { + $data['due_amount'] = $object->getDueAmount(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('taxAmount') && null !== $object->getTaxAmount()) { + $data['tax_amount'] = $object->getTaxAmount(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('tax2Amount') && null !== $object->getTax2Amount()) { + $data['tax2_amount'] = $object->getTax2Amount(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('discountAmount') && null !== $object->getDiscountAmount()) { + $data['discount_amount'] = $object->getDiscountAmount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('state') && null !== $object->getState()) { + $data['state'] = $object->getState(); + } + if ($object->isInitialized('periodStart') && null !== $object->getPeriodStart()) { + $data['period_start'] = $object->getPeriodStart()->format('Y-m-d'); + } + if ($object->isInitialized('periodEnd') && null !== $object->getPeriodEnd()) { + $data['period_end'] = $object->getPeriodEnd()->format('Y-m-d'); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('dueDate') && null !== $object->getDueDate()) { + $data['due_date'] = $object->getDueDate()->format('Y-m-d'); + } + if ($object->isInitialized('paymentTerm') && null !== $object->getPaymentTerm()) { + $data['payment_term'] = $object->getPaymentTerm(); + } + if ($object->isInitialized('paymentOptions') && null !== $object->getPaymentOptions()) { + $values_1 = []; + foreach ($object->getPaymentOptions() as $value_1) { + $values_1[] = $value_1; + } + $data['payment_options'] = $values_1; + } + if ($object->isInitialized('sentAt') && null !== $object->getSentAt()) { + $data['sent_at'] = $object->getSentAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('paidAt') && null !== $object->getPaidAt()) { + $data['paid_at'] = $object->getPaidAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('paidDate') && null !== $object->getPaidDate()) { + $data['paid_date'] = $object->getPaidDate()->format('Y-m-d'); + } + if ($object->isInitialized('closedAt') && null !== $object->getClosedAt()) { + $data['closed_at'] = $object->getClosedAt()->format('Y-m-d\\TH:i:s\\Z'); } + if ($object->isInitialized('recurringInvoiceId') && null !== $object->getRecurringInvoiceId()) { + $data['recurring_invoice_id'] = $object->getRecurringInvoiceId(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Invoice' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Invoice' === $type; } - if ($object->isInitialized('client') && null !== $object->getClient()) { - $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Invoice' === $data::class; } - if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { - $values = []; - foreach ($object->getLineItems() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['line_items'] = $values; - } - if ($object->isInitialized('estimate') && null !== $object->getEstimate()) { - $data['estimate'] = $this->normalizer->normalize($object->getEstimate(), 'json', $context); - } - if ($object->isInitialized('retainer') && null !== $object->getRetainer()) { - $data['retainer'] = $this->normalizer->normalize($object->getRetainer(), 'json', $context); - } - if ($object->isInitialized('creator') && null !== $object->getCreator()) { - $data['creator'] = $this->normalizer->normalize($object->getCreator(), 'json', $context); - } - if ($object->isInitialized('clientKey') && null !== $object->getClientKey()) { - $data['client_key'] = $object->getClientKey(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); - } - if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { - $data['purchase_order'] = $object->getPurchaseOrder(); - } - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['amount'] = $object->getAmount(); - } - if ($object->isInitialized('dueAmount') && null !== $object->getDueAmount()) { - $data['due_amount'] = $object->getDueAmount(); - } - if ($object->isInitialized('tax') && null !== $object->getTax()) { - $data['tax'] = $object->getTax(); - } - if ($object->isInitialized('taxAmount') && null !== $object->getTaxAmount()) { - $data['tax_amount'] = $object->getTaxAmount(); - } - if ($object->isInitialized('tax2') && null !== $object->getTax2()) { - $data['tax2'] = $object->getTax2(); - } - if ($object->isInitialized('tax2Amount') && null !== $object->getTax2Amount()) { - $data['tax2_amount'] = $object->getTax2Amount(); - } - if ($object->isInitialized('discount') && null !== $object->getDiscount()) { - $data['discount'] = $object->getDiscount(); - } - if ($object->isInitialized('discountAmount') && null !== $object->getDiscountAmount()) { - $data['discount_amount'] = $object->getDiscountAmount(); - } - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['subject'] = $object->getSubject(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); - } - if ($object->isInitialized('state') && null !== $object->getState()) { - $data['state'] = $object->getState(); - } - if ($object->isInitialized('periodStart') && null !== $object->getPeriodStart()) { - $data['period_start'] = $object->getPeriodStart()->format('Y-m-d'); - } - if ($object->isInitialized('periodEnd') && null !== $object->getPeriodEnd()) { - $data['period_end'] = $object->getPeriodEnd()->format('Y-m-d'); - } - if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { - $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); - } - if ($object->isInitialized('dueDate') && null !== $object->getDueDate()) { - $data['due_date'] = $object->getDueDate()->format('Y-m-d'); - } - if ($object->isInitialized('paymentTerm') && null !== $object->getPaymentTerm()) { - $data['payment_term'] = $object->getPaymentTerm(); - } - if ($object->isInitialized('paymentOptions') && null !== $object->getPaymentOptions()) { - $values_1 = []; - foreach ($object->getPaymentOptions() as $value_1) { - $values_1[] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - $data['payment_options'] = $values_1; - } - if ($object->isInitialized('sentAt') && null !== $object->getSentAt()) { - $data['sent_at'] = $object->getSentAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('paidAt') && null !== $object->getPaidAt()) { - $data['paid_at'] = $object->getPaidAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('paidDate') && null !== $object->getPaidDate()) { - $data['paid_date'] = $object->getPaidDate()->format('Y-m-d'); - } - if ($object->isInitialized('closedAt') && null !== $object->getClosedAt()) { - $data['closed_at'] = $object->getClosedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('recurringInvoiceId') && null !== $object->getRecurringInvoiceId()) { - $data['recurring_invoice_id'] = $object->getRecurringInvoiceId(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; + $object = new \JoliCode\Harvest\Api\Model\Invoice(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (\array_key_exists('due_amount', $data) && \is_int($data['due_amount'])) { + $data['due_amount'] = (float) $data['due_amount']; + } + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax_amount', $data) && \is_int($data['tax_amount'])) { + $data['tax_amount'] = (float) $data['tax_amount']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('tax2_amount', $data) && \is_int($data['tax2_amount'])) { + $data['tax2_amount'] = (float) $data['tax2_amount']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (\array_key_exists('discount_amount', $data) && \is_int($data['discount_amount'])) { + $data['discount_amount'] = (float) $data['discount_amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values = []; + foreach ($data['line_items'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem', 'json', $context); + } + $object->setLineItems($values); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + if (\array_key_exists('estimate', $data) && null !== $data['estimate']) { + $object->setEstimate($this->denormalizer->denormalize($data['estimate'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate', 'json', $context)); + unset($data['estimate']); + } elseif (\array_key_exists('estimate', $data) && null === $data['estimate']) { + $object->setEstimate(null); + } + if (\array_key_exists('retainer', $data) && null !== $data['retainer']) { + $object->setRetainer($this->denormalizer->denormalize($data['retainer'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer', 'json', $context)); + unset($data['retainer']); + } elseif (\array_key_exists('retainer', $data) && null === $data['retainer']) { + $object->setRetainer(null); + } + if (\array_key_exists('creator', $data) && null !== $data['creator']) { + $object->setCreator($this->denormalizer->denormalize($data['creator'], 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator', 'json', $context)); + unset($data['creator']); + } elseif (\array_key_exists('creator', $data) && null === $data['creator']) { + $object->setCreator(null); + } + if (\array_key_exists('client_key', $data) && null !== $data['client_key']) { + $object->setClientKey($data['client_key']); + unset($data['client_key']); + } elseif (\array_key_exists('client_key', $data) && null === $data['client_key']) { + $object->setClientKey(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('due_amount', $data) && null !== $data['due_amount']) { + $object->setDueAmount($data['due_amount']); + unset($data['due_amount']); + } elseif (\array_key_exists('due_amount', $data) && null === $data['due_amount']) { + $object->setDueAmount(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax_amount', $data) && null !== $data['tax_amount']) { + $object->setTaxAmount($data['tax_amount']); + unset($data['tax_amount']); + } elseif (\array_key_exists('tax_amount', $data) && null === $data['tax_amount']) { + $object->setTaxAmount(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); } + if (\array_key_exists('tax2_amount', $data) && null !== $data['tax2_amount']) { + $object->setTax2Amount($data['tax2_amount']); + unset($data['tax2_amount']); + } elseif (\array_key_exists('tax2_amount', $data) && null === $data['tax2_amount']) { + $object->setTax2Amount(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); + } + if (\array_key_exists('discount_amount', $data) && null !== $data['discount_amount']) { + $object->setDiscountAmount($data['discount_amount']); + unset($data['discount_amount']); + } elseif (\array_key_exists('discount_amount', $data) && null === $data['discount_amount']) { + $object->setDiscountAmount(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('state', $data) && null !== $data['state']) { + $object->setState($data['state']); + unset($data['state']); + } elseif (\array_key_exists('state', $data) && null === $data['state']) { + $object->setState(null); + } + if (\array_key_exists('period_start', $data) && null !== $data['period_start']) { + $object->setPeriodStart(\DateTime::createFromFormat('Y-m-d', $data['period_start'])->setTime(0, 0, 0)); + unset($data['period_start']); + } elseif (\array_key_exists('period_start', $data) && null === $data['period_start']) { + $object->setPeriodStart(null); + } + if (\array_key_exists('period_end', $data) && null !== $data['period_end']) { + $object->setPeriodEnd(\DateTime::createFromFormat('Y-m-d', $data['period_end'])->setTime(0, 0, 0)); + unset($data['period_end']); + } elseif (\array_key_exists('period_end', $data) && null === $data['period_end']) { + $object->setPeriodEnd(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('due_date', $data) && null !== $data['due_date']) { + $object->setDueDate(\DateTime::createFromFormat('Y-m-d', $data['due_date'])->setTime(0, 0, 0)); + unset($data['due_date']); + } elseif (\array_key_exists('due_date', $data) && null === $data['due_date']) { + $object->setDueDate(null); + } + if (\array_key_exists('payment_term', $data) && null !== $data['payment_term']) { + $object->setPaymentTerm($data['payment_term']); + unset($data['payment_term']); + } elseif (\array_key_exists('payment_term', $data) && null === $data['payment_term']) { + $object->setPaymentTerm(null); + } + if (\array_key_exists('payment_options', $data) && null !== $data['payment_options']) { + $values_1 = []; + foreach ($data['payment_options'] as $value_1) { + $values_1[] = $value_1; + } + $object->setPaymentOptions($values_1); + unset($data['payment_options']); + } elseif (\array_key_exists('payment_options', $data) && null === $data['payment_options']) { + $object->setPaymentOptions(null); + } + if (\array_key_exists('sent_at', $data) && null !== $data['sent_at']) { + $object->setSentAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['sent_at'])); + unset($data['sent_at']); + } elseif (\array_key_exists('sent_at', $data) && null === $data['sent_at']) { + $object->setSentAt(null); + } + if (\array_key_exists('paid_at', $data) && null !== $data['paid_at']) { + $object->setPaidAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['paid_at'])); + unset($data['paid_at']); + } elseif (\array_key_exists('paid_at', $data) && null === $data['paid_at']) { + $object->setPaidAt(null); + } + if (\array_key_exists('paid_date', $data) && null !== $data['paid_date']) { + $object->setPaidDate(\DateTime::createFromFormat('Y-m-d', $data['paid_date'])->setTime(0, 0, 0)); + unset($data['paid_date']); + } elseif (\array_key_exists('paid_date', $data) && null === $data['paid_date']) { + $object->setPaidDate(null); + } + if (\array_key_exists('closed_at', $data) && null !== $data['closed_at']) { + $object->setClosedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['closed_at'])); + unset($data['closed_at']); + } elseif (\array_key_exists('closed_at', $data) && null === $data['closed_at']) { + $object->setClosedAt(null); + } + if (\array_key_exists('recurring_invoice_id', $data) && null !== $data['recurring_invoice_id']) { + $object->setRecurringInvoiceId($data['recurring_invoice_id']); + unset($data['recurring_invoice_id']); + } elseif (\array_key_exists('recurring_invoice_id', $data) && null === $data['recurring_invoice_id']) { + $object->setRecurringInvoiceId(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values = []; + foreach ($object->getLineItems() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['line_items'] = $values; + } + if ($object->isInitialized('estimate') && null !== $object->getEstimate()) { + $data['estimate'] = $this->normalizer->normalize($object->getEstimate(), 'json', $context); + } + if ($object->isInitialized('retainer') && null !== $object->getRetainer()) { + $data['retainer'] = $this->normalizer->normalize($object->getRetainer(), 'json', $context); + } + if ($object->isInitialized('creator') && null !== $object->getCreator()) { + $data['creator'] = $this->normalizer->normalize($object->getCreator(), 'json', $context); + } + if ($object->isInitialized('clientKey') && null !== $object->getClientKey()) { + $data['client_key'] = $object->getClientKey(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('dueAmount') && null !== $object->getDueAmount()) { + $data['due_amount'] = $object->getDueAmount(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('taxAmount') && null !== $object->getTaxAmount()) { + $data['tax_amount'] = $object->getTaxAmount(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('tax2Amount') && null !== $object->getTax2Amount()) { + $data['tax2_amount'] = $object->getTax2Amount(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('discountAmount') && null !== $object->getDiscountAmount()) { + $data['discount_amount'] = $object->getDiscountAmount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('state') && null !== $object->getState()) { + $data['state'] = $object->getState(); + } + if ($object->isInitialized('periodStart') && null !== $object->getPeriodStart()) { + $data['period_start'] = $object->getPeriodStart()->format('Y-m-d'); + } + if ($object->isInitialized('periodEnd') && null !== $object->getPeriodEnd()) { + $data['period_end'] = $object->getPeriodEnd()->format('Y-m-d'); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('dueDate') && null !== $object->getDueDate()) { + $data['due_date'] = $object->getDueDate()->format('Y-m-d'); + } + if ($object->isInitialized('paymentTerm') && null !== $object->getPaymentTerm()) { + $data['payment_term'] = $object->getPaymentTerm(); + } + if ($object->isInitialized('paymentOptions') && null !== $object->getPaymentOptions()) { + $values_1 = []; + foreach ($object->getPaymentOptions() as $value_1) { + $values_1[] = $value_1; + } + $data['payment_options'] = $values_1; + } + if ($object->isInitialized('sentAt') && null !== $object->getSentAt()) { + $data['sent_at'] = $object->getSentAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('paidAt') && null !== $object->getPaidAt()) { + $data['paid_at'] = $object->getPaidAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('paidDate') && null !== $object->getPaidDate()) { + $data['paid_date'] = $object->getPaidDate()->format('Y-m-d'); + } + if ($object->isInitialized('closedAt') && null !== $object->getClosedAt()) { + $data['closed_at'] = $object->getClosedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('recurringInvoiceId') && null !== $object->getRecurringInvoiceId()) { + $data['recurring_invoice_id'] = $object->getRecurringInvoiceId(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Invoice' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Invoice' => false]; + } } } diff --git a/generated/Normalizer/InvoicePaymentNormalizer.php b/generated/Normalizer/InvoicePaymentNormalizer.php index 69f702e..788feb4 100644 --- a/generated/Normalizer/InvoicePaymentNormalizer.php +++ b/generated/Normalizer/InvoicePaymentNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,173 +22,328 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicePaymentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicePaymentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' === $type; } - $object = new \JoliCode\Harvest\Api\Model\InvoicePayment(); - if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { - $data['amount'] = (float) $data['amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicePayment(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('paid_at', $data) && null !== $data['paid_at']) { + $object->setPaidAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['paid_at'])); + unset($data['paid_at']); + } elseif (\array_key_exists('paid_at', $data) && null === $data['paid_at']) { + $object->setPaidAt(null); + } + if (\array_key_exists('paid_date', $data) && null !== $data['paid_date']) { + $object->setPaidDate(\DateTime::createFromFormat('Y-m-d', $data['paid_date'])->setTime(0, 0, 0)); + unset($data['paid_date']); + } elseif (\array_key_exists('paid_date', $data) && null === $data['paid_date']) { + $object->setPaidDate(null); + } + if (\array_key_exists('recorded_by', $data) && null !== $data['recorded_by']) { + $object->setRecordedBy($data['recorded_by']); + unset($data['recorded_by']); + } elseif (\array_key_exists('recorded_by', $data) && null === $data['recorded_by']) { + $object->setRecordedBy(null); + } + if (\array_key_exists('recorded_by_email', $data) && null !== $data['recorded_by_email']) { + $object->setRecordedByEmail($data['recorded_by_email']); + unset($data['recorded_by_email']); + } elseif (\array_key_exists('recorded_by_email', $data) && null === $data['recorded_by_email']) { + $object->setRecordedByEmail(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('transaction_id', $data) && null !== $data['transaction_id']) { + $object->setTransactionId($data['transaction_id']); + unset($data['transaction_id']); + } elseif (\array_key_exists('transaction_id', $data) && null === $data['transaction_id']) { + $object->setTransactionId(null); + } + if (\array_key_exists('payment_gateway', $data) && null !== $data['payment_gateway']) { + $object->setPaymentGateway($this->denormalizer->denormalize($data['payment_gateway'], 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway', 'json', $context)); + unset($data['payment_gateway']); + } elseif (\array_key_exists('payment_gateway', $data) && null === $data['payment_gateway']) { + $object->setPaymentGateway(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('amount', $data) && null !== $data['amount']) { - $object->setAmount($data['amount']); - unset($data['amount']); - } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { - $object->setAmount(null); - } - if (\array_key_exists('paid_at', $data) && null !== $data['paid_at']) { - $object->setPaidAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['paid_at'])); - unset($data['paid_at']); - } elseif (\array_key_exists('paid_at', $data) && null === $data['paid_at']) { - $object->setPaidAt(null); - } - if (\array_key_exists('paid_date', $data) && null !== $data['paid_date']) { - $object->setPaidDate(\DateTime::createFromFormat('Y-m-d', $data['paid_date'])->setTime(0, 0, 0)); - unset($data['paid_date']); - } elseif (\array_key_exists('paid_date', $data) && null === $data['paid_date']) { - $object->setPaidDate(null); - } - if (\array_key_exists('recorded_by', $data) && null !== $data['recorded_by']) { - $object->setRecordedBy($data['recorded_by']); - unset($data['recorded_by']); - } elseif (\array_key_exists('recorded_by', $data) && null === $data['recorded_by']) { - $object->setRecordedBy(null); - } - if (\array_key_exists('recorded_by_email', $data) && null !== $data['recorded_by_email']) { - $object->setRecordedByEmail($data['recorded_by_email']); - unset($data['recorded_by_email']); - } elseif (\array_key_exists('recorded_by_email', $data) && null === $data['recorded_by_email']) { - $object->setRecordedByEmail(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('transaction_id', $data) && null !== $data['transaction_id']) { - $object->setTransactionId($data['transaction_id']); - unset($data['transaction_id']); - } elseif (\array_key_exists('transaction_id', $data) && null === $data['transaction_id']) { - $object->setTransactionId(null); - } - if (\array_key_exists('payment_gateway', $data) && null !== $data['payment_gateway']) { - $object->setPaymentGateway($this->denormalizer->denormalize($data['payment_gateway'], 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway', 'json', $context)); - unset($data['payment_gateway']); - } elseif (\array_key_exists('payment_gateway', $data) && null === $data['payment_gateway']) { - $object->setPaymentGateway(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('paidAt') && null !== $object->getPaidAt()) { + $data['paid_at'] = $object->getPaidAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('paidDate') && null !== $object->getPaidDate()) { + $data['paid_date'] = $object->getPaidDate()->format('Y-m-d'); + } + if ($object->isInitialized('recordedBy') && null !== $object->getRecordedBy()) { + $data['recorded_by'] = $object->getRecordedBy(); + } + if ($object->isInitialized('recordedByEmail') && null !== $object->getRecordedByEmail()) { + $data['recorded_by_email'] = $object->getRecordedByEmail(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('transactionId') && null !== $object->getTransactionId()) { + $data['transaction_id'] = $object->getTransactionId(); + } + if ($object->isInitialized('paymentGateway') && null !== $object->getPaymentGateway()) { + $data['payment_gateway'] = $this->normalizer->normalize($object->getPaymentGateway(), 'json', $context); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicePayment' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicePaymentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('amount') && null !== $object->getAmount()) { - $data['amount'] = $object->getAmount(); - } - if ($object->isInitialized('paidAt') && null !== $object->getPaidAt()) { - $data['paid_at'] = $object->getPaidAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('paidDate') && null !== $object->getPaidDate()) { - $data['paid_date'] = $object->getPaidDate()->format('Y-m-d'); - } - if ($object->isInitialized('recordedBy') && null !== $object->getRecordedBy()) { - $data['recorded_by'] = $object->getRecordedBy(); - } - if ($object->isInitialized('recordedByEmail') && null !== $object->getRecordedByEmail()) { - $data['recorded_by_email'] = $object->getRecordedByEmail(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('transactionId') && null !== $object->getTransactionId()) { - $data['transaction_id'] = $object->getTransactionId(); - } - if ($object->isInitialized('paymentGateway') && null !== $object->getPaymentGateway()) { - $data['payment_gateway'] = $this->normalizer->normalize($object->getPaymentGateway(), 'json', $context); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicePayment(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('paid_at', $data) && null !== $data['paid_at']) { + $object->setPaidAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['paid_at'])); + unset($data['paid_at']); + } elseif (\array_key_exists('paid_at', $data) && null === $data['paid_at']) { + $object->setPaidAt(null); + } + if (\array_key_exists('paid_date', $data) && null !== $data['paid_date']) { + $object->setPaidDate(\DateTime::createFromFormat('Y-m-d', $data['paid_date'])->setTime(0, 0, 0)); + unset($data['paid_date']); + } elseif (\array_key_exists('paid_date', $data) && null === $data['paid_date']) { + $object->setPaidDate(null); + } + if (\array_key_exists('recorded_by', $data) && null !== $data['recorded_by']) { + $object->setRecordedBy($data['recorded_by']); + unset($data['recorded_by']); + } elseif (\array_key_exists('recorded_by', $data) && null === $data['recorded_by']) { + $object->setRecordedBy(null); + } + if (\array_key_exists('recorded_by_email', $data) && null !== $data['recorded_by_email']) { + $object->setRecordedByEmail($data['recorded_by_email']); + unset($data['recorded_by_email']); + } elseif (\array_key_exists('recorded_by_email', $data) && null === $data['recorded_by_email']) { + $object->setRecordedByEmail(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); } + if (\array_key_exists('transaction_id', $data) && null !== $data['transaction_id']) { + $object->setTransactionId($data['transaction_id']); + unset($data['transaction_id']); + } elseif (\array_key_exists('transaction_id', $data) && null === $data['transaction_id']) { + $object->setTransactionId(null); + } + if (\array_key_exists('payment_gateway', $data) && null !== $data['payment_gateway']) { + $object->setPaymentGateway($this->denormalizer->denormalize($data['payment_gateway'], 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway', 'json', $context)); + unset($data['payment_gateway']); + } elseif (\array_key_exists('payment_gateway', $data) && null === $data['payment_gateway']) { + $object->setPaymentGateway(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('amount') && null !== $object->getAmount()) { + $data['amount'] = $object->getAmount(); + } + if ($object->isInitialized('paidAt') && null !== $object->getPaidAt()) { + $data['paid_at'] = $object->getPaidAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('paidDate') && null !== $object->getPaidDate()) { + $data['paid_date'] = $object->getPaidDate()->format('Y-m-d'); + } + if ($object->isInitialized('recordedBy') && null !== $object->getRecordedBy()) { + $data['recorded_by'] = $object->getRecordedBy(); + } + if ($object->isInitialized('recordedByEmail') && null !== $object->getRecordedByEmail()) { + $data['recorded_by_email'] = $object->getRecordedByEmail(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('transactionId') && null !== $object->getTransactionId()) { + $data['transaction_id'] = $object->getTransactionId(); + } + if ($object->isInitialized('paymentGateway') && null !== $object->getPaymentGateway()) { + $data['payment_gateway'] = $this->normalizer->normalize($object->getPaymentGateway(), 'json', $context); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicePayment' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicePayment' => false]; + } } } diff --git a/generated/Normalizer/InvoicePaymentPaymentGatewayNormalizer.php b/generated/Normalizer/InvoicePaymentPaymentGatewayNormalizer.php index bea8774..ab07b5a 100644 --- a/generated/Normalizer/InvoicePaymentPaymentGatewayNormalizer.php +++ b/generated/Normalizer/InvoicePaymentPaymentGatewayNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicePaymentPaymentGatewayNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicePaymentPaymentGatewayNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoicePaymentPaymentGateway(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicePaymentPaymentGateway(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicePaymentPaymentGatewayNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicePaymentPaymentGateway(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' => false]; + } } } diff --git a/generated/Normalizer/InvoicePaymentsNormalizer.php b/generated/Normalizer/InvoicePaymentsNormalizer.php index ed6fd5d..c746af6 100644 --- a/generated/Normalizer/InvoicePaymentsNormalizer.php +++ b/generated/Normalizer/InvoicePaymentsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicePaymentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicePaymentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoicePayments(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicePayments(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_payments', $data)) { + $values = []; + foreach ($data['invoice_payments'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment', 'json', $context); + } + $object->setInvoicePayments($values); + unset($data['invoice_payments']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('invoice_payments', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['invoice_payments'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment', 'json', $context); + foreach ($object->getInvoicePayments() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setInvoicePayments($values); - unset($data['invoice_payments']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['invoice_payments'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicePayments' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicePaymentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getInvoicePayments() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' === $data::class; } - $data['invoice_payments'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicePayments(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoice_payments', $data)) { + $values = []; + foreach ($data['invoice_payments'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment', 'json', $context); + } + $object->setInvoicePayments($values); + unset($data['invoice_payments']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getInvoicePayments() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['invoice_payments'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicePayments' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicePayments' => false]; + } } } diff --git a/generated/Normalizer/InvoiceRetainerNormalizer.php b/generated/Normalizer/InvoiceRetainerNormalizer.php index 9a80ad4..5cd89ac 100644 --- a/generated/Normalizer/InvoiceRetainerNormalizer.php +++ b/generated/Normalizer/InvoiceRetainerNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,80 +22,142 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoiceRetainerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoiceRetainerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoiceRetainer(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceRetainer(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoiceRetainerNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' === $type; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' === $data::class; + } + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoiceRetainer(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' => false]; + } } } diff --git a/generated/Normalizer/InvoicesInvoiceIdMessagesPostBodyNormalizer.php b/generated/Normalizer/InvoicesInvoiceIdMessagesPostBodyNormalizer.php index e1a6f24..c4f886c 100644 --- a/generated/Normalizer/InvoicesInvoiceIdMessagesPostBodyNormalizer.php +++ b/generated/Normalizer/InvoicesInvoiceIdMessagesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,149 +22,280 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesInvoiceIdMessagesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesInvoiceIdMessagesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdMessagesPostBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdMessagesPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { + $object->setEventType($data['event_type']); + unset($data['event_type']); + } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { + $object->setEventType(null); + } + if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { + $values = []; + foreach ($data['recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem', 'json', $context); + } + $object->setRecipients($values); + unset($data['recipients']); + } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { + $object->setRecipients(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('body', $data) && null !== $data['body']) { + $object->setBody($data['body']); + unset($data['body']); + } elseif (\array_key_exists('body', $data) && null === $data['body']) { + $object->setBody(null); + } + if (\array_key_exists('include_link_to_client_invoice', $data) && null !== $data['include_link_to_client_invoice']) { + $object->setIncludeLinkToClientInvoice($data['include_link_to_client_invoice']); + unset($data['include_link_to_client_invoice']); + } elseif (\array_key_exists('include_link_to_client_invoice', $data) && null === $data['include_link_to_client_invoice']) { + $object->setIncludeLinkToClientInvoice(null); + } + if (\array_key_exists('attach_pdf', $data) && null !== $data['attach_pdf']) { + $object->setAttachPdf($data['attach_pdf']); + unset($data['attach_pdf']); + } elseif (\array_key_exists('attach_pdf', $data) && null === $data['attach_pdf']) { + $object->setAttachPdf(null); + } + if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { + $object->setSendMeACopy($data['send_me_a_copy']); + unset($data['send_me_a_copy']); + } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { + $object->setSendMeACopy(null); + } + if (\array_key_exists('thank_you', $data) && null !== $data['thank_you']) { + $object->setThankYou($data['thank_you']); + unset($data['thank_you']); + } elseif (\array_key_exists('thank_you', $data) && null === $data['thank_you']) { + $object->setThankYou(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { - $object->setEventType($data['event_type']); - unset($data['event_type']); - } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { - $object->setEventType(null); - } - if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('eventType') && null !== $object->getEventType()) { + $data['event_type'] = $object->getEventType(); + } $values = []; - foreach ($data['recipients'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem', 'json', $context); + foreach ($object->getRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setRecipients($values); - unset($data['recipients']); - } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { - $object->setRecipients(null); - } - if (\array_key_exists('subject', $data) && null !== $data['subject']) { - $object->setSubject($data['subject']); - unset($data['subject']); - } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { - $object->setSubject(null); - } - if (\array_key_exists('body', $data) && null !== $data['body']) { - $object->setBody($data['body']); - unset($data['body']); - } elseif (\array_key_exists('body', $data) && null === $data['body']) { - $object->setBody(null); - } - if (\array_key_exists('include_link_to_client_invoice', $data) && null !== $data['include_link_to_client_invoice']) { - $object->setIncludeLinkToClientInvoice($data['include_link_to_client_invoice']); - unset($data['include_link_to_client_invoice']); - } elseif (\array_key_exists('include_link_to_client_invoice', $data) && null === $data['include_link_to_client_invoice']) { - $object->setIncludeLinkToClientInvoice(null); - } - if (\array_key_exists('attach_pdf', $data) && null !== $data['attach_pdf']) { - $object->setAttachPdf($data['attach_pdf']); - unset($data['attach_pdf']); - } elseif (\array_key_exists('attach_pdf', $data) && null === $data['attach_pdf']) { - $object->setAttachPdf(null); - } - if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { - $object->setSendMeACopy($data['send_me_a_copy']); - unset($data['send_me_a_copy']); - } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { - $object->setSendMeACopy(null); - } - if (\array_key_exists('thank_you', $data) && null !== $data['thank_you']) { - $object->setThankYou($data['thank_you']); - unset($data['thank_you']); - } elseif (\array_key_exists('thank_you', $data) && null === $data['thank_you']) { - $object->setThankYou(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['recipients'] = $values; + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('body') && null !== $object->getBody()) { + $data['body'] = $object->getBody(); + } + if ($object->isInitialized('includeLinkToClientInvoice') && null !== $object->getIncludeLinkToClientInvoice()) { + $data['include_link_to_client_invoice'] = $object->getIncludeLinkToClientInvoice(); + } + if ($object->isInitialized('attachPdf') && null !== $object->getAttachPdf()) { + $data['attach_pdf'] = $object->getAttachPdf(); + } + if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { + $data['send_me_a_copy'] = $object->getSendMeACopy(); } + if ($object->isInitialized('thankYou') && null !== $object->getThankYou()) { + $data['thank_you'] = $object->getThankYou(); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesInvoiceIdMessagesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('eventType') && null !== $object->getEventType()) { - $data['event_type'] = $object->getEventType(); - } - $values = []; - foreach ($object->getRecipients() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['recipients'] = $values; - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['subject'] = $object->getSubject(); - } - if ($object->isInitialized('body') && null !== $object->getBody()) { - $data['body'] = $object->getBody(); - } - if ($object->isInitialized('includeLinkToClientInvoice') && null !== $object->getIncludeLinkToClientInvoice()) { - $data['include_link_to_client_invoice'] = $object->getIncludeLinkToClientInvoice(); - } - if ($object->isInitialized('attachPdf') && null !== $object->getAttachPdf()) { - $data['attach_pdf'] = $object->getAttachPdf(); - } - if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { - $data['send_me_a_copy'] = $object->getSendMeACopy(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' === $type; } - if ($object->isInitialized('thankYou') && null !== $object->getThankYou()) { - $data['thank_you'] = $object->getThankYou(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' === $data::class; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdMessagesPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('event_type', $data) && null !== $data['event_type']) { + $object->setEventType($data['event_type']); + unset($data['event_type']); + } elseif (\array_key_exists('event_type', $data) && null === $data['event_type']) { + $object->setEventType(null); + } + if (\array_key_exists('recipients', $data) && null !== $data['recipients']) { + $values = []; + foreach ($data['recipients'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem', 'json', $context); + } + $object->setRecipients($values); + unset($data['recipients']); + } elseif (\array_key_exists('recipients', $data) && null === $data['recipients']) { + $object->setRecipients(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('body', $data) && null !== $data['body']) { + $object->setBody($data['body']); + unset($data['body']); + } elseif (\array_key_exists('body', $data) && null === $data['body']) { + $object->setBody(null); + } + if (\array_key_exists('include_link_to_client_invoice', $data) && null !== $data['include_link_to_client_invoice']) { + $object->setIncludeLinkToClientInvoice($data['include_link_to_client_invoice']); + unset($data['include_link_to_client_invoice']); + } elseif (\array_key_exists('include_link_to_client_invoice', $data) && null === $data['include_link_to_client_invoice']) { + $object->setIncludeLinkToClientInvoice(null); + } + if (\array_key_exists('attach_pdf', $data) && null !== $data['attach_pdf']) { + $object->setAttachPdf($data['attach_pdf']); + unset($data['attach_pdf']); + } elseif (\array_key_exists('attach_pdf', $data) && null === $data['attach_pdf']) { + $object->setAttachPdf(null); + } + if (\array_key_exists('send_me_a_copy', $data) && null !== $data['send_me_a_copy']) { + $object->setSendMeACopy($data['send_me_a_copy']); + unset($data['send_me_a_copy']); + } elseif (\array_key_exists('send_me_a_copy', $data) && null === $data['send_me_a_copy']) { + $object->setSendMeACopy(null); } + if (\array_key_exists('thank_you', $data) && null !== $data['thank_you']) { + $object->setThankYou($data['thank_you']); + unset($data['thank_you']); + } elseif (\array_key_exists('thank_you', $data) && null === $data['thank_you']) { + $object->setThankYou(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('eventType') && null !== $object->getEventType()) { + $data['event_type'] = $object->getEventType(); + } + $values = []; + foreach ($object->getRecipients() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['recipients'] = $values; + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('body') && null !== $object->getBody()) { + $data['body'] = $object->getBody(); + } + if ($object->isInitialized('includeLinkToClientInvoice') && null !== $object->getIncludeLinkToClientInvoice()) { + $data['include_link_to_client_invoice'] = $object->getIncludeLinkToClientInvoice(); + } + if ($object->isInitialized('attachPdf') && null !== $object->getAttachPdf()) { + $data['attach_pdf'] = $object->getAttachPdf(); + } + if ($object->isInitialized('sendMeACopy') && null !== $object->getSendMeACopy()) { + $data['send_me_a_copy'] = $object->getSendMeACopy(); + } + if ($object->isInitialized('thankYou') && null !== $object->getThankYou()) { + $data['thank_you'] = $object->getThankYou(); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' => false]; + } } } diff --git a/generated/Normalizer/InvoicesInvoiceIdMessagesPostBodyRecipientsItemNormalizer.php b/generated/Normalizer/InvoicesInvoiceIdMessagesPostBodyRecipientsItemNormalizer.php index 970ca10..8b89f3e 100644 --- a/generated/Normalizer/InvoicesInvoiceIdMessagesPostBodyRecipientsItemNormalizer.php +++ b/generated/Normalizer/InvoicesInvoiceIdMessagesPostBodyRecipientsItemNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,83 +22,148 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesInvoiceIdMessagesPostBodyRecipientsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesInvoiceIdMessagesPostBodyRecipientsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdMessagesPostBodyRecipientsItem(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdMessagesPostBodyRecipientsItem(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } + if (\array_key_exists('email', $data)) { + $object->setEmail($data['email']); + unset($data['email']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data)) { - $object->setName($data['name']); - unset($data['name']); - } - if (\array_key_exists('email', $data)) { - $object->setEmail($data['email']); - unset($data['email']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + $data['email'] = $object->getEmail(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesInvoiceIdMessagesPostBodyRecipientsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' === $data::class; } - $data['email'] = $object->getEmail(); - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdMessagesPostBodyRecipientsItem(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } + if (\array_key_exists('email', $data)) { + $object->setEmail($data['email']); + unset($data['email']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + $data['email'] = $object->getEmail(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' => false]; + } } } diff --git a/generated/Normalizer/InvoicesInvoiceIdPatchBodyLineItemsItemNormalizer.php b/generated/Normalizer/InvoicesInvoiceIdPatchBodyLineItemsItemNormalizer.php index 14ed5d4..89a13f9 100644 --- a/generated/Normalizer/InvoicesInvoiceIdPatchBodyLineItemsItemNormalizer.php +++ b/generated/Normalizer/InvoicesInvoiceIdPatchBodyLineItemsItemNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,133 +22,248 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesInvoiceIdPatchBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesInvoiceIdPatchBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdPatchBodyLineItemsItem(); - if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { - $data['quantity'] = (float) $data['quantity']; - } - if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { - $data['unit_price'] = (float) $data['unit_price']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdPatchBodyLineItemsItem(); + if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { + $data['quantity'] = (float) $data['quantity']; + } + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data)) { + $object->setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('project_id', $data)) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } + if (\array_key_exists('kind', $data)) { + $object->setKind($data['kind']); + unset($data['kind']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('quantity', $data)) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); + } + if (\array_key_exists('unit_price', $data)) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } + if (\array_key_exists('taxed', $data)) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } + if (\array_key_exists('taxed2', $data)) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data)) { - $object->setId($data['id']); - unset($data['id']); - } - if (\array_key_exists('project_id', $data)) { - $object->setProjectId($data['project_id']); - unset($data['project_id']); - } - if (\array_key_exists('kind', $data)) { - $object->setKind($data['kind']); - unset($data['kind']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('quantity', $data)) { - $object->setQuantity($data['quantity']); - unset($data['quantity']); - } - if (\array_key_exists('unit_price', $data)) { - $object->setUnitPrice($data['unit_price']); - unset($data['unit_price']); - } - if (\array_key_exists('taxed', $data)) { - $object->setTaxed($data['taxed']); - unset($data['taxed']); - } - if (\array_key_exists('taxed2', $data)) { - $object->setTaxed2($data['taxed2']); - unset($data['taxed2']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('kind') && null !== $object->getKind()) { + $data['kind'] = $object->getKind(); + } + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesInvoiceIdPatchBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { - $data['project_id'] = $object->getProjectId(); - } - if ($object->isInitialized('kind') && null !== $object->getKind()) { - $data['kind'] = $object->getKind(); - } - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['quantity'] = $object->getQuantity(); - } - if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { - $data['unit_price'] = $object->getUnitPrice(); - } - if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { - $data['taxed'] = $object->getTaxed(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' === $type; } - if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { - $data['taxed2'] = $object->getTaxed2(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdPatchBodyLineItemsItem(); + if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { + $data['quantity'] = (float) $data['quantity']; + } + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data)) { + $object->setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('project_id', $data)) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } + if (\array_key_exists('kind', $data)) { + $object->setKind($data['kind']); + unset($data['kind']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('quantity', $data)) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); } + if (\array_key_exists('unit_price', $data)) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } + if (\array_key_exists('taxed', $data)) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } + if (\array_key_exists('taxed2', $data)) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('kind') && null !== $object->getKind()) { + $data['kind'] = $object->getKind(); + } + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + if ($object->isInitialized('unitPrice') && null !== $object->getUnitPrice()) { + $data['unit_price'] = $object->getUnitPrice(); + } + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' => false]; + } } } diff --git a/generated/Normalizer/InvoicesInvoiceIdPatchBodyNormalizer.php b/generated/Normalizer/InvoicesInvoiceIdPatchBodyNormalizer.php index 1b77c07..12739b9 100644 --- a/generated/Normalizer/InvoicesInvoiceIdPatchBodyNormalizer.php +++ b/generated/Normalizer/InvoicesInvoiceIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,240 +22,462 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesInvoiceIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesInvoiceIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdPatchBody(); - if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { - $data['tax'] = (float) $data['tax']; - } - if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { - $data['tax2'] = (float) $data['tax2']; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' === $type; } - if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { - $data['discount'] = (float) $data['discount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdPatchBody(); + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('retainer_id', $data) && null !== $data['retainer_id']) { + $object->setRetainerId($data['retainer_id']); + unset($data['retainer_id']); + } elseif (\array_key_exists('retainer_id', $data) && null === $data['retainer_id']) { + $object->setRetainerId(null); + } + if (\array_key_exists('estimate_id', $data) && null !== $data['estimate_id']) { + $object->setEstimateId($data['estimate_id']); + unset($data['estimate_id']); + } elseif (\array_key_exists('estimate_id', $data) && null === $data['estimate_id']) { + $object->setEstimateId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('due_date', $data) && null !== $data['due_date']) { + $object->setDueDate(\DateTime::createFromFormat('Y-m-d', $data['due_date'])->setTime(0, 0, 0)); + unset($data['due_date']); + } elseif (\array_key_exists('due_date', $data) && null === $data['due_date']) { + $object->setDueDate(null); + } + if (\array_key_exists('payment_term', $data) && null !== $data['payment_term']) { + $object->setPaymentTerm($data['payment_term']); + unset($data['payment_term']); + } elseif (\array_key_exists('payment_term', $data) && null === $data['payment_term']) { + $object->setPaymentTerm(null); + } + if (\array_key_exists('payment_options', $data) && null !== $data['payment_options']) { + $values = []; + foreach ($data['payment_options'] as $value) { + $values[] = $value; + } + $object->setPaymentOptions($values); + unset($data['payment_options']); + } elseif (\array_key_exists('payment_options', $data) && null === $data['payment_options']) { + $object->setPaymentOptions(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values_1 = []; + foreach ($data['line_items'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem', 'json', $context); + } + $object->setLineItems($values_1); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('retainer_id', $data) && null !== $data['retainer_id']) { - $object->setRetainerId($data['retainer_id']); - unset($data['retainer_id']); - } elseif (\array_key_exists('retainer_id', $data) && null === $data['retainer_id']) { - $object->setRetainerId(null); - } - if (\array_key_exists('estimate_id', $data) && null !== $data['estimate_id']) { - $object->setEstimateId($data['estimate_id']); - unset($data['estimate_id']); - } elseif (\array_key_exists('estimate_id', $data) && null === $data['estimate_id']) { - $object->setEstimateId(null); - } - if (\array_key_exists('number', $data) && null !== $data['number']) { - $object->setNumber($data['number']); - unset($data['number']); - } elseif (\array_key_exists('number', $data) && null === $data['number']) { - $object->setNumber(null); - } - if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { - $object->setPurchaseOrder($data['purchase_order']); - unset($data['purchase_order']); - } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { - $object->setPurchaseOrder(null); - } - if (\array_key_exists('tax', $data) && null !== $data['tax']) { - $object->setTax($data['tax']); - unset($data['tax']); - } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { - $object->setTax(null); - } - if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { - $object->setTax2($data['tax2']); - unset($data['tax2']); - } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { - $object->setTax2(null); - } - if (\array_key_exists('discount', $data) && null !== $data['discount']) { - $object->setDiscount($data['discount']); - unset($data['discount']); - } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { - $object->setDiscount(null); - } - if (\array_key_exists('subject', $data) && null !== $data['subject']) { - $object->setSubject($data['subject']); - unset($data['subject']); - } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { - $object->setSubject(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { - $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); - unset($data['issue_date']); - } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { - $object->setIssueDate(null); - } - if (\array_key_exists('due_date', $data) && null !== $data['due_date']) { - $object->setDueDate(\DateTime::createFromFormat('Y-m-d', $data['due_date'])->setTime(0, 0, 0)); - unset($data['due_date']); - } elseif (\array_key_exists('due_date', $data) && null === $data['due_date']) { - $object->setDueDate(null); - } - if (\array_key_exists('payment_term', $data) && null !== $data['payment_term']) { - $object->setPaymentTerm($data['payment_term']); - unset($data['payment_term']); - } elseif (\array_key_exists('payment_term', $data) && null === $data['payment_term']) { - $object->setPaymentTerm(null); - } - if (\array_key_exists('payment_options', $data) && null !== $data['payment_options']) { - $values = []; - foreach ($data['payment_options'] as $value) { - $values[] = $value; - } - $object->setPaymentOptions($values); - unset($data['payment_options']); - } elseif (\array_key_exists('payment_options', $data) && null === $data['payment_options']) { - $object->setPaymentOptions(null); - } - if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { - $values_1 = []; - foreach ($data['line_items'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem', 'json', $context); - } - $object->setLineItems($values_1); - unset($data['line_items']); - } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { - $object->setLineItems(null); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('retainerId') && null !== $object->getRetainerId()) { + $data['retainer_id'] = $object->getRetainerId(); + } + if ($object->isInitialized('estimateId') && null !== $object->getEstimateId()) { + $data['estimate_id'] = $object->getEstimateId(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('dueDate') && null !== $object->getDueDate()) { + $data['due_date'] = $object->getDueDate()->format('Y-m-d'); + } + if ($object->isInitialized('paymentTerm') && null !== $object->getPaymentTerm()) { + $data['payment_term'] = $object->getPaymentTerm(); + } + if ($object->isInitialized('paymentOptions') && null !== $object->getPaymentOptions()) { + $values = []; + foreach ($object->getPaymentOptions() as $value) { + $values[] = $value; + } + $data['payment_options'] = $values; } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values_1 = []; + foreach ($object->getLineItems() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $data['line_items'] = $values_1; + } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesInvoiceIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('retainerId') && null !== $object->getRetainerId()) { - $data['retainer_id'] = $object->getRetainerId(); - } - if ($object->isInitialized('estimateId') && null !== $object->getEstimateId()) { - $data['estimate_id'] = $object->getEstimateId(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); - } - if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { - $data['purchase_order'] = $object->getPurchaseOrder(); - } - if ($object->isInitialized('tax') && null !== $object->getTax()) { - $data['tax'] = $object->getTax(); - } - if ($object->isInitialized('tax2') && null !== $object->getTax2()) { - $data['tax2'] = $object->getTax2(); - } - if ($object->isInitialized('discount') && null !== $object->getDiscount()) { - $data['discount'] = $object->getDiscount(); - } - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['subject'] = $object->getSubject(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); - } - if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { - $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); - } - if ($object->isInitialized('dueDate') && null !== $object->getDueDate()) { - $data['due_date'] = $object->getDueDate()->format('Y-m-d'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' === $type; } - if ($object->isInitialized('paymentTerm') && null !== $object->getPaymentTerm()) { - $data['payment_term'] = $object->getPaymentTerm(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' === $data::class; } - if ($object->isInitialized('paymentOptions') && null !== $object->getPaymentOptions()) { - $values = []; - foreach ($object->getPaymentOptions() as $value) { - $values[] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['payment_options'] = $values; - } - if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { - $values_1 = []; - foreach ($object->getLineItems() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - $data['line_items'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; + $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdPatchBody(); + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('retainer_id', $data) && null !== $data['retainer_id']) { + $object->setRetainerId($data['retainer_id']); + unset($data['retainer_id']); + } elseif (\array_key_exists('retainer_id', $data) && null === $data['retainer_id']) { + $object->setRetainerId(null); + } + if (\array_key_exists('estimate_id', $data) && null !== $data['estimate_id']) { + $object->setEstimateId($data['estimate_id']); + unset($data['estimate_id']); + } elseif (\array_key_exists('estimate_id', $data) && null === $data['estimate_id']) { + $object->setEstimateId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('due_date', $data) && null !== $data['due_date']) { + $object->setDueDate(\DateTime::createFromFormat('Y-m-d', $data['due_date'])->setTime(0, 0, 0)); + unset($data['due_date']); + } elseif (\array_key_exists('due_date', $data) && null === $data['due_date']) { + $object->setDueDate(null); + } + if (\array_key_exists('payment_term', $data) && null !== $data['payment_term']) { + $object->setPaymentTerm($data['payment_term']); + unset($data['payment_term']); + } elseif (\array_key_exists('payment_term', $data) && null === $data['payment_term']) { + $object->setPaymentTerm(null); + } + if (\array_key_exists('payment_options', $data) && null !== $data['payment_options']) { + $values = []; + foreach ($data['payment_options'] as $value) { + $values[] = $value; + } + $object->setPaymentOptions($values); + unset($data['payment_options']); + } elseif (\array_key_exists('payment_options', $data) && null === $data['payment_options']) { + $object->setPaymentOptions(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values_1 = []; + foreach ($data['line_items'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem', 'json', $context); + } + $object->setLineItems($values_1); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('retainerId') && null !== $object->getRetainerId()) { + $data['retainer_id'] = $object->getRetainerId(); + } + if ($object->isInitialized('estimateId') && null !== $object->getEstimateId()) { + $data['estimate_id'] = $object->getEstimateId(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('dueDate') && null !== $object->getDueDate()) { + $data['due_date'] = $object->getDueDate()->format('Y-m-d'); + } + if ($object->isInitialized('paymentTerm') && null !== $object->getPaymentTerm()) { + $data['payment_term'] = $object->getPaymentTerm(); + } + if ($object->isInitialized('paymentOptions') && null !== $object->getPaymentOptions()) { + $values = []; + foreach ($object->getPaymentOptions() as $value) { + $values[] = $value; + } + $data['payment_options'] = $values; + } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values_1 = []; + foreach ($object->getLineItems() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $data['line_items'] = $values_1; + } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/InvoicesInvoiceIdPaymentsPostBodyNormalizer.php b/generated/Normalizer/InvoicesInvoiceIdPaymentsPostBodyNormalizer.php index c3b2795..b6c720a 100644 --- a/generated/Normalizer/InvoicesInvoiceIdPaymentsPostBodyNormalizer.php +++ b/generated/Normalizer/InvoicesInvoiceIdPaymentsPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,108 +22,216 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesInvoiceIdPaymentsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesInvoiceIdPaymentsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdPaymentsPostBody(); - if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { - $data['amount'] = (float) $data['amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdPaymentsPostBody(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('paid_at', $data) && null !== $data['paid_at']) { + $object->setPaidAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['paid_at'])); + unset($data['paid_at']); + } elseif (\array_key_exists('paid_at', $data) && null === $data['paid_at']) { + $object->setPaidAt(null); + } + if (\array_key_exists('paid_date', $data) && null !== $data['paid_date']) { + $object->setPaidDate(\DateTime::createFromFormat('Y-m-d', $data['paid_date'])->setTime(0, 0, 0)); + unset($data['paid_date']); + } elseif (\array_key_exists('paid_date', $data) && null === $data['paid_date']) { + $object->setPaidDate(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('send_thank_you', $data) && null !== $data['send_thank_you']) { + $object->setSendThankYou($data['send_thank_you']); + unset($data['send_thank_you']); + } elseif (\array_key_exists('send_thank_you', $data) && null === $data['send_thank_you']) { + $object->setSendThankYou(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('amount', $data) && null !== $data['amount']) { - $object->setAmount($data['amount']); - unset($data['amount']); - } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { - $object->setAmount(null); - } - if (\array_key_exists('paid_at', $data) && null !== $data['paid_at']) { - $object->setPaidAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['paid_at'])); - unset($data['paid_at']); - } elseif (\array_key_exists('paid_at', $data) && null === $data['paid_at']) { - $object->setPaidAt(null); - } - if (\array_key_exists('paid_date', $data) && null !== $data['paid_date']) { - $object->setPaidDate(\DateTime::createFromFormat('Y-m-d', $data['paid_date'])->setTime(0, 0, 0)); - unset($data['paid_date']); - } elseif (\array_key_exists('paid_date', $data) && null === $data['paid_date']) { - $object->setPaidDate(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['amount'] = $object->getAmount(); + if ($object->isInitialized('paidAt') && null !== $object->getPaidAt()) { + $data['paid_at'] = $object->getPaidAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('paidDate') && null !== $object->getPaidDate()) { + $data['paid_date'] = $object->getPaidDate()->format('Y-m-d'); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('sendThankYou') && null !== $object->getSendThankYou()) { + $data['send_thank_you'] = $object->getSendThankYou(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesInvoiceIdPaymentsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['amount'] = $object->getAmount(); - if ($object->isInitialized('paidAt') && null !== $object->getPaidAt()) { - $data['paid_at'] = $object->getPaidAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('paidDate') && null !== $object->getPaidDate()) { - $data['paid_date'] = $object->getPaidDate()->format('Y-m-d'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' === $type; } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesInvoiceIdPaymentsPostBody(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('paid_at', $data) && null !== $data['paid_at']) { + $object->setPaidAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['paid_at'])); + unset($data['paid_at']); + } elseif (\array_key_exists('paid_at', $data) && null === $data['paid_at']) { + $object->setPaidAt(null); + } + if (\array_key_exists('paid_date', $data) && null !== $data['paid_date']) { + $object->setPaidDate(\DateTime::createFromFormat('Y-m-d', $data['paid_date'])->setTime(0, 0, 0)); + unset($data['paid_date']); + } elseif (\array_key_exists('paid_date', $data) && null === $data['paid_date']) { + $object->setPaidDate(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); } + if (\array_key_exists('send_thank_you', $data) && null !== $data['send_thank_you']) { + $object->setSendThankYou($data['send_thank_you']); + unset($data['send_thank_you']); + } elseif (\array_key_exists('send_thank_you', $data) && null === $data['send_thank_you']) { + $object->setSendThankYou(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['amount'] = $object->getAmount(); + if ($object->isInitialized('paidAt') && null !== $object->getPaidAt()) { + $data['paid_at'] = $object->getPaidAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('paidDate') && null !== $object->getPaidDate()) { + $data['paid_date'] = $object->getPaidDate()->format('Y-m-d'); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('sendThankYou') && null !== $object->getSendThankYou()) { + $data['send_thank_you'] = $object->getSendThankYou(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' => false]; + } } } diff --git a/generated/Normalizer/InvoicesNormalizer.php b/generated/Normalizer/InvoicesNormalizer.php index 6bb0178..6bb76d2 100644 --- a/generated/Normalizer/InvoicesNormalizer.php +++ b/generated/Normalizer/InvoicesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Invoices' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Invoices' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Invoices' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Invoices' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Invoices(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Invoices(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoices', $data)) { + $values = []; + foreach ($data['invoices'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Invoice', 'json', $context); + } + $object->setInvoices($values); + unset($data['invoices']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('invoices', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['invoices'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Invoice', 'json', $context); + foreach ($object->getInvoices() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setInvoices($values); - unset($data['invoices']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['invoices'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Invoices' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getInvoices() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Invoices' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Invoices' === $data::class; } - $data['invoices'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Invoices(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('invoices', $data)) { + $values = []; + foreach ($data['invoices'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Invoice', 'json', $context); + } + $object->setInvoices($values); + unset($data['invoices']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getInvoices() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['invoices'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Invoices' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Invoices' => false]; + } } } diff --git a/generated/Normalizer/InvoicesPostBodyLineItemsImportExpensesNormalizer.php b/generated/Normalizer/InvoicesPostBodyLineItemsImportExpensesNormalizer.php index 8d930f5..fb277e1 100644 --- a/generated/Normalizer/InvoicesPostBodyLineItemsImportExpensesNormalizer.php +++ b/generated/Normalizer/InvoicesPostBodyLineItemsImportExpensesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,97 +22,176 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesPostBodyLineItemsImportExpensesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesPostBodyLineItemsImportExpensesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsImportExpenses(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsImportExpenses(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('summary_type', $data)) { + $object->setSummaryType($data['summary_type']); + unset($data['summary_type']); + } + if (\array_key_exists('from', $data)) { + $object->setFrom(\DateTime::createFromFormat('Y-m-d', $data['from'])->setTime(0, 0, 0)); + unset($data['from']); + } + if (\array_key_exists('to', $data)) { + $object->setTo(\DateTime::createFromFormat('Y-m-d', $data['to'])->setTime(0, 0, 0)); + unset($data['to']); + } + if (\array_key_exists('attach_receipt', $data)) { + $object->setAttachReceipt($data['attach_receipt']); + unset($data['attach_receipt']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('summary_type', $data)) { - $object->setSummaryType($data['summary_type']); - unset($data['summary_type']); - } - if (\array_key_exists('from', $data)) { - $object->setFrom(\DateTime::createFromFormat('Y-m-d', $data['from'])->setTime(0, 0, 0)); - unset($data['from']); - } - if (\array_key_exists('to', $data)) { - $object->setTo(\DateTime::createFromFormat('Y-m-d', $data['to'])->setTime(0, 0, 0)); - unset($data['to']); - } - if (\array_key_exists('attach_receipt', $data)) { - $object->setAttachReceipt($data['attach_receipt']); - unset($data['attach_receipt']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['summary_type'] = $object->getSummaryType(); + if ($object->isInitialized('from') && null !== $object->getFrom()) { + $data['from'] = $object->getFrom()->format('Y-m-d'); + } + if ($object->isInitialized('to') && null !== $object->getTo()) { + $data['to'] = $object->getTo()->format('Y-m-d'); + } + if ($object->isInitialized('attachReceipt') && null !== $object->getAttachReceipt()) { + $data['attach_receipt'] = $object->getAttachReceipt(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesPostBodyLineItemsImportExpensesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['summary_type'] = $object->getSummaryType(); - if ($object->isInitialized('from') && null !== $object->getFrom()) { - $data['from'] = $object->getFrom()->format('Y-m-d'); - } - if ($object->isInitialized('to') && null !== $object->getTo()) { - $data['to'] = $object->getTo()->format('Y-m-d'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' === $type; } - if ($object->isInitialized('attachReceipt') && null !== $object->getAttachReceipt()) { - $data['attach_receipt'] = $object->getAttachReceipt(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsImportExpenses(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('summary_type', $data)) { + $object->setSummaryType($data['summary_type']); + unset($data['summary_type']); + } + if (\array_key_exists('from', $data)) { + $object->setFrom(\DateTime::createFromFormat('Y-m-d', $data['from'])->setTime(0, 0, 0)); + unset($data['from']); + } + if (\array_key_exists('to', $data)) { + $object->setTo(\DateTime::createFromFormat('Y-m-d', $data['to'])->setTime(0, 0, 0)); + unset($data['to']); + } + if (\array_key_exists('attach_receipt', $data)) { + $object->setAttachReceipt($data['attach_receipt']); + unset($data['attach_receipt']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['summary_type'] = $object->getSummaryType(); + if ($object->isInitialized('from') && null !== $object->getFrom()) { + $data['from'] = $object->getFrom()->format('Y-m-d'); + } + if ($object->isInitialized('to') && null !== $object->getTo()) { + $data['to'] = $object->getTo()->format('Y-m-d'); + } + if ($object->isInitialized('attachReceipt') && null !== $object->getAttachReceipt()) { + $data['attach_receipt'] = $object->getAttachReceipt(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' => false]; + } } } diff --git a/generated/Normalizer/InvoicesPostBodyLineItemsImportNormalizer.php b/generated/Normalizer/InvoicesPostBodyLineItemsImportNormalizer.php index 3a1a604..cc6c557 100644 --- a/generated/Normalizer/InvoicesPostBodyLineItemsImportNormalizer.php +++ b/generated/Normalizer/InvoicesPostBodyLineItemsImportNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,98 +22,178 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesPostBodyLineItemsImportNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesPostBodyLineItemsImportNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsImport(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsImport(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('project_ids', $data)) { + $values = []; + foreach ($data['project_ids'] as $value) { + $values[] = $value; + } + $object->setProjectIds($values); + unset($data['project_ids']); + } + if (\array_key_exists('time', $data)) { + $object->setTime($this->denormalizer->denormalize($data['time'], 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime', 'json', $context)); + unset($data['time']); + } + if (\array_key_exists('expenses', $data)) { + $object->setExpenses($this->denormalizer->denormalize($data['expenses'], 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses', 'json', $context)); + unset($data['expenses']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('project_ids', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['project_ids'] as $value) { + foreach ($object->getProjectIds() as $value) { $values[] = $value; } - $object->setProjectIds($values); - unset($data['project_ids']); - } - if (\array_key_exists('time', $data)) { - $object->setTime($this->denormalizer->denormalize($data['time'], 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime', 'json', $context)); - unset($data['time']); - } - if (\array_key_exists('expenses', $data)) { - $object->setExpenses($this->denormalizer->denormalize($data['expenses'], 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses', 'json', $context)); - unset($data['expenses']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['project_ids'] = $values; + if ($object->isInitialized('time') && null !== $object->getTime()) { + $data['time'] = $this->normalizer->normalize($object->getTime(), 'json', $context); + } + if ($object->isInitialized('expenses') && null !== $object->getExpenses()) { + $data['expenses'] = $this->normalizer->normalize($object->getExpenses(), 'json', $context); } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesPostBodyLineItemsImportNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getProjectIds() as $value) { - $values[] = $value; - } - $data['project_ids'] = $values; - if ($object->isInitialized('time') && null !== $object->getTime()) { - $data['time'] = $this->normalizer->normalize($object->getTime(), 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' === $type; } - if ($object->isInitialized('expenses') && null !== $object->getExpenses()) { - $data['expenses'] = $this->normalizer->normalize($object->getExpenses(), 'json', $context); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' === $data::class; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } + $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsImport(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('project_ids', $data)) { + $values = []; + foreach ($data['project_ids'] as $value) { + $values[] = $value; + } + $object->setProjectIds($values); + unset($data['project_ids']); + } + if (\array_key_exists('time', $data)) { + $object->setTime($this->denormalizer->denormalize($data['time'], 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime', 'json', $context)); + unset($data['time']); + } + if (\array_key_exists('expenses', $data)) { + $object->setExpenses($this->denormalizer->denormalize($data['expenses'], 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses', 'json', $context)); + unset($data['expenses']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getProjectIds() as $value) { + $values[] = $value; + } + $data['project_ids'] = $values; + if ($object->isInitialized('time') && null !== $object->getTime()) { + $data['time'] = $this->normalizer->normalize($object->getTime(), 'json', $context); + } + if ($object->isInitialized('expenses') && null !== $object->getExpenses()) { + $data['expenses'] = $this->normalizer->normalize($object->getExpenses(), 'json', $context); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' => false]; + } } } diff --git a/generated/Normalizer/InvoicesPostBodyLineItemsImportTimeNormalizer.php b/generated/Normalizer/InvoicesPostBodyLineItemsImportTimeNormalizer.php index a3a8aab..e58e4d3 100644 --- a/generated/Normalizer/InvoicesPostBodyLineItemsImportTimeNormalizer.php +++ b/generated/Normalizer/InvoicesPostBodyLineItemsImportTimeNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,90 +22,162 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesPostBodyLineItemsImportTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesPostBodyLineItemsImportTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsImportTime(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsImportTime(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('summary_type', $data)) { + $object->setSummaryType($data['summary_type']); + unset($data['summary_type']); + } + if (\array_key_exists('from', $data)) { + $object->setFrom(\DateTime::createFromFormat('Y-m-d', $data['from'])->setTime(0, 0, 0)); + unset($data['from']); + } + if (\array_key_exists('to', $data)) { + $object->setTo(\DateTime::createFromFormat('Y-m-d', $data['to'])->setTime(0, 0, 0)); + unset($data['to']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('summary_type', $data)) { - $object->setSummaryType($data['summary_type']); - unset($data['summary_type']); - } - if (\array_key_exists('from', $data)) { - $object->setFrom(\DateTime::createFromFormat('Y-m-d', $data['from'])->setTime(0, 0, 0)); - unset($data['from']); - } - if (\array_key_exists('to', $data)) { - $object->setTo(\DateTime::createFromFormat('Y-m-d', $data['to'])->setTime(0, 0, 0)); - unset($data['to']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['summary_type'] = $object->getSummaryType(); + if ($object->isInitialized('from') && null !== $object->getFrom()) { + $data['from'] = $object->getFrom()->format('Y-m-d'); + } + if ($object->isInitialized('to') && null !== $object->getTo()) { + $data['to'] = $object->getTo()->format('Y-m-d'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesPostBodyLineItemsImportTimeNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['summary_type'] = $object->getSummaryType(); - if ($object->isInitialized('from') && null !== $object->getFrom()) { - $data['from'] = $object->getFrom()->format('Y-m-d'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' === $type; } - if ($object->isInitialized('to') && null !== $object->getTo()) { - $data['to'] = $object->getTo()->format('Y-m-d'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsImportTime(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('summary_type', $data)) { + $object->setSummaryType($data['summary_type']); + unset($data['summary_type']); + } + if (\array_key_exists('from', $data)) { + $object->setFrom(\DateTime::createFromFormat('Y-m-d', $data['from'])->setTime(0, 0, 0)); + unset($data['from']); + } + if (\array_key_exists('to', $data)) { + $object->setTo(\DateTime::createFromFormat('Y-m-d', $data['to'])->setTime(0, 0, 0)); + unset($data['to']); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['summary_type'] = $object->getSummaryType(); + if ($object->isInitialized('from') && null !== $object->getFrom()) { + $data['from'] = $object->getFrom()->format('Y-m-d'); + } + if ($object->isInitialized('to') && null !== $object->getTo()) { + $data['to'] = $object->getTo()->format('Y-m-d'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' => false]; + } } } diff --git a/generated/Normalizer/InvoicesPostBodyLineItemsItemNormalizer.php b/generated/Normalizer/InvoicesPostBodyLineItemsItemNormalizer.php index 6cc4588..cefaad7 100644 --- a/generated/Normalizer/InvoicesPostBodyLineItemsItemNormalizer.php +++ b/generated/Normalizer/InvoicesPostBodyLineItemsItemNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,122 +22,226 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesPostBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesPostBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' === $type; } - $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsItem(); - if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { - $data['quantity'] = (float) $data['quantity']; - } - if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { - $data['unit_price'] = (float) $data['unit_price']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsItem(); + if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { + $data['quantity'] = (float) $data['quantity']; + } + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('project_id', $data)) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } + if (\array_key_exists('kind', $data)) { + $object->setKind($data['kind']); + unset($data['kind']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('quantity', $data)) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); + } + if (\array_key_exists('unit_price', $data)) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } + if (\array_key_exists('taxed', $data)) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } + if (\array_key_exists('taxed2', $data)) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('project_id', $data)) { - $object->setProjectId($data['project_id']); - unset($data['project_id']); - } - if (\array_key_exists('kind', $data)) { - $object->setKind($data['kind']); - unset($data['kind']); - } - if (\array_key_exists('description', $data)) { - $object->setDescription($data['description']); - unset($data['description']); - } - if (\array_key_exists('quantity', $data)) { - $object->setQuantity($data['quantity']); - unset($data['quantity']); - } - if (\array_key_exists('unit_price', $data)) { - $object->setUnitPrice($data['unit_price']); - unset($data['unit_price']); - } - if (\array_key_exists('taxed', $data)) { - $object->setTaxed($data['taxed']); - unset($data['taxed']); - } - if (\array_key_exists('taxed2', $data)) { - $object->setTaxed2($data['taxed2']); - unset($data['taxed2']); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + $data['kind'] = $object->getKind(); + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + $data['unit_price'] = $object->getUnitPrice(); + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesPostBodyLineItemsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { - $data['project_id'] = $object->getProjectId(); - } - $data['kind'] = $object->getKind(); - if ($object->isInitialized('description') && null !== $object->getDescription()) { - $data['description'] = $object->getDescription(); - } - if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { - $data['quantity'] = $object->getQuantity(); - } - $data['unit_price'] = $object->getUnitPrice(); - if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { - $data['taxed'] = $object->getTaxed(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' === $type; } - if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { - $data['taxed2'] = $object->getTaxed2(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBodyLineItemsItem(); + if (\array_key_exists('quantity', $data) && \is_int($data['quantity'])) { + $data['quantity'] = (float) $data['quantity']; + } + if (\array_key_exists('unit_price', $data) && \is_int($data['unit_price'])) { + $data['unit_price'] = (float) $data['unit_price']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('project_id', $data)) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } + if (\array_key_exists('kind', $data)) { + $object->setKind($data['kind']); + unset($data['kind']); + } + if (\array_key_exists('description', $data)) { + $object->setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('quantity', $data)) { + $object->setQuantity($data['quantity']); + unset($data['quantity']); } + if (\array_key_exists('unit_price', $data)) { + $object->setUnitPrice($data['unit_price']); + unset($data['unit_price']); + } + if (\array_key_exists('taxed', $data)) { + $object->setTaxed($data['taxed']); + unset($data['taxed']); + } + if (\array_key_exists('taxed2', $data)) { + $object->setTaxed2($data['taxed2']); + unset($data['taxed2']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + $data['kind'] = $object->getKind(); + if ($object->isInitialized('description') && null !== $object->getDescription()) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('quantity') && null !== $object->getQuantity()) { + $data['quantity'] = $object->getQuantity(); + } + $data['unit_price'] = $object->getUnitPrice(); + if ($object->isInitialized('taxed') && null !== $object->getTaxed()) { + $data['taxed'] = $object->getTaxed(); + } + if ($object->isInitialized('taxed2') && null !== $object->getTaxed2()) { + $data['taxed2'] = $object->getTaxed2(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' => false]; + } } } diff --git a/generated/Normalizer/InvoicesPostBodyNormalizer.php b/generated/Normalizer/InvoicesPostBodyNormalizer.php index 12bcbf2..89f640d 100644 --- a/generated/Normalizer/InvoicesPostBodyNormalizer.php +++ b/generated/Normalizer/InvoicesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,247 +22,476 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class InvoicesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class InvoicesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBody(); - if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { - $data['tax'] = (float) $data['tax']; - } - if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { - $data['tax2'] = (float) $data['tax2']; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' === $type; } - if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { - $data['discount'] = (float) $data['discount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBody(); + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('estimate_id', $data) && null !== $data['estimate_id']) { + $object->setEstimateId($data['estimate_id']); + unset($data['estimate_id']); + } elseif (\array_key_exists('estimate_id', $data) && null === $data['estimate_id']) { + $object->setEstimateId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('due_date', $data) && null !== $data['due_date']) { + $object->setDueDate(\DateTime::createFromFormat('Y-m-d', $data['due_date'])->setTime(0, 0, 0)); + unset($data['due_date']); + } elseif (\array_key_exists('due_date', $data) && null === $data['due_date']) { + $object->setDueDate(null); + } + if (\array_key_exists('payment_term', $data) && null !== $data['payment_term']) { + $object->setPaymentTerm($data['payment_term']); + unset($data['payment_term']); + } elseif (\array_key_exists('payment_term', $data) && null === $data['payment_term']) { + $object->setPaymentTerm(null); + } + if (\array_key_exists('payment_options', $data) && null !== $data['payment_options']) { + $values = []; + foreach ($data['payment_options'] as $value) { + $values[] = $value; + } + $object->setPaymentOptions($values); + unset($data['payment_options']); + } elseif (\array_key_exists('payment_options', $data) && null === $data['payment_options']) { + $object->setPaymentOptions(null); + } + if (\array_key_exists('line_items_import', $data) && null !== $data['line_items_import']) { + $object->setLineItemsImport($this->denormalizer->denormalize($data['line_items_import'], 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport', 'json', $context)); + unset($data['line_items_import']); + } elseif (\array_key_exists('line_items_import', $data) && null === $data['line_items_import']) { + $object->setLineItemsImport(null); + } + if (\array_key_exists('retainer_id', $data) && null !== $data['retainer_id']) { + $object->setRetainerId($data['retainer_id']); + unset($data['retainer_id']); + } elseif (\array_key_exists('retainer_id', $data) && null === $data['retainer_id']) { + $object->setRetainerId(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values_1 = []; + foreach ($data['line_items'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem', 'json', $context); + } + $object->setLineItems($values_1); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('estimate_id', $data) && null !== $data['estimate_id']) { - $object->setEstimateId($data['estimate_id']); - unset($data['estimate_id']); - } elseif (\array_key_exists('estimate_id', $data) && null === $data['estimate_id']) { - $object->setEstimateId(null); - } - if (\array_key_exists('number', $data) && null !== $data['number']) { - $object->setNumber($data['number']); - unset($data['number']); - } elseif (\array_key_exists('number', $data) && null === $data['number']) { - $object->setNumber(null); - } - if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { - $object->setPurchaseOrder($data['purchase_order']); - unset($data['purchase_order']); - } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { - $object->setPurchaseOrder(null); - } - if (\array_key_exists('tax', $data) && null !== $data['tax']) { - $object->setTax($data['tax']); - unset($data['tax']); - } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { - $object->setTax(null); - } - if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { - $object->setTax2($data['tax2']); - unset($data['tax2']); - } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { - $object->setTax2(null); - } - if (\array_key_exists('discount', $data) && null !== $data['discount']) { - $object->setDiscount($data['discount']); - unset($data['discount']); - } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { - $object->setDiscount(null); - } - if (\array_key_exists('subject', $data) && null !== $data['subject']) { - $object->setSubject($data['subject']); - unset($data['subject']); - } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { - $object->setSubject(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { - $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); - unset($data['issue_date']); - } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { - $object->setIssueDate(null); - } - if (\array_key_exists('due_date', $data) && null !== $data['due_date']) { - $object->setDueDate(\DateTime::createFromFormat('Y-m-d', $data['due_date'])->setTime(0, 0, 0)); - unset($data['due_date']); - } elseif (\array_key_exists('due_date', $data) && null === $data['due_date']) { - $object->setDueDate(null); - } - if (\array_key_exists('payment_term', $data) && null !== $data['payment_term']) { - $object->setPaymentTerm($data['payment_term']); - unset($data['payment_term']); - } elseif (\array_key_exists('payment_term', $data) && null === $data['payment_term']) { - $object->setPaymentTerm(null); - } - if (\array_key_exists('payment_options', $data) && null !== $data['payment_options']) { - $values = []; - foreach ($data['payment_options'] as $value) { - $values[] = $value; - } - $object->setPaymentOptions($values); - unset($data['payment_options']); - } elseif (\array_key_exists('payment_options', $data) && null === $data['payment_options']) { - $object->setPaymentOptions(null); - } - if (\array_key_exists('line_items_import', $data) && null !== $data['line_items_import']) { - $object->setLineItemsImport($this->denormalizer->denormalize($data['line_items_import'], 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport', 'json', $context)); - unset($data['line_items_import']); - } elseif (\array_key_exists('line_items_import', $data) && null === $data['line_items_import']) { - $object->setLineItemsImport(null); - } - if (\array_key_exists('retainer_id', $data) && null !== $data['retainer_id']) { - $object->setRetainerId($data['retainer_id']); - unset($data['retainer_id']); - } elseif (\array_key_exists('retainer_id', $data) && null === $data['retainer_id']) { - $object->setRetainerId(null); - } - if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { - $values_1 = []; - foreach ($data['line_items'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem', 'json', $context); - } - $object->setLineItems($values_1); - unset($data['line_items']); - } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { - $object->setLineItems(null); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['client_id'] = $object->getClientId(); + if ($object->isInitialized('estimateId') && null !== $object->getEstimateId()) { + $data['estimate_id'] = $object->getEstimateId(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('dueDate') && null !== $object->getDueDate()) { + $data['due_date'] = $object->getDueDate()->format('Y-m-d'); + } + if ($object->isInitialized('paymentTerm') && null !== $object->getPaymentTerm()) { + $data['payment_term'] = $object->getPaymentTerm(); + } + if ($object->isInitialized('paymentOptions') && null !== $object->getPaymentOptions()) { + $values = []; + foreach ($object->getPaymentOptions() as $value) { + $values[] = $value; + } + $data['payment_options'] = $values; + } + if ($object->isInitialized('lineItemsImport') && null !== $object->getLineItemsImport()) { + $data['line_items_import'] = $this->normalizer->normalize($object->getLineItemsImport(), 'json', $context); + } + if ($object->isInitialized('retainerId') && null !== $object->getRetainerId()) { + $data['retainer_id'] = $object->getRetainerId(); } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values_1 = []; + foreach ($object->getLineItems() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $data['line_items'] = $values_1; + } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class InvoicesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['client_id'] = $object->getClientId(); - if ($object->isInitialized('estimateId') && null !== $object->getEstimateId()) { - $data['estimate_id'] = $object->getEstimateId(); - } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); - } - if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { - $data['purchase_order'] = $object->getPurchaseOrder(); - } - if ($object->isInitialized('tax') && null !== $object->getTax()) { - $data['tax'] = $object->getTax(); - } - if ($object->isInitialized('tax2') && null !== $object->getTax2()) { - $data['tax2'] = $object->getTax2(); - } - if ($object->isInitialized('discount') && null !== $object->getDiscount()) { - $data['discount'] = $object->getDiscount(); - } - if ($object->isInitialized('subject') && null !== $object->getSubject()) { - $data['subject'] = $object->getSubject(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); - } - if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { - $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); - } - if ($object->isInitialized('dueDate') && null !== $object->getDueDate()) { - $data['due_date'] = $object->getDueDate()->format('Y-m-d'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' === $type; } - if ($object->isInitialized('paymentTerm') && null !== $object->getPaymentTerm()) { - $data['payment_term'] = $object->getPaymentTerm(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' === $data::class; } - if ($object->isInitialized('paymentOptions') && null !== $object->getPaymentOptions()) { - $values = []; - foreach ($object->getPaymentOptions() as $value) { - $values[] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['payment_options'] = $values; - } - if ($object->isInitialized('lineItemsImport') && null !== $object->getLineItemsImport()) { - $data['line_items_import'] = $this->normalizer->normalize($object->getLineItemsImport(), 'json', $context); - } - if ($object->isInitialized('retainerId') && null !== $object->getRetainerId()) { - $data['retainer_id'] = $object->getRetainerId(); - } - if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { - $values_1 = []; - foreach ($object->getLineItems() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - $data['line_items'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; + $object = new \JoliCode\Harvest\Api\Model\InvoicesPostBody(); + if (\array_key_exists('tax', $data) && \is_int($data['tax'])) { + $data['tax'] = (float) $data['tax']; + } + if (\array_key_exists('tax2', $data) && \is_int($data['tax2'])) { + $data['tax2'] = (float) $data['tax2']; + } + if (\array_key_exists('discount', $data) && \is_int($data['discount'])) { + $data['discount'] = (float) $data['discount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('estimate_id', $data) && null !== $data['estimate_id']) { + $object->setEstimateId($data['estimate_id']); + unset($data['estimate_id']); + } elseif (\array_key_exists('estimate_id', $data) && null === $data['estimate_id']) { + $object->setEstimateId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + if (\array_key_exists('purchase_order', $data) && null !== $data['purchase_order']) { + $object->setPurchaseOrder($data['purchase_order']); + unset($data['purchase_order']); + } elseif (\array_key_exists('purchase_order', $data) && null === $data['purchase_order']) { + $object->setPurchaseOrder(null); + } + if (\array_key_exists('tax', $data) && null !== $data['tax']) { + $object->setTax($data['tax']); + unset($data['tax']); + } elseif (\array_key_exists('tax', $data) && null === $data['tax']) { + $object->setTax(null); + } + if (\array_key_exists('tax2', $data) && null !== $data['tax2']) { + $object->setTax2($data['tax2']); + unset($data['tax2']); + } elseif (\array_key_exists('tax2', $data) && null === $data['tax2']) { + $object->setTax2(null); + } + if (\array_key_exists('discount', $data) && null !== $data['discount']) { + $object->setDiscount($data['discount']); + unset($data['discount']); + } elseif (\array_key_exists('discount', $data) && null === $data['discount']) { + $object->setDiscount(null); + } + if (\array_key_exists('subject', $data) && null !== $data['subject']) { + $object->setSubject($data['subject']); + unset($data['subject']); + } elseif (\array_key_exists('subject', $data) && null === $data['subject']) { + $object->setSubject(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('issue_date', $data) && null !== $data['issue_date']) { + $object->setIssueDate(\DateTime::createFromFormat('Y-m-d', $data['issue_date'])->setTime(0, 0, 0)); + unset($data['issue_date']); + } elseif (\array_key_exists('issue_date', $data) && null === $data['issue_date']) { + $object->setIssueDate(null); + } + if (\array_key_exists('due_date', $data) && null !== $data['due_date']) { + $object->setDueDate(\DateTime::createFromFormat('Y-m-d', $data['due_date'])->setTime(0, 0, 0)); + unset($data['due_date']); + } elseif (\array_key_exists('due_date', $data) && null === $data['due_date']) { + $object->setDueDate(null); + } + if (\array_key_exists('payment_term', $data) && null !== $data['payment_term']) { + $object->setPaymentTerm($data['payment_term']); + unset($data['payment_term']); + } elseif (\array_key_exists('payment_term', $data) && null === $data['payment_term']) { + $object->setPaymentTerm(null); + } + if (\array_key_exists('payment_options', $data) && null !== $data['payment_options']) { + $values = []; + foreach ($data['payment_options'] as $value) { + $values[] = $value; + } + $object->setPaymentOptions($values); + unset($data['payment_options']); + } elseif (\array_key_exists('payment_options', $data) && null === $data['payment_options']) { + $object->setPaymentOptions(null); + } + if (\array_key_exists('line_items_import', $data) && null !== $data['line_items_import']) { + $object->setLineItemsImport($this->denormalizer->denormalize($data['line_items_import'], 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport', 'json', $context)); + unset($data['line_items_import']); + } elseif (\array_key_exists('line_items_import', $data) && null === $data['line_items_import']) { + $object->setLineItemsImport(null); + } + if (\array_key_exists('retainer_id', $data) && null !== $data['retainer_id']) { + $object->setRetainerId($data['retainer_id']); + unset($data['retainer_id']); + } elseif (\array_key_exists('retainer_id', $data) && null === $data['retainer_id']) { + $object->setRetainerId(null); + } + if (\array_key_exists('line_items', $data) && null !== $data['line_items']) { + $values_1 = []; + foreach ($data['line_items'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem', 'json', $context); + } + $object->setLineItems($values_1); + unset($data['line_items']); + } elseif (\array_key_exists('line_items', $data) && null === $data['line_items']) { + $object->setLineItems(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['client_id'] = $object->getClientId(); + if ($object->isInitialized('estimateId') && null !== $object->getEstimateId()) { + $data['estimate_id'] = $object->getEstimateId(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + if ($object->isInitialized('purchaseOrder') && null !== $object->getPurchaseOrder()) { + $data['purchase_order'] = $object->getPurchaseOrder(); + } + if ($object->isInitialized('tax') && null !== $object->getTax()) { + $data['tax'] = $object->getTax(); + } + if ($object->isInitialized('tax2') && null !== $object->getTax2()) { + $data['tax2'] = $object->getTax2(); + } + if ($object->isInitialized('discount') && null !== $object->getDiscount()) { + $data['discount'] = $object->getDiscount(); + } + if ($object->isInitialized('subject') && null !== $object->getSubject()) { + $data['subject'] = $object->getSubject(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('issueDate') && null !== $object->getIssueDate()) { + $data['issue_date'] = $object->getIssueDate()->format('Y-m-d'); + } + if ($object->isInitialized('dueDate') && null !== $object->getDueDate()) { + $data['due_date'] = $object->getDueDate()->format('Y-m-d'); + } + if ($object->isInitialized('paymentTerm') && null !== $object->getPaymentTerm()) { + $data['payment_term'] = $object->getPaymentTerm(); + } + if ($object->isInitialized('paymentOptions') && null !== $object->getPaymentOptions()) { + $values = []; + foreach ($object->getPaymentOptions() as $value) { + $values[] = $value; + } + $data['payment_options'] = $values; + } + if ($object->isInitialized('lineItemsImport') && null !== $object->getLineItemsImport()) { + $data['line_items_import'] = $this->normalizer->normalize($object->getLineItemsImport(), 'json', $context); + } + if ($object->isInitialized('retainerId') && null !== $object->getRetainerId()) { + $data['retainer_id'] = $object->getRetainerId(); + } + if ($object->isInitialized('lineItems') && null !== $object->getLineItems()) { + $values_1 = []; + foreach ($object->getLineItems() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $data['line_items'] = $values_1; + } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' => false]; + } } } diff --git a/generated/Normalizer/JaneObjectNormalizer.php b/generated/Normalizer/JaneObjectNormalizer.php index 33f48ae..57f4788 100644 --- a/generated/Normalizer/JaneObjectNormalizer.php +++ b/generated/Normalizer/JaneObjectNormalizer.php @@ -13,6 +13,7 @@ use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -20,71 +21,124 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - protected $normalizers = ['JoliCode\\Harvest\\Api\\Model\\Contact' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ContactClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Client' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Company' => 'JoliCode\\Harvest\\Api\\Normalizer\\CompanyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageRecipientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicePaymentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicePaymentPaymentGatewayNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Invoice' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceEstimateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceRetainerNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceCreatorNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceLineItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceLineItemProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessageNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessageRecipientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Estimate' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateCreatorNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateLineItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Expense' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseExpenseCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseUserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseReceiptNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseInvoiceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Task' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryUserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryTaskNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryExternalReferenceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryInvoiceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentUserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentTaskNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Project' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Role' => 'JoliCode\\Harvest\\Api\\Normalizer\\RoleNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Teammate' => 'JoliCode\\Harvest\\Api\\Normalizer\\TeammateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\BillableRate' => 'JoliCode\\Harvest\\Api\\Normalizer\\BillableRateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\CostRate' => 'JoliCode\\Harvest\\Api\\Normalizer\\CostRateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\User' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseReportsResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\UninvoicedReportResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeReportsResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectBudgetReportResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Contacts' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Clients' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Companies' => 'JoliCode\\Harvest\\Api\\Normalizer\\CompaniesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessagesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageRecipientsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicePaymentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Invoices' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceLineItemsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessagesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessageRecipientsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Estimates' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateLineItemsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Expenses' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpensesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Tasks' => 'JoliCode\\Harvest\\Api\\Normalizer\\TasksNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Projects' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Roles' => 'JoliCode\\Harvest\\Api\\Normalizer\\RolesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Teammates' => 'JoliCode\\Harvest\\Api\\Normalizer\\TeammatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\BillableRates' => 'JoliCode\\Harvest\\Api\\Normalizer\\BillableRatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\CostRates' => 'JoliCode\\Harvest\\Api\\Normalizer\\CostRatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Users' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseReportsResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\UninvoicedReportResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeReportsResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectBudgetReportResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Error' => 'JoliCode\\Harvest\\Api\\Normalizer\\ErrorNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageSubjectAndBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' => 'JoliCode\\Harvest\\Api\\Normalizer\\PaginationLinksNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' => 'JoliCode\\Harvest\\Api\\Normalizer\\TeammatesPatchResponseNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientsClientIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\CompanyPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactsContactIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoriesEstimateItemCategoryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesPostBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdPatchBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdMessagesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdMessagesPostBodyRecipientsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoriesExpenseCategoryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpensesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpensesExpenseIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsImportNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsImportTimeNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsImportExpensesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdPatchBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdMessagesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdMessagesPostBodyRecipientsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdPaymentsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdTaskAssignmentsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdUserAssignmentsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\RolesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\RolesRoleIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TasksPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TasksTaskIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesPostBodyExternalReferenceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesTimeEntryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesTimeEntryIdPatchBodyExternalReferenceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdBillableRatesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdCostRatesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdTeammatesPatchBodyNormalizer', '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => '\\JoliCode\\Harvest\\Api\\Runtime\\Normalizer\\ReferenceNormalizer']; - protected $normalizersCache = []; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \array_key_exists($type, $this->normalizers); - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + protected $normalizers = ['JoliCode\\Harvest\\Api\\Model\\Contact' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ContactClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Client' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Company' => 'JoliCode\\Harvest\\Api\\Normalizer\\CompanyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageRecipientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicePaymentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicePaymentPaymentGatewayNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Invoice' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceEstimateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceRetainerNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceCreatorNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceLineItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceLineItemProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessageNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessageRecipientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Estimate' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateCreatorNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateLineItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Expense' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseExpenseCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseUserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseReceiptNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseInvoiceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Task' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryUserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryTaskNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryExternalReferenceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryInvoiceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentUserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentTaskNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Project' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Role' => 'JoliCode\\Harvest\\Api\\Normalizer\\RoleNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Teammate' => 'JoliCode\\Harvest\\Api\\Normalizer\\TeammateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\BillableRate' => 'JoliCode\\Harvest\\Api\\Normalizer\\BillableRateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\CostRate' => 'JoliCode\\Harvest\\Api\\Normalizer\\CostRateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\User' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseReportsResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\UninvoicedReportResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeReportsResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectBudgetReportResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Contacts' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Clients' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Companies' => 'JoliCode\\Harvest\\Api\\Normalizer\\CompaniesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessagesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageRecipientsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicePaymentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Invoices' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceLineItemsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessagesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessageRecipientsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Estimates' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateLineItemsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Expenses' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpensesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Tasks' => 'JoliCode\\Harvest\\Api\\Normalizer\\TasksNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Projects' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Roles' => 'JoliCode\\Harvest\\Api\\Normalizer\\RolesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Teammates' => 'JoliCode\\Harvest\\Api\\Normalizer\\TeammatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\BillableRates' => 'JoliCode\\Harvest\\Api\\Normalizer\\BillableRatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\CostRates' => 'JoliCode\\Harvest\\Api\\Normalizer\\CostRatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Users' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseReportsResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\UninvoicedReportResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeReportsResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectBudgetReportResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Error' => 'JoliCode\\Harvest\\Api\\Normalizer\\ErrorNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageSubjectAndBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' => 'JoliCode\\Harvest\\Api\\Normalizer\\PaginationLinksNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' => 'JoliCode\\Harvest\\Api\\Normalizer\\TeammatesPatchResponseNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientsClientIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\CompanyPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactsContactIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoriesEstimateItemCategoryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesPostBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdPatchBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdMessagesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdMessagesPostBodyRecipientsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoriesExpenseCategoryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpensesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpensesExpenseIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsImportNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsImportTimeNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsImportExpensesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdPatchBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdMessagesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdMessagesPostBodyRecipientsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdPaymentsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdTaskAssignmentsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdUserAssignmentsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\RolesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\RolesRoleIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TasksPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TasksTaskIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesPostBodyExternalReferenceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesTimeEntryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesTimeEntryIdPatchBodyExternalReferenceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdBillableRatesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdCostRatesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdTeammatesPatchBodyNormalizer', '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => '\\JoliCode\\Harvest\\Api\\Runtime\\Normalizer\\ReferenceNormalizer']; + protected $normalizersCache = []; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && \array_key_exists($data::class, $this->normalizers); - } + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool + { + return \array_key_exists($type, $this->normalizers); + } - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $normalizerClass = $this->normalizers[$object::class]; - $normalizer = $this->getNormalizer($normalizerClass); + public function supportsNormalization($data, $format = null, array $context = []): bool + { + return \is_object($data) && \array_key_exists($data::class, $this->normalizers); + } - return $normalizer->normalize($object, $format, $context); - } + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $normalizerClass = $this->normalizers[$object::class]; + $normalizer = $this->getNormalizer($normalizerClass); - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - $denormalizerClass = $this->normalizers[$class]; - $denormalizer = $this->getNormalizer($denormalizerClass); + return $normalizer->normalize($object, $format, $context); + } - return $denormalizer->denormalize($data, $class, $format, $context); - } + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + $denormalizerClass = $this->normalizers[$type]; + $denormalizer = $this->getNormalizer($denormalizerClass); - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Contact' => false, 'JoliCode\\Harvest\\Api\\Model\\ContactClient' => false, 'JoliCode\\Harvest\\Api\\Model\\Client' => false, 'JoliCode\\Harvest\\Api\\Model\\Company' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' => false, 'JoliCode\\Harvest\\Api\\Model\\Invoice' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' => false, 'JoliCode\\Harvest\\Api\\Model\\Estimate' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\Expense' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\Task' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' => false, 'JoliCode\\Harvest\\Api\\Model\\Project' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' => false, 'JoliCode\\Harvest\\Api\\Model\\Role' => false, 'JoliCode\\Harvest\\Api\\Model\\Teammate' => false, 'JoliCode\\Harvest\\Api\\Model\\BillableRate' => false, 'JoliCode\\Harvest\\Api\\Model\\CostRate' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' => false, 'JoliCode\\Harvest\\Api\\Model\\User' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' => false, 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' => false, 'JoliCode\\Harvest\\Api\\Model\\Contacts' => false, 'JoliCode\\Harvest\\Api\\Model\\Clients' => false, 'JoliCode\\Harvest\\Api\\Model\\Companies' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' => false, 'JoliCode\\Harvest\\Api\\Model\\Invoices' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' => false, 'JoliCode\\Harvest\\Api\\Model\\Estimates' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' => false, 'JoliCode\\Harvest\\Api\\Model\\Expenses' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' => false, 'JoliCode\\Harvest\\Api\\Model\\Tasks' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' => false, 'JoliCode\\Harvest\\Api\\Model\\Projects' => false, 'JoliCode\\Harvest\\Api\\Model\\Roles' => false, 'JoliCode\\Harvest\\Api\\Model\\Teammates' => false, 'JoliCode\\Harvest\\Api\\Model\\BillableRates' => false, 'JoliCode\\Harvest\\Api\\Model\\CostRates' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' => false, 'JoliCode\\Harvest\\Api\\Model\\Users' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' => false, 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' => false, 'JoliCode\\Harvest\\Api\\Model\\Error' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' => false, 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' => false, 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' => false, 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' => false, '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => false]; - } + return $denormalizer->denormalize($data, $type, $format, $context); + } - private function getNormalizer(string $normalizerClass) - { - return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); - } + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Contact' => false, 'JoliCode\\Harvest\\Api\\Model\\ContactClient' => false, 'JoliCode\\Harvest\\Api\\Model\\Client' => false, 'JoliCode\\Harvest\\Api\\Model\\Company' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' => false, 'JoliCode\\Harvest\\Api\\Model\\Invoice' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' => false, 'JoliCode\\Harvest\\Api\\Model\\Estimate' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\Expense' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\Task' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' => false, 'JoliCode\\Harvest\\Api\\Model\\Project' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' => false, 'JoliCode\\Harvest\\Api\\Model\\Role' => false, 'JoliCode\\Harvest\\Api\\Model\\Teammate' => false, 'JoliCode\\Harvest\\Api\\Model\\BillableRate' => false, 'JoliCode\\Harvest\\Api\\Model\\CostRate' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' => false, 'JoliCode\\Harvest\\Api\\Model\\User' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' => false, 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' => false, 'JoliCode\\Harvest\\Api\\Model\\Contacts' => false, 'JoliCode\\Harvest\\Api\\Model\\Clients' => false, 'JoliCode\\Harvest\\Api\\Model\\Companies' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' => false, 'JoliCode\\Harvest\\Api\\Model\\Invoices' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' => false, 'JoliCode\\Harvest\\Api\\Model\\Estimates' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' => false, 'JoliCode\\Harvest\\Api\\Model\\Expenses' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' => false, 'JoliCode\\Harvest\\Api\\Model\\Tasks' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' => false, 'JoliCode\\Harvest\\Api\\Model\\Projects' => false, 'JoliCode\\Harvest\\Api\\Model\\Roles' => false, 'JoliCode\\Harvest\\Api\\Model\\Teammates' => false, 'JoliCode\\Harvest\\Api\\Model\\BillableRates' => false, 'JoliCode\\Harvest\\Api\\Model\\CostRates' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' => false, 'JoliCode\\Harvest\\Api\\Model\\Users' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' => false, 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' => false, 'JoliCode\\Harvest\\Api\\Model\\Error' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' => false, 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' => false, 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' => false, 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' => false, '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => false]; + } - private function initNormalizer(string $normalizerClass) + private function getNormalizer(string $normalizerClass) + { + return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); + } + + private function initNormalizer(string $normalizerClass) + { + $normalizer = new $normalizerClass(); + $normalizer->setNormalizer($this->normalizer); + $normalizer->setDenormalizer($this->denormalizer); + $this->normalizersCache[$normalizerClass] = $normalizer; + + return $normalizer; + } + } +} else { + class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $normalizer = new $normalizerClass(); - $normalizer->setNormalizer($this->normalizer); - $normalizer->setDenormalizer($this->denormalizer); - $this->normalizersCache[$normalizerClass] = $normalizer; + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + protected $normalizers = ['JoliCode\\Harvest\\Api\\Model\\Contact' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ContactClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Client' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Company' => 'JoliCode\\Harvest\\Api\\Normalizer\\CompanyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageRecipientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicePaymentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicePaymentPaymentGatewayNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Invoice' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceEstimateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceRetainerNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceCreatorNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceLineItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceLineItemProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessageNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessageRecipientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Estimate' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateCreatorNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateLineItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Expense' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseExpenseCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseUserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseReceiptNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseInvoiceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Task' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryUserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryTaskNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryExternalReferenceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntryInvoiceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentUserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentTaskNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Project' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Role' => 'JoliCode\\Harvest\\Api\\Normalizer\\RoleNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Teammate' => 'JoliCode\\Harvest\\Api\\Normalizer\\TeammateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\BillableRate' => 'JoliCode\\Harvest\\Api\\Normalizer\\BillableRateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\CostRate' => 'JoliCode\\Harvest\\Api\\Normalizer\\CostRateNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentProjectNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentClientNormalizer', 'JoliCode\\Harvest\\Api\\Model\\User' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseReportsResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\UninvoicedReportResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeReportsResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectBudgetReportResultNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Contacts' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Clients' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Companies' => 'JoliCode\\Harvest\\Api\\Normalizer\\CompaniesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessagesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageRecipientsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicePaymentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Invoices' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceLineItemsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessagesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateMessageRecipientsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Estimates' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateLineItemsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Expenses' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpensesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Tasks' => 'JoliCode\\Harvest\\Api\\Normalizer\\TasksNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' => 'JoliCode\\Harvest\\Api\\Normalizer\\UserAssignmentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' => 'JoliCode\\Harvest\\Api\\Normalizer\\TaskAssignmentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Projects' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Roles' => 'JoliCode\\Harvest\\Api\\Normalizer\\RolesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Teammates' => 'JoliCode\\Harvest\\Api\\Normalizer\\TeammatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\BillableRates' => 'JoliCode\\Harvest\\Api\\Normalizer\\BillableRatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\CostRates' => 'JoliCode\\Harvest\\Api\\Normalizer\\CostRatesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectAssignmentsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Users' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseReportsResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\UninvoicedReportResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeReportsResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectBudgetReportResultsNormalizer', 'JoliCode\\Harvest\\Api\\Model\\Error' => 'JoliCode\\Harvest\\Api\\Normalizer\\ErrorNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceMessageSubjectAndBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' => 'JoliCode\\Harvest\\Api\\Normalizer\\PaginationLinksNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' => 'JoliCode\\Harvest\\Api\\Normalizer\\TeammatesPatchResponseNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ClientsClientIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\CompanyPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ContactsContactIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimateItemCategoriesEstimateItemCategoryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesPostBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdPatchBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdMessagesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\EstimatesEstimateIdMessagesPostBodyRecipientsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpenseCategoriesExpenseCategoryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpensesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ExpensesExpenseIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsImportNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsImportTimeNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsImportExpensesNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesPostBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdPatchBodyLineItemsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdMessagesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdMessagesPostBodyRecipientsItemNormalizer', 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\InvoicesInvoiceIdPaymentsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdTaskAssignmentsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdUserAssignmentsPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\RolesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\RolesRoleIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TasksPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TasksTaskIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesPostBodyExternalReferenceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesTimeEntryIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' => 'JoliCode\\Harvest\\Api\\Normalizer\\TimeEntriesTimeEntryIdPatchBodyExternalReferenceNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdPatchBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdBillableRatesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdCostRatesPostBodyNormalizer', 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' => 'JoliCode\\Harvest\\Api\\Normalizer\\UsersUserIdTeammatesPatchBodyNormalizer', '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => '\\JoliCode\\Harvest\\Api\\Runtime\\Normalizer\\ReferenceNormalizer']; + protected $normalizersCache = []; + + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool + { + return \array_key_exists($type, $this->normalizers); + } + + public function supportsNormalization($data, $format = null, array $context = []): bool + { + return \is_object($data) && \array_key_exists($data::class, $this->normalizers); + } + + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $normalizerClass = $this->normalizers[$object::class]; + $normalizer = $this->getNormalizer($normalizerClass); + + return $normalizer->normalize($object, $format, $context); + } + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + $denormalizerClass = $this->normalizers[$type]; + $denormalizer = $this->getNormalizer($denormalizerClass); + + return $denormalizer->denormalize($data, $type, $format, $context); + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Contact' => false, 'JoliCode\\Harvest\\Api\\Model\\ContactClient' => false, 'JoliCode\\Harvest\\Api\\Model\\Client' => false, 'JoliCode\\Harvest\\Api\\Model\\Company' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessage' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipient' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicePayment' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicePaymentPaymentGateway' => false, 'JoliCode\\Harvest\\Api\\Model\\Invoice' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceClient' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceEstimate' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceRetainer' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceCreator' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItemProject' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessage' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipient' => false, 'JoliCode\\Harvest\\Api\\Model\\Estimate' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateClient' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateCreator' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItem' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\Expense' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseClient' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseProject' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseExpenseCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseUser' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReceipt' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseInvoice' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategory' => false, 'JoliCode\\Harvest\\Api\\Model\\Task' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' => false, 'JoliCode\\Harvest\\Api\\Model\\Project' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' => false, 'JoliCode\\Harvest\\Api\\Model\\Role' => false, 'JoliCode\\Harvest\\Api\\Model\\Teammate' => false, 'JoliCode\\Harvest\\Api\\Model\\BillableRate' => false, 'JoliCode\\Harvest\\Api\\Model\\CostRate' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' => false, 'JoliCode\\Harvest\\Api\\Model\\User' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResult' => false, 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' => false, 'JoliCode\\Harvest\\Api\\Model\\Contacts' => false, 'JoliCode\\Harvest\\Api\\Model\\Clients' => false, 'JoliCode\\Harvest\\Api\\Model\\Companies' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessages' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageRecipients' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicePayments' => false, 'JoliCode\\Harvest\\Api\\Model\\Invoices' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceLineItems' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategories' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessages' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateMessageRecipients' => false, 'JoliCode\\Harvest\\Api\\Model\\Estimates' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateLineItems' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategories' => false, 'JoliCode\\Harvest\\Api\\Model\\Expenses' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategories' => false, 'JoliCode\\Harvest\\Api\\Model\\Tasks' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' => false, 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' => false, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' => false, 'JoliCode\\Harvest\\Api\\Model\\Projects' => false, 'JoliCode\\Harvest\\Api\\Model\\Roles' => false, 'JoliCode\\Harvest\\Api\\Model\\Teammates' => false, 'JoliCode\\Harvest\\Api\\Model\\BillableRates' => false, 'JoliCode\\Harvest\\Api\\Model\\CostRates' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' => false, 'JoliCode\\Harvest\\Api\\Model\\Users' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseReportsResults' => false, 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' => false, 'JoliCode\\Harvest\\Api\\Model\\Error' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceMessageSubjectAndBody' => false, 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' => false, 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' => false, 'JoliCode\\Harvest\\Api\\Model\\ClientsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ClientsClientIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\CompanyPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ContactsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ContactsContactIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimateItemCategoriesEstimateItemCategoryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesPostBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdPatchBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\EstimatesEstimateIdMessagesPostBodyRecipientsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpenseCategoriesExpenseCategoryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpensesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ExpensesExpenseIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoiceItemCategoriesInvoiceItemCategoryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImport' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportTime' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsImportExpenses' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesPostBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPatchBodyLineItemsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdMessagesPostBodyRecipientsItem' => false, 'JoliCode\\Harvest\\Api\\Model\\InvoicesInvoiceIdPaymentsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' => false, 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' => false, '\\Jane\\Component\\JsonSchemaRuntime\\Reference' => false]; + } + + private function getNormalizer(string $normalizerClass) + { + return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); + } + + private function initNormalizer(string $normalizerClass) + { + $normalizer = new $normalizerClass(); + $normalizer->setNormalizer($this->normalizer); + $normalizer->setDenormalizer($this->denormalizer); + $this->normalizersCache[$normalizerClass] = $normalizer; - return $normalizer; + return $normalizer; + } } } diff --git a/generated/Normalizer/PaginationLinksNormalizer.php b/generated/Normalizer/PaginationLinksNormalizer.php index 9c0bec3..414f6ad 100644 --- a/generated/Normalizer/PaginationLinksNormalizer.php +++ b/generated/Normalizer/PaginationLinksNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,99 +22,180 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class PaginationLinksNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class PaginationLinksNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\PaginationLinks(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\PaginationLinks(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('first', $data)) { + $object->setFirst($data['first']); + unset($data['first']); + } + if (\array_key_exists('last', $data)) { + $object->setLast($data['last']); + unset($data['last']); + } + if (\array_key_exists('previous', $data) && null !== $data['previous']) { + $object->setPrevious($data['previous']); + unset($data['previous']); + } elseif (\array_key_exists('previous', $data) && null === $data['previous']) { + $object->setPrevious(null); + } + if (\array_key_exists('next', $data) && null !== $data['next']) { + $object->setNext($data['next']); + unset($data['next']); + } elseif (\array_key_exists('next', $data) && null === $data['next']) { + $object->setNext(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('first', $data)) { - $object->setFirst($data['first']); - unset($data['first']); - } - if (\array_key_exists('last', $data)) { - $object->setLast($data['last']); - unset($data['last']); - } - if (\array_key_exists('previous', $data) && null !== $data['previous']) { - $object->setPrevious($data['previous']); - unset($data['previous']); - } elseif (\array_key_exists('previous', $data) && null === $data['previous']) { - $object->setPrevious(null); - } - if (\array_key_exists('next', $data) && null !== $data['next']) { - $object->setNext($data['next']); - unset($data['next']); - } elseif (\array_key_exists('next', $data) && null === $data['next']) { - $object->setNext(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['first'] = $object->getFirst(); + $data['last'] = $object->getLast(); + if ($object->isInitialized('previous') && null !== $object->getPrevious()) { + $data['previous'] = $object->getPrevious(); + } + if ($object->isInitialized('next') && null !== $object->getNext()) { + $data['next'] = $object->getNext(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\PaginationLinks' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class PaginationLinksNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['first'] = $object->getFirst(); - $data['last'] = $object->getLast(); - if ($object->isInitialized('previous') && null !== $object->getPrevious()) { - $data['previous'] = $object->getPrevious(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' === $type; } - if ($object->isInitialized('next') && null !== $object->getNext()) { - $data['next'] = $object->getNext(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\PaginationLinks(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('first', $data)) { + $object->setFirst($data['first']); + unset($data['first']); + } + if (\array_key_exists('last', $data)) { + $object->setLast($data['last']); + unset($data['last']); + } + if (\array_key_exists('previous', $data) && null !== $data['previous']) { + $object->setPrevious($data['previous']); + unset($data['previous']); + } elseif (\array_key_exists('previous', $data) && null === $data['previous']) { + $object->setPrevious(null); + } + if (\array_key_exists('next', $data) && null !== $data['next']) { + $object->setNext($data['next']); + unset($data['next']); + } elseif (\array_key_exists('next', $data) && null === $data['next']) { + $object->setNext(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['first'] = $object->getFirst(); + $data['last'] = $object->getLast(); + if ($object->isInitialized('previous') && null !== $object->getPrevious()) { + $data['previous'] = $object->getPrevious(); + } + if ($object->isInitialized('next') && null !== $object->getNext()) { + $data['next'] = $object->getNext(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\PaginationLinks' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\PaginationLinks' => false]; + } } } diff --git a/generated/Normalizer/ProjectAssignmentClientNormalizer.php b/generated/Normalizer/ProjectAssignmentClientNormalizer.php index d7e73ae..42b948a 100644 --- a/generated/Normalizer/ProjectAssignmentClientNormalizer.php +++ b/generated/Normalizer/ProjectAssignmentClientNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectAssignmentClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectAssignmentClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ProjectAssignmentClient(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectAssignmentClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectAssignmentClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectAssignmentClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient' => false]; + } } } diff --git a/generated/Normalizer/ProjectAssignmentNormalizer.php b/generated/Normalizer/ProjectAssignmentNormalizer.php index 39e1e2d..c8c7396 100644 --- a/generated/Normalizer/ProjectAssignmentNormalizer.php +++ b/generated/Normalizer/ProjectAssignmentNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,184 +22,350 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectAssignmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectAssignmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' === $type; } - $object = new \JoliCode\Harvest\Api\Model\ProjectAssignment(); - if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { - $data['hourly_rate'] = (float) $data['hourly_rate']; - } - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectAssignment(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { + $object->setIsProjectManager($data['is_project_manager']); + unset($data['is_project_manager']); + } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { + $object->setIsProjectManager(null); + } + if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { + $object->setUseDefaultRates($data['use_default_rates']); + unset($data['use_default_rates']); + } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { + $object->setUseDefaultRates(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('task_assignments', $data) && null !== $data['task_assignments']) { + $values = []; + foreach ($data['task_assignments'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment', 'json', $context); + } + $object->setTaskAssignments($values); + unset($data['task_assignments']); + } elseif (\array_key_exists('task_assignments', $data) && null === $data['task_assignments']) { + $object->setTaskAssignments(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { - $object->setIsProjectManager($data['is_project_manager']); - unset($data['is_project_manager']); - } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { - $object->setIsProjectManager(null); - } - if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { - $object->setUseDefaultRates($data['use_default_rates']); - unset($data['use_default_rates']); - } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { - $object->setUseDefaultRates(null); - } - if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { - $object->setHourlyRate($data['hourly_rate']); - unset($data['hourly_rate']); - } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { - $object->setHourlyRate(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - if (\array_key_exists('project', $data) && null !== $data['project']) { - $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject', 'json', $context)); - unset($data['project']); - } elseif (\array_key_exists('project', $data) && null === $data['project']) { - $object->setProject(null); - } - if (\array_key_exists('client', $data) && null !== $data['client']) { - $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient', 'json', $context)); - unset($data['client']); - } elseif (\array_key_exists('client', $data) && null === $data['client']) { - $object->setClient(null); - } - if (\array_key_exists('task_assignments', $data) && null !== $data['task_assignments']) { - $values = []; - foreach ($data['task_assignments'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment', 'json', $context); - } - $object->setTaskAssignments($values); - unset($data['task_assignments']); - } elseif (\array_key_exists('task_assignments', $data) && null === $data['task_assignments']) { - $object->setTaskAssignments(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { + $data['is_project_manager'] = $object->getIsProjectManager(); + } + if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { + $data['use_default_rates'] = $object->getUseDefaultRates(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('taskAssignments') && null !== $object->getTaskAssignments()) { + $values = []; + foreach ($object->getTaskAssignments() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['task_assignments'] = $values; } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectAssignmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { - $data['is_project_manager'] = $object->getIsProjectManager(); - } - if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { - $data['use_default_rates'] = $object->getUseDefaultRates(); - } - if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { - $data['hourly_rate'] = $object->getHourlyRate(); - } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('project') && null !== $object->getProject()) { - $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' === $type; } - if ($object->isInitialized('client') && null !== $object->getClient()) { - $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' === $data::class; } - if ($object->isInitialized('taskAssignments') && null !== $object->getTaskAssignments()) { - $values = []; - foreach ($object->getTaskAssignments() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['task_assignments'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectAssignment(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { + $object->setIsProjectManager($data['is_project_manager']); + unset($data['is_project_manager']); + } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { + $object->setIsProjectManager(null); + } + if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { + $object->setUseDefaultRates($data['use_default_rates']); + unset($data['use_default_rates']); + } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { + $object->setUseDefaultRates(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('task_assignments', $data) && null !== $data['task_assignments']) { + $values = []; + foreach ($data['task_assignments'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment', 'json', $context); + } + $object->setTaskAssignments($values); + unset($data['task_assignments']); + } elseif (\array_key_exists('task_assignments', $data) && null === $data['task_assignments']) { + $object->setTaskAssignments(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { + $data['is_project_manager'] = $object->getIsProjectManager(); + } + if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { + $data['use_default_rates'] = $object->getUseDefaultRates(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('taskAssignments') && null !== $object->getTaskAssignments()) { + $values = []; + foreach ($object->getTaskAssignments() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['task_assignments'] = $values; + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignment' => false]; + } } } diff --git a/generated/Normalizer/ProjectAssignmentProjectNormalizer.php b/generated/Normalizer/ProjectAssignmentProjectNormalizer.php index d808ad1..979557c 100644 --- a/generated/Normalizer/ProjectAssignmentProjectNormalizer.php +++ b/generated/Normalizer/ProjectAssignmentProjectNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,98 +22,178 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectAssignmentProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectAssignmentProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ProjectAssignmentProject(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectAssignmentProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('code', $data) && null !== $data['code']) { - $object->setCode($data['code']); - unset($data['code']); - } elseif (\array_key_exists('code', $data) && null === $data['code']) { - $object->setCode(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectAssignmentProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' === $type; } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectAssignmentProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignmentProject' => false]; + } } } diff --git a/generated/Normalizer/ProjectAssignmentsNormalizer.php b/generated/Normalizer/ProjectAssignmentsNormalizer.php index c01a2ed..ce308bd 100644 --- a/generated/Normalizer/ProjectAssignmentsNormalizer.php +++ b/generated/Normalizer/ProjectAssignmentsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectAssignmentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectAssignmentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ProjectAssignments(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectAssignments(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('project_assignments', $data)) { + $values = []; + foreach ($data['project_assignments'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment', 'json', $context); + } + $object->setProjectAssignments($values); + unset($data['project_assignments']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('project_assignments', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['project_assignments'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment', 'json', $context); + foreach ($object->getProjectAssignments() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setProjectAssignments($values); - unset($data['project_assignments']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['project_assignments'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectAssignmentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getProjectAssignments() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' === $data::class; } - $data['project_assignments'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectAssignments(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('project_assignments', $data)) { + $values = []; + foreach ($data['project_assignments'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ProjectAssignment', 'json', $context); + } + $object->setProjectAssignments($values); + unset($data['project_assignments']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getProjectAssignments() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['project_assignments'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectAssignments' => false]; + } } } diff --git a/generated/Normalizer/ProjectBudgetReportResultNormalizer.php b/generated/Normalizer/ProjectBudgetReportResultNormalizer.php index 37316a3..3fb533b 100644 --- a/generated/Normalizer/ProjectBudgetReportResultNormalizer.php +++ b/generated/Normalizer/ProjectBudgetReportResultNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,170 +22,322 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectBudgetReportResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectBudgetReportResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' === $type; } - $object = new \JoliCode\Harvest\Api\Model\ProjectBudgetReportResult(); - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; - } - if (\array_key_exists('budget_spent', $data) && \is_int($data['budget_spent'])) { - $data['budget_spent'] = (float) $data['budget_spent']; - } - if (\array_key_exists('budget_remaining', $data) && \is_int($data['budget_remaining'])) { - $data['budget_remaining'] = (float) $data['budget_remaining']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectBudgetReportResult(); + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (\array_key_exists('budget_spent', $data) && \is_int($data['budget_spent'])) { + $data['budget_spent'] = (float) $data['budget_spent']; + } + if (\array_key_exists('budget_remaining', $data) && \is_int($data['budget_remaining'])) { + $data['budget_remaining'] = (float) $data['budget_remaining']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { + $object->setClientName($data['client_name']); + unset($data['client_name']); + } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { + $object->setClientName(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { + $object->setProjectName($data['project_name']); + unset($data['project_name']); + } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { + $object->setProjectName(null); + } + if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { + $object->setBudgetIsMonthly($data['budget_is_monthly']); + unset($data['budget_is_monthly']); + } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { + $object->setBudgetIsMonthly(null); + } + if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { + $object->setBudgetBy($data['budget_by']); + unset($data['budget_by']); + } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { + $object->setBudgetBy(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('budget_spent', $data) && null !== $data['budget_spent']) { + $object->setBudgetSpent($data['budget_spent']); + unset($data['budget_spent']); + } elseif (\array_key_exists('budget_spent', $data) && null === $data['budget_spent']) { + $object->setBudgetSpent(null); + } + if (\array_key_exists('budget_remaining', $data) && null !== $data['budget_remaining']) { + $object->setBudgetRemaining($data['budget_remaining']); + unset($data['budget_remaining']); + } elseif (\array_key_exists('budget_remaining', $data) && null === $data['budget_remaining']) { + $object->setBudgetRemaining(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { - $object->setClientName($data['client_name']); - unset($data['client_name']); - } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { - $object->setClientName(null); - } - if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { - $object->setProjectId($data['project_id']); - unset($data['project_id']); - } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { - $object->setProjectId(null); - } - if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { - $object->setProjectName($data['project_name']); - unset($data['project_name']); - } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { - $object->setProjectName(null); - } - if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { - $object->setBudgetIsMonthly($data['budget_is_monthly']); - unset($data['budget_is_monthly']); - } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { - $object->setBudgetIsMonthly(null); - } - if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { - $object->setBudgetBy($data['budget_by']); - unset($data['budget_by']); - } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { - $object->setBudgetBy(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - if (\array_key_exists('budget_spent', $data) && null !== $data['budget_spent']) { - $object->setBudgetSpent($data['budget_spent']); - unset($data['budget_spent']); - } elseif (\array_key_exists('budget_spent', $data) && null === $data['budget_spent']) { - $object->setBudgetSpent(null); - } - if (\array_key_exists('budget_remaining', $data) && null !== $data['budget_remaining']) { - $object->setBudgetRemaining($data['budget_remaining']); - unset($data['budget_remaining']); - } elseif (\array_key_exists('budget_remaining', $data) && null === $data['budget_remaining']) { - $object->setBudgetRemaining(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('clientName') && null !== $object->getClientName()) { + $data['client_name'] = $object->getClientName(); + } + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { + $data['project_name'] = $object->getProjectName(); + } + if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { + $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); + } + if ($object->isInitialized('budgetBy') && null !== $object->getBudgetBy()) { + $data['budget_by'] = $object->getBudgetBy(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('budgetSpent') && null !== $object->getBudgetSpent()) { + $data['budget_spent'] = $object->getBudgetSpent(); + } + if ($object->isInitialized('budgetRemaining') && null !== $object->getBudgetRemaining()) { + $data['budget_remaining'] = $object->getBudgetRemaining(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectBudgetReportResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('clientName') && null !== $object->getClientName()) { - $data['client_name'] = $object->getClientName(); - } - if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { - $data['project_id'] = $object->getProjectId(); - } - if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { - $data['project_name'] = $object->getProjectName(); - } - if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { - $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); - } - if ($object->isInitialized('budgetBy') && null !== $object->getBudgetBy()) { - $data['budget_by'] = $object->getBudgetBy(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); - } - if ($object->isInitialized('budgetSpent') && null !== $object->getBudgetSpent()) { - $data['budget_spent'] = $object->getBudgetSpent(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' === $type; } - if ($object->isInitialized('budgetRemaining') && null !== $object->getBudgetRemaining()) { - $data['budget_remaining'] = $object->getBudgetRemaining(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectBudgetReportResult(); + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (\array_key_exists('budget_spent', $data) && \is_int($data['budget_spent'])) { + $data['budget_spent'] = (float) $data['budget_spent']; + } + if (\array_key_exists('budget_remaining', $data) && \is_int($data['budget_remaining'])) { + $data['budget_remaining'] = (float) $data['budget_remaining']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { + $object->setClientName($data['client_name']); + unset($data['client_name']); + } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { + $object->setClientName(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { + $object->setProjectName($data['project_name']); + unset($data['project_name']); + } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { + $object->setProjectName(null); + } + if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { + $object->setBudgetIsMonthly($data['budget_is_monthly']); + unset($data['budget_is_monthly']); + } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { + $object->setBudgetIsMonthly(null); } + if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { + $object->setBudgetBy($data['budget_by']); + unset($data['budget_by']); + } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { + $object->setBudgetBy(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('budget_spent', $data) && null !== $data['budget_spent']) { + $object->setBudgetSpent($data['budget_spent']); + unset($data['budget_spent']); + } elseif (\array_key_exists('budget_spent', $data) && null === $data['budget_spent']) { + $object->setBudgetSpent(null); + } + if (\array_key_exists('budget_remaining', $data) && null !== $data['budget_remaining']) { + $object->setBudgetRemaining($data['budget_remaining']); + unset($data['budget_remaining']); + } elseif (\array_key_exists('budget_remaining', $data) && null === $data['budget_remaining']) { + $object->setBudgetRemaining(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('clientName') && null !== $object->getClientName()) { + $data['client_name'] = $object->getClientName(); + } + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { + $data['project_name'] = $object->getProjectName(); + } + if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { + $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); + } + if ($object->isInitialized('budgetBy') && null !== $object->getBudgetBy()) { + $data['budget_by'] = $object->getBudgetBy(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('budgetSpent') && null !== $object->getBudgetSpent()) { + $data['budget_spent'] = $object->getBudgetSpent(); + } + if ($object->isInitialized('budgetRemaining') && null !== $object->getBudgetRemaining()) { + $data['budget_remaining'] = $object->getBudgetRemaining(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult' => false]; + } } } diff --git a/generated/Normalizer/ProjectBudgetReportResultsNormalizer.php b/generated/Normalizer/ProjectBudgetReportResultsNormalizer.php index ec1a07b..6316932 100644 --- a/generated/Normalizer/ProjectBudgetReportResultsNormalizer.php +++ b/generated/Normalizer/ProjectBudgetReportResultsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectBudgetReportResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectBudgetReportResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ProjectBudgetReportResults(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectBudgetReportResults(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('results', $data)) { + $values = []; + foreach ($data['results'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult', 'json', $context); + } + $object->setResults($values); + unset($data['results']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('results', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['results'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult', 'json', $context); + foreach ($object->getResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setResults($values); - unset($data['results']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['results'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectBudgetReportResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getResults() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' === $data::class; } - $data['results'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectBudgetReportResults(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('results', $data)) { + $values = []; + foreach ($data['results'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResult', 'json', $context); + } + $object->setResults($values); + unset($data['results']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['results'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectBudgetReportResults' => false]; + } } } diff --git a/generated/Normalizer/ProjectClientNormalizer.php b/generated/Normalizer/ProjectClientNormalizer.php index 847695d..69fe30d 100644 --- a/generated/Normalizer/ProjectClientNormalizer.php +++ b/generated/Normalizer/ProjectClientNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,98 +22,178 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\ProjectClient(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectClient' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' === $type; } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectClient' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectClient' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectClient' => false]; + } } } diff --git a/generated/Normalizer/ProjectNormalizer.php b/generated/Normalizer/ProjectNormalizer.php index 05d2d39..fca7918 100644 --- a/generated/Normalizer/ProjectNormalizer.php +++ b/generated/Normalizer/ProjectNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,302 +22,586 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Project' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Project' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Project' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\Project(); - if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { - $data['hourly_rate'] = (float) $data['hourly_rate']; - } - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; - } - if (\array_key_exists('over_budget_notification_percentage', $data) && \is_int($data['over_budget_notification_percentage'])) { - $data['over_budget_notification_percentage'] = (float) $data['over_budget_notification_percentage']; - } - if (\array_key_exists('cost_budget', $data) && \is_int($data['cost_budget'])) { - $data['cost_budget'] = (float) $data['cost_budget']; - } - if (\array_key_exists('fee', $data) && \is_int($data['fee'])) { - $data['fee'] = (float) $data['fee']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Project' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Project(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (\array_key_exists('over_budget_notification_percentage', $data) && \is_int($data['over_budget_notification_percentage'])) { + $data['over_budget_notification_percentage'] = (float) $data['over_budget_notification_percentage']; + } + if (\array_key_exists('cost_budget', $data) && \is_int($data['cost_budget'])) { + $data['cost_budget'] = (float) $data['cost_budget']; + } + if (\array_key_exists('fee', $data) && \is_int($data['fee'])) { + $data['fee'] = (float) $data['fee']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ProjectClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_billable', $data) && null !== $data['is_billable']) { + $object->setIsBillable($data['is_billable']); + unset($data['is_billable']); + } elseif (\array_key_exists('is_billable', $data) && null === $data['is_billable']) { + $object->setIsBillable(null); + } + if (\array_key_exists('is_fixed_fee', $data) && null !== $data['is_fixed_fee']) { + $object->setIsFixedFee($data['is_fixed_fee']); + unset($data['is_fixed_fee']); + } elseif (\array_key_exists('is_fixed_fee', $data) && null === $data['is_fixed_fee']) { + $object->setIsFixedFee(null); + } + if (\array_key_exists('bill_by', $data) && null !== $data['bill_by']) { + $object->setBillBy($data['bill_by']); + unset($data['bill_by']); + } elseif (\array_key_exists('bill_by', $data) && null === $data['bill_by']) { + $object->setBillBy(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { + $object->setBudgetBy($data['budget_by']); + unset($data['budget_by']); + } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { + $object->setBudgetBy(null); + } + if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { + $object->setBudgetIsMonthly($data['budget_is_monthly']); + unset($data['budget_is_monthly']); + } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { + $object->setBudgetIsMonthly(null); + } + if (\array_key_exists('notify_when_over_budget', $data) && null !== $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget($data['notify_when_over_budget']); + unset($data['notify_when_over_budget']); + } elseif (\array_key_exists('notify_when_over_budget', $data) && null === $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget(null); + } + if (\array_key_exists('over_budget_notification_percentage', $data) && null !== $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage($data['over_budget_notification_percentage']); + unset($data['over_budget_notification_percentage']); + } elseif (\array_key_exists('over_budget_notification_percentage', $data) && null === $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage(null); + } + if (\array_key_exists('over_budget_notification_date', $data) && null !== $data['over_budget_notification_date']) { + $object->setOverBudgetNotificationDate(\DateTime::createFromFormat('Y-m-d', $data['over_budget_notification_date'])->setTime(0, 0, 0)); + unset($data['over_budget_notification_date']); + } elseif (\array_key_exists('over_budget_notification_date', $data) && null === $data['over_budget_notification_date']) { + $object->setOverBudgetNotificationDate(null); + } + if (\array_key_exists('show_budget_to_all', $data) && null !== $data['show_budget_to_all']) { + $object->setShowBudgetToAll($data['show_budget_to_all']); + unset($data['show_budget_to_all']); + } elseif (\array_key_exists('show_budget_to_all', $data) && null === $data['show_budget_to_all']) { + $object->setShowBudgetToAll(null); + } + if (\array_key_exists('cost_budget', $data) && null !== $data['cost_budget']) { + $object->setCostBudget($data['cost_budget']); + unset($data['cost_budget']); + } elseif (\array_key_exists('cost_budget', $data) && null === $data['cost_budget']) { + $object->setCostBudget(null); + } + if (\array_key_exists('cost_budget_include_expenses', $data) && null !== $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses($data['cost_budget_include_expenses']); + unset($data['cost_budget_include_expenses']); + } elseif (\array_key_exists('cost_budget_include_expenses', $data) && null === $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses(null); + } + if (\array_key_exists('fee', $data) && null !== $data['fee']) { + $object->setFee($data['fee']); + unset($data['fee']); + } elseif (\array_key_exists('fee', $data) && null === $data['fee']) { + $object->setFee(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('starts_on', $data) && null !== $data['starts_on']) { + $object->setStartsOn(\DateTime::createFromFormat('Y-m-d', $data['starts_on'])->setTime(0, 0, 0)); + unset($data['starts_on']); + } elseif (\array_key_exists('starts_on', $data) && null === $data['starts_on']) { + $object->setStartsOn(null); + } + if (\array_key_exists('ends_on', $data) && null !== $data['ends_on']) { + $object->setEndsOn(\DateTime::createFromFormat('Y-m-d', $data['ends_on'])->setTime(0, 0, 0)); + unset($data['ends_on']); + } elseif (\array_key_exists('ends_on', $data) && null === $data['ends_on']) { + $object->setEndsOn(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('client', $data) && null !== $data['client']) { - $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ProjectClient', 'json', $context)); - unset($data['client']); - } elseif (\array_key_exists('client', $data) && null === $data['client']) { - $object->setClient(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('code', $data) && null !== $data['code']) { - $object->setCode($data['code']); - unset($data['code']); - } elseif (\array_key_exists('code', $data) && null === $data['code']) { - $object->setCode(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('is_billable', $data) && null !== $data['is_billable']) { - $object->setIsBillable($data['is_billable']); - unset($data['is_billable']); - } elseif (\array_key_exists('is_billable', $data) && null === $data['is_billable']) { - $object->setIsBillable(null); - } - if (\array_key_exists('is_fixed_fee', $data) && null !== $data['is_fixed_fee']) { - $object->setIsFixedFee($data['is_fixed_fee']); - unset($data['is_fixed_fee']); - } elseif (\array_key_exists('is_fixed_fee', $data) && null === $data['is_fixed_fee']) { - $object->setIsFixedFee(null); - } - if (\array_key_exists('bill_by', $data) && null !== $data['bill_by']) { - $object->setBillBy($data['bill_by']); - unset($data['bill_by']); - } elseif (\array_key_exists('bill_by', $data) && null === $data['bill_by']) { - $object->setBillBy(null); - } - if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { - $object->setHourlyRate($data['hourly_rate']); - unset($data['hourly_rate']); - } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { - $object->setHourlyRate(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { - $object->setBudgetBy($data['budget_by']); - unset($data['budget_by']); - } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { - $object->setBudgetBy(null); - } - if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { - $object->setBudgetIsMonthly($data['budget_is_monthly']); - unset($data['budget_is_monthly']); - } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { - $object->setBudgetIsMonthly(null); - } - if (\array_key_exists('notify_when_over_budget', $data) && null !== $data['notify_when_over_budget']) { - $object->setNotifyWhenOverBudget($data['notify_when_over_budget']); - unset($data['notify_when_over_budget']); - } elseif (\array_key_exists('notify_when_over_budget', $data) && null === $data['notify_when_over_budget']) { - $object->setNotifyWhenOverBudget(null); - } - if (\array_key_exists('over_budget_notification_percentage', $data) && null !== $data['over_budget_notification_percentage']) { - $object->setOverBudgetNotificationPercentage($data['over_budget_notification_percentage']); - unset($data['over_budget_notification_percentage']); - } elseif (\array_key_exists('over_budget_notification_percentage', $data) && null === $data['over_budget_notification_percentage']) { - $object->setOverBudgetNotificationPercentage(null); - } - if (\array_key_exists('over_budget_notification_date', $data) && null !== $data['over_budget_notification_date']) { - $object->setOverBudgetNotificationDate(\DateTime::createFromFormat('Y-m-d', $data['over_budget_notification_date'])->setTime(0, 0, 0)); - unset($data['over_budget_notification_date']); - } elseif (\array_key_exists('over_budget_notification_date', $data) && null === $data['over_budget_notification_date']) { - $object->setOverBudgetNotificationDate(null); - } - if (\array_key_exists('show_budget_to_all', $data) && null !== $data['show_budget_to_all']) { - $object->setShowBudgetToAll($data['show_budget_to_all']); - unset($data['show_budget_to_all']); - } elseif (\array_key_exists('show_budget_to_all', $data) && null === $data['show_budget_to_all']) { - $object->setShowBudgetToAll(null); - } - if (\array_key_exists('cost_budget', $data) && null !== $data['cost_budget']) { - $object->setCostBudget($data['cost_budget']); - unset($data['cost_budget']); - } elseif (\array_key_exists('cost_budget', $data) && null === $data['cost_budget']) { - $object->setCostBudget(null); - } - if (\array_key_exists('cost_budget_include_expenses', $data) && null !== $data['cost_budget_include_expenses']) { - $object->setCostBudgetIncludeExpenses($data['cost_budget_include_expenses']); - unset($data['cost_budget_include_expenses']); - } elseif (\array_key_exists('cost_budget_include_expenses', $data) && null === $data['cost_budget_include_expenses']) { - $object->setCostBudgetIncludeExpenses(null); - } - if (\array_key_exists('fee', $data) && null !== $data['fee']) { - $object->setFee($data['fee']); - unset($data['fee']); - } elseif (\array_key_exists('fee', $data) && null === $data['fee']) { - $object->setFee(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('starts_on', $data) && null !== $data['starts_on']) { - $object->setStartsOn(\DateTime::createFromFormat('Y-m-d', $data['starts_on'])->setTime(0, 0, 0)); - unset($data['starts_on']); - } elseif (\array_key_exists('starts_on', $data) && null === $data['starts_on']) { - $object->setStartsOn(null); - } - if (\array_key_exists('ends_on', $data) && null !== $data['ends_on']) { - $object->setEndsOn(\DateTime::createFromFormat('Y-m-d', $data['ends_on'])->setTime(0, 0, 0)); - unset($data['ends_on']); - } elseif (\array_key_exists('ends_on', $data) && null === $data['ends_on']) { - $object->setEndsOn(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isBillable') && null !== $object->getIsBillable()) { + $data['is_billable'] = $object->getIsBillable(); + } + if ($object->isInitialized('isFixedFee') && null !== $object->getIsFixedFee()) { + $data['is_fixed_fee'] = $object->getIsFixedFee(); + } + if ($object->isInitialized('billBy') && null !== $object->getBillBy()) { + $data['bill_by'] = $object->getBillBy(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('budgetBy') && null !== $object->getBudgetBy()) { + $data['budget_by'] = $object->getBudgetBy(); + } + if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { + $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); + } + if ($object->isInitialized('notifyWhenOverBudget') && null !== $object->getNotifyWhenOverBudget()) { + $data['notify_when_over_budget'] = $object->getNotifyWhenOverBudget(); + } + if ($object->isInitialized('overBudgetNotificationPercentage') && null !== $object->getOverBudgetNotificationPercentage()) { + $data['over_budget_notification_percentage'] = $object->getOverBudgetNotificationPercentage(); + } + if ($object->isInitialized('overBudgetNotificationDate') && null !== $object->getOverBudgetNotificationDate()) { + $data['over_budget_notification_date'] = $object->getOverBudgetNotificationDate()->format('Y-m-d'); + } + if ($object->isInitialized('showBudgetToAll') && null !== $object->getShowBudgetToAll()) { + $data['show_budget_to_all'] = $object->getShowBudgetToAll(); + } + if ($object->isInitialized('costBudget') && null !== $object->getCostBudget()) { + $data['cost_budget'] = $object->getCostBudget(); + } + if ($object->isInitialized('costBudgetIncludeExpenses') && null !== $object->getCostBudgetIncludeExpenses()) { + $data['cost_budget_include_expenses'] = $object->getCostBudgetIncludeExpenses(); + } + if ($object->isInitialized('fee') && null !== $object->getFee()) { + $data['fee'] = $object->getFee(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('startsOn') && null !== $object->getStartsOn()) { + $data['starts_on'] = $object->getStartsOn()->format('Y-m-d'); + } + if ($object->isInitialized('endsOn') && null !== $object->getEndsOn()) { + $data['ends_on'] = $object->getEndsOn()->format('Y-m-d'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Project' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('client') && null !== $object->getClient()) { - $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('isBillable') && null !== $object->getIsBillable()) { - $data['is_billable'] = $object->getIsBillable(); - } - if ($object->isInitialized('isFixedFee') && null !== $object->getIsFixedFee()) { - $data['is_fixed_fee'] = $object->getIsFixedFee(); - } - if ($object->isInitialized('billBy') && null !== $object->getBillBy()) { - $data['bill_by'] = $object->getBillBy(); - } - if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { - $data['hourly_rate'] = $object->getHourlyRate(); - } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); - } - if ($object->isInitialized('budgetBy') && null !== $object->getBudgetBy()) { - $data['budget_by'] = $object->getBudgetBy(); - } - if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { - $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); - } - if ($object->isInitialized('notifyWhenOverBudget') && null !== $object->getNotifyWhenOverBudget()) { - $data['notify_when_over_budget'] = $object->getNotifyWhenOverBudget(); - } - if ($object->isInitialized('overBudgetNotificationPercentage') && null !== $object->getOverBudgetNotificationPercentage()) { - $data['over_budget_notification_percentage'] = $object->getOverBudgetNotificationPercentage(); - } - if ($object->isInitialized('overBudgetNotificationDate') && null !== $object->getOverBudgetNotificationDate()) { - $data['over_budget_notification_date'] = $object->getOverBudgetNotificationDate()->format('Y-m-d'); - } - if ($object->isInitialized('showBudgetToAll') && null !== $object->getShowBudgetToAll()) { - $data['show_budget_to_all'] = $object->getShowBudgetToAll(); - } - if ($object->isInitialized('costBudget') && null !== $object->getCostBudget()) { - $data['cost_budget'] = $object->getCostBudget(); - } - if ($object->isInitialized('costBudgetIncludeExpenses') && null !== $object->getCostBudgetIncludeExpenses()) { - $data['cost_budget_include_expenses'] = $object->getCostBudgetIncludeExpenses(); - } - if ($object->isInitialized('fee') && null !== $object->getFee()) { - $data['fee'] = $object->getFee(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('startsOn') && null !== $object->getStartsOn()) { - $data['starts_on'] = $object->getStartsOn()->format('Y-m-d'); - } - if ($object->isInitialized('endsOn') && null !== $object->getEndsOn()) { - $data['ends_on'] = $object->getEndsOn()->format('Y-m-d'); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Project' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Project' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Project(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (\array_key_exists('over_budget_notification_percentage', $data) && \is_int($data['over_budget_notification_percentage'])) { + $data['over_budget_notification_percentage'] = (float) $data['over_budget_notification_percentage']; + } + if (\array_key_exists('cost_budget', $data) && \is_int($data['cost_budget'])) { + $data['cost_budget'] = (float) $data['cost_budget']; + } + if (\array_key_exists('fee', $data) && \is_int($data['fee'])) { + $data['fee'] = (float) $data['fee']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\ProjectClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_billable', $data) && null !== $data['is_billable']) { + $object->setIsBillable($data['is_billable']); + unset($data['is_billable']); + } elseif (\array_key_exists('is_billable', $data) && null === $data['is_billable']) { + $object->setIsBillable(null); + } + if (\array_key_exists('is_fixed_fee', $data) && null !== $data['is_fixed_fee']) { + $object->setIsFixedFee($data['is_fixed_fee']); + unset($data['is_fixed_fee']); + } elseif (\array_key_exists('is_fixed_fee', $data) && null === $data['is_fixed_fee']) { + $object->setIsFixedFee(null); + } + if (\array_key_exists('bill_by', $data) && null !== $data['bill_by']) { + $object->setBillBy($data['bill_by']); + unset($data['bill_by']); + } elseif (\array_key_exists('bill_by', $data) && null === $data['bill_by']) { + $object->setBillBy(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); } + if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { + $object->setBudgetBy($data['budget_by']); + unset($data['budget_by']); + } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { + $object->setBudgetBy(null); + } + if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { + $object->setBudgetIsMonthly($data['budget_is_monthly']); + unset($data['budget_is_monthly']); + } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { + $object->setBudgetIsMonthly(null); + } + if (\array_key_exists('notify_when_over_budget', $data) && null !== $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget($data['notify_when_over_budget']); + unset($data['notify_when_over_budget']); + } elseif (\array_key_exists('notify_when_over_budget', $data) && null === $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget(null); + } + if (\array_key_exists('over_budget_notification_percentage', $data) && null !== $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage($data['over_budget_notification_percentage']); + unset($data['over_budget_notification_percentage']); + } elseif (\array_key_exists('over_budget_notification_percentage', $data) && null === $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage(null); + } + if (\array_key_exists('over_budget_notification_date', $data) && null !== $data['over_budget_notification_date']) { + $object->setOverBudgetNotificationDate(\DateTime::createFromFormat('Y-m-d', $data['over_budget_notification_date'])->setTime(0, 0, 0)); + unset($data['over_budget_notification_date']); + } elseif (\array_key_exists('over_budget_notification_date', $data) && null === $data['over_budget_notification_date']) { + $object->setOverBudgetNotificationDate(null); + } + if (\array_key_exists('show_budget_to_all', $data) && null !== $data['show_budget_to_all']) { + $object->setShowBudgetToAll($data['show_budget_to_all']); + unset($data['show_budget_to_all']); + } elseif (\array_key_exists('show_budget_to_all', $data) && null === $data['show_budget_to_all']) { + $object->setShowBudgetToAll(null); + } + if (\array_key_exists('cost_budget', $data) && null !== $data['cost_budget']) { + $object->setCostBudget($data['cost_budget']); + unset($data['cost_budget']); + } elseif (\array_key_exists('cost_budget', $data) && null === $data['cost_budget']) { + $object->setCostBudget(null); + } + if (\array_key_exists('cost_budget_include_expenses', $data) && null !== $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses($data['cost_budget_include_expenses']); + unset($data['cost_budget_include_expenses']); + } elseif (\array_key_exists('cost_budget_include_expenses', $data) && null === $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses(null); + } + if (\array_key_exists('fee', $data) && null !== $data['fee']) { + $object->setFee($data['fee']); + unset($data['fee']); + } elseif (\array_key_exists('fee', $data) && null === $data['fee']) { + $object->setFee(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('starts_on', $data) && null !== $data['starts_on']) { + $object->setStartsOn(\DateTime::createFromFormat('Y-m-d', $data['starts_on'])->setTime(0, 0, 0)); + unset($data['starts_on']); + } elseif (\array_key_exists('starts_on', $data) && null === $data['starts_on']) { + $object->setStartsOn(null); + } + if (\array_key_exists('ends_on', $data) && null !== $data['ends_on']) { + $object->setEndsOn(\DateTime::createFromFormat('Y-m-d', $data['ends_on'])->setTime(0, 0, 0)); + unset($data['ends_on']); + } elseif (\array_key_exists('ends_on', $data) && null === $data['ends_on']) { + $object->setEndsOn(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isBillable') && null !== $object->getIsBillable()) { + $data['is_billable'] = $object->getIsBillable(); + } + if ($object->isInitialized('isFixedFee') && null !== $object->getIsFixedFee()) { + $data['is_fixed_fee'] = $object->getIsFixedFee(); + } + if ($object->isInitialized('billBy') && null !== $object->getBillBy()) { + $data['bill_by'] = $object->getBillBy(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('budgetBy') && null !== $object->getBudgetBy()) { + $data['budget_by'] = $object->getBudgetBy(); + } + if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { + $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); + } + if ($object->isInitialized('notifyWhenOverBudget') && null !== $object->getNotifyWhenOverBudget()) { + $data['notify_when_over_budget'] = $object->getNotifyWhenOverBudget(); + } + if ($object->isInitialized('overBudgetNotificationPercentage') && null !== $object->getOverBudgetNotificationPercentage()) { + $data['over_budget_notification_percentage'] = $object->getOverBudgetNotificationPercentage(); + } + if ($object->isInitialized('overBudgetNotificationDate') && null !== $object->getOverBudgetNotificationDate()) { + $data['over_budget_notification_date'] = $object->getOverBudgetNotificationDate()->format('Y-m-d'); + } + if ($object->isInitialized('showBudgetToAll') && null !== $object->getShowBudgetToAll()) { + $data['show_budget_to_all'] = $object->getShowBudgetToAll(); + } + if ($object->isInitialized('costBudget') && null !== $object->getCostBudget()) { + $data['cost_budget'] = $object->getCostBudget(); + } + if ($object->isInitialized('costBudgetIncludeExpenses') && null !== $object->getCostBudgetIncludeExpenses()) { + $data['cost_budget_include_expenses'] = $object->getCostBudgetIncludeExpenses(); + } + if ($object->isInitialized('fee') && null !== $object->getFee()) { + $data['fee'] = $object->getFee(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('startsOn') && null !== $object->getStartsOn()) { + $data['starts_on'] = $object->getStartsOn()->format('Y-m-d'); + } + if ($object->isInitialized('endsOn') && null !== $object->getEndsOn()) { + $data['ends_on'] = $object->getEndsOn()->format('Y-m-d'); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Project' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Project' => false]; + } } } diff --git a/generated/Normalizer/ProjectsNormalizer.php b/generated/Normalizer/ProjectsNormalizer.php index 2331d07..fb94d8a 100644 --- a/generated/Normalizer/ProjectsNormalizer.php +++ b/generated/Normalizer/ProjectsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Projects' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Projects' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Projects' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Projects' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Projects(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Projects(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('projects', $data)) { + $values = []; + foreach ($data['projects'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Project', 'json', $context); + } + $object->setProjects($values); + unset($data['projects']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('projects', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['projects'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Project', 'json', $context); + foreach ($object->getProjects() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setProjects($values); - unset($data['projects']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['projects'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Projects' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getProjects() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Projects' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Projects' === $data::class; } - $data['projects'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Projects(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('projects', $data)) { + $values = []; + foreach ($data['projects'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Project', 'json', $context); + } + $object->setProjects($values); + unset($data['projects']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getProjects() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['projects'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Projects' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Projects' => false]; + } } } diff --git a/generated/Normalizer/ProjectsPostBodyNormalizer.php b/generated/Normalizer/ProjectsPostBodyNormalizer.php index 21813b3..92f993d 100644 --- a/generated/Normalizer/ProjectsPostBodyNormalizer.php +++ b/generated/Normalizer/ProjectsPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,256 +22,494 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\ProjectsPostBody(); - if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { - $data['hourly_rate'] = (float) $data['hourly_rate']; - } - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; - } - if (\array_key_exists('over_budget_notification_percentage', $data) && \is_int($data['over_budget_notification_percentage'])) { - $data['over_budget_notification_percentage'] = (float) $data['over_budget_notification_percentage']; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' === $type; } - if (\array_key_exists('cost_budget', $data) && \is_int($data['cost_budget'])) { - $data['cost_budget'] = (float) $data['cost_budget']; - } - if (\array_key_exists('fee', $data) && \is_int($data['fee'])) { - $data['fee'] = (float) $data['fee']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsPostBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (\array_key_exists('over_budget_notification_percentage', $data) && \is_int($data['over_budget_notification_percentage'])) { + $data['over_budget_notification_percentage'] = (float) $data['over_budget_notification_percentage']; + } + if (\array_key_exists('cost_budget', $data) && \is_int($data['cost_budget'])) { + $data['cost_budget'] = (float) $data['cost_budget']; + } + if (\array_key_exists('fee', $data) && \is_int($data['fee'])) { + $data['fee'] = (float) $data['fee']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_billable', $data) && null !== $data['is_billable']) { + $object->setIsBillable($data['is_billable']); + unset($data['is_billable']); + } elseif (\array_key_exists('is_billable', $data) && null === $data['is_billable']) { + $object->setIsBillable(null); + } + if (\array_key_exists('is_fixed_fee', $data) && null !== $data['is_fixed_fee']) { + $object->setIsFixedFee($data['is_fixed_fee']); + unset($data['is_fixed_fee']); + } elseif (\array_key_exists('is_fixed_fee', $data) && null === $data['is_fixed_fee']) { + $object->setIsFixedFee(null); + } + if (\array_key_exists('bill_by', $data) && null !== $data['bill_by']) { + $object->setBillBy($data['bill_by']); + unset($data['bill_by']); + } elseif (\array_key_exists('bill_by', $data) && null === $data['bill_by']) { + $object->setBillBy(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { + $object->setBudgetBy($data['budget_by']); + unset($data['budget_by']); + } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { + $object->setBudgetBy(null); + } + if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { + $object->setBudgetIsMonthly($data['budget_is_monthly']); + unset($data['budget_is_monthly']); + } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { + $object->setBudgetIsMonthly(null); + } + if (\array_key_exists('notify_when_over_budget', $data) && null !== $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget($data['notify_when_over_budget']); + unset($data['notify_when_over_budget']); + } elseif (\array_key_exists('notify_when_over_budget', $data) && null === $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget(null); + } + if (\array_key_exists('over_budget_notification_percentage', $data) && null !== $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage($data['over_budget_notification_percentage']); + unset($data['over_budget_notification_percentage']); + } elseif (\array_key_exists('over_budget_notification_percentage', $data) && null === $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage(null); + } + if (\array_key_exists('show_budget_to_all', $data) && null !== $data['show_budget_to_all']) { + $object->setShowBudgetToAll($data['show_budget_to_all']); + unset($data['show_budget_to_all']); + } elseif (\array_key_exists('show_budget_to_all', $data) && null === $data['show_budget_to_all']) { + $object->setShowBudgetToAll(null); + } + if (\array_key_exists('cost_budget', $data) && null !== $data['cost_budget']) { + $object->setCostBudget($data['cost_budget']); + unset($data['cost_budget']); + } elseif (\array_key_exists('cost_budget', $data) && null === $data['cost_budget']) { + $object->setCostBudget(null); + } + if (\array_key_exists('cost_budget_include_expenses', $data) && null !== $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses($data['cost_budget_include_expenses']); + unset($data['cost_budget_include_expenses']); + } elseif (\array_key_exists('cost_budget_include_expenses', $data) && null === $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses(null); + } + if (\array_key_exists('fee', $data) && null !== $data['fee']) { + $object->setFee($data['fee']); + unset($data['fee']); + } elseif (\array_key_exists('fee', $data) && null === $data['fee']) { + $object->setFee(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('starts_on', $data) && null !== $data['starts_on']) { + $object->setStartsOn(\DateTime::createFromFormat('Y-m-d', $data['starts_on'])->setTime(0, 0, 0)); + unset($data['starts_on']); + } elseif (\array_key_exists('starts_on', $data) && null === $data['starts_on']) { + $object->setStartsOn(null); + } + if (\array_key_exists('ends_on', $data) && null !== $data['ends_on']) { + $object->setEndsOn(\DateTime::createFromFormat('Y-m-d', $data['ends_on'])->setTime(0, 0, 0)); + unset($data['ends_on']); + } elseif (\array_key_exists('ends_on', $data) && null === $data['ends_on']) { + $object->setEndsOn(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('code', $data) && null !== $data['code']) { - $object->setCode($data['code']); - unset($data['code']); - } elseif (\array_key_exists('code', $data) && null === $data['code']) { - $object->setCode(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('is_billable', $data) && null !== $data['is_billable']) { - $object->setIsBillable($data['is_billable']); - unset($data['is_billable']); - } elseif (\array_key_exists('is_billable', $data) && null === $data['is_billable']) { - $object->setIsBillable(null); - } - if (\array_key_exists('is_fixed_fee', $data) && null !== $data['is_fixed_fee']) { - $object->setIsFixedFee($data['is_fixed_fee']); - unset($data['is_fixed_fee']); - } elseif (\array_key_exists('is_fixed_fee', $data) && null === $data['is_fixed_fee']) { - $object->setIsFixedFee(null); - } - if (\array_key_exists('bill_by', $data) && null !== $data['bill_by']) { - $object->setBillBy($data['bill_by']); - unset($data['bill_by']); - } elseif (\array_key_exists('bill_by', $data) && null === $data['bill_by']) { - $object->setBillBy(null); - } - if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { - $object->setHourlyRate($data['hourly_rate']); - unset($data['hourly_rate']); - } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { - $object->setHourlyRate(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { - $object->setBudgetBy($data['budget_by']); - unset($data['budget_by']); - } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { - $object->setBudgetBy(null); - } - if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { - $object->setBudgetIsMonthly($data['budget_is_monthly']); - unset($data['budget_is_monthly']); - } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { - $object->setBudgetIsMonthly(null); - } - if (\array_key_exists('notify_when_over_budget', $data) && null !== $data['notify_when_over_budget']) { - $object->setNotifyWhenOverBudget($data['notify_when_over_budget']); - unset($data['notify_when_over_budget']); - } elseif (\array_key_exists('notify_when_over_budget', $data) && null === $data['notify_when_over_budget']) { - $object->setNotifyWhenOverBudget(null); - } - if (\array_key_exists('over_budget_notification_percentage', $data) && null !== $data['over_budget_notification_percentage']) { - $object->setOverBudgetNotificationPercentage($data['over_budget_notification_percentage']); - unset($data['over_budget_notification_percentage']); - } elseif (\array_key_exists('over_budget_notification_percentage', $data) && null === $data['over_budget_notification_percentage']) { - $object->setOverBudgetNotificationPercentage(null); - } - if (\array_key_exists('show_budget_to_all', $data) && null !== $data['show_budget_to_all']) { - $object->setShowBudgetToAll($data['show_budget_to_all']); - unset($data['show_budget_to_all']); - } elseif (\array_key_exists('show_budget_to_all', $data) && null === $data['show_budget_to_all']) { - $object->setShowBudgetToAll(null); - } - if (\array_key_exists('cost_budget', $data) && null !== $data['cost_budget']) { - $object->setCostBudget($data['cost_budget']); - unset($data['cost_budget']); - } elseif (\array_key_exists('cost_budget', $data) && null === $data['cost_budget']) { - $object->setCostBudget(null); - } - if (\array_key_exists('cost_budget_include_expenses', $data) && null !== $data['cost_budget_include_expenses']) { - $object->setCostBudgetIncludeExpenses($data['cost_budget_include_expenses']); - unset($data['cost_budget_include_expenses']); - } elseif (\array_key_exists('cost_budget_include_expenses', $data) && null === $data['cost_budget_include_expenses']) { - $object->setCostBudgetIncludeExpenses(null); - } - if (\array_key_exists('fee', $data) && null !== $data['fee']) { - $object->setFee($data['fee']); - unset($data['fee']); - } elseif (\array_key_exists('fee', $data) && null === $data['fee']) { - $object->setFee(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('starts_on', $data) && null !== $data['starts_on']) { - $object->setStartsOn(\DateTime::createFromFormat('Y-m-d', $data['starts_on'])->setTime(0, 0, 0)); - unset($data['starts_on']); - } elseif (\array_key_exists('starts_on', $data) && null === $data['starts_on']) { - $object->setStartsOn(null); - } - if (\array_key_exists('ends_on', $data) && null !== $data['ends_on']) { - $object->setEndsOn(\DateTime::createFromFormat('Y-m-d', $data['ends_on'])->setTime(0, 0, 0)); - unset($data['ends_on']); - } elseif (\array_key_exists('ends_on', $data) && null === $data['ends_on']) { - $object->setEndsOn(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['client_id'] = $object->getClientId(); + $data['name'] = $object->getName(); + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + $data['is_billable'] = $object->getIsBillable(); + if ($object->isInitialized('isFixedFee') && null !== $object->getIsFixedFee()) { + $data['is_fixed_fee'] = $object->getIsFixedFee(); + } + $data['bill_by'] = $object->getBillBy(); + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + $data['budget_by'] = $object->getBudgetBy(); + if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { + $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); + } + if ($object->isInitialized('notifyWhenOverBudget') && null !== $object->getNotifyWhenOverBudget()) { + $data['notify_when_over_budget'] = $object->getNotifyWhenOverBudget(); + } + if ($object->isInitialized('overBudgetNotificationPercentage') && null !== $object->getOverBudgetNotificationPercentage()) { + $data['over_budget_notification_percentage'] = $object->getOverBudgetNotificationPercentage(); + } + if ($object->isInitialized('showBudgetToAll') && null !== $object->getShowBudgetToAll()) { + $data['show_budget_to_all'] = $object->getShowBudgetToAll(); + } + if ($object->isInitialized('costBudget') && null !== $object->getCostBudget()) { + $data['cost_budget'] = $object->getCostBudget(); + } + if ($object->isInitialized('costBudgetIncludeExpenses') && null !== $object->getCostBudgetIncludeExpenses()) { + $data['cost_budget_include_expenses'] = $object->getCostBudgetIncludeExpenses(); + } + if ($object->isInitialized('fee') && null !== $object->getFee()) { + $data['fee'] = $object->getFee(); } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('startsOn') && null !== $object->getStartsOn()) { + $data['starts_on'] = $object->getStartsOn()->format('Y-m-d'); + } + if ($object->isInitialized('endsOn') && null !== $object->getEndsOn()) { + $data['ends_on'] = $object->getEndsOn()->format('Y-m-d'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['client_id'] = $object->getClientId(); - $data['name'] = $object->getName(); - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - $data['is_billable'] = $object->getIsBillable(); - if ($object->isInitialized('isFixedFee') && null !== $object->getIsFixedFee()) { - $data['is_fixed_fee'] = $object->getIsFixedFee(); - } - $data['bill_by'] = $object->getBillBy(); - if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { - $data['hourly_rate'] = $object->getHourlyRate(); - } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); - } - $data['budget_by'] = $object->getBudgetBy(); - if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { - $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); - } - if ($object->isInitialized('notifyWhenOverBudget') && null !== $object->getNotifyWhenOverBudget()) { - $data['notify_when_over_budget'] = $object->getNotifyWhenOverBudget(); - } - if ($object->isInitialized('overBudgetNotificationPercentage') && null !== $object->getOverBudgetNotificationPercentage()) { - $data['over_budget_notification_percentage'] = $object->getOverBudgetNotificationPercentage(); - } - if ($object->isInitialized('showBudgetToAll') && null !== $object->getShowBudgetToAll()) { - $data['show_budget_to_all'] = $object->getShowBudgetToAll(); - } - if ($object->isInitialized('costBudget') && null !== $object->getCostBudget()) { - $data['cost_budget'] = $object->getCostBudget(); - } - if ($object->isInitialized('costBudgetIncludeExpenses') && null !== $object->getCostBudgetIncludeExpenses()) { - $data['cost_budget_include_expenses'] = $object->getCostBudgetIncludeExpenses(); - } - if ($object->isInitialized('fee') && null !== $object->getFee()) { - $data['fee'] = $object->getFee(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('startsOn') && null !== $object->getStartsOn()) { - $data['starts_on'] = $object->getStartsOn()->format('Y-m-d'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' === $type; } - if ($object->isInitialized('endsOn') && null !== $object->getEndsOn()) { - $data['ends_on'] = $object->getEndsOn()->format('Y-m-d'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsPostBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (\array_key_exists('over_budget_notification_percentage', $data) && \is_int($data['over_budget_notification_percentage'])) { + $data['over_budget_notification_percentage'] = (float) $data['over_budget_notification_percentage']; + } + if (\array_key_exists('cost_budget', $data) && \is_int($data['cost_budget'])) { + $data['cost_budget'] = (float) $data['cost_budget']; + } + if (\array_key_exists('fee', $data) && \is_int($data['fee'])) { + $data['fee'] = (float) $data['fee']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_billable', $data) && null !== $data['is_billable']) { + $object->setIsBillable($data['is_billable']); + unset($data['is_billable']); + } elseif (\array_key_exists('is_billable', $data) && null === $data['is_billable']) { + $object->setIsBillable(null); + } + if (\array_key_exists('is_fixed_fee', $data) && null !== $data['is_fixed_fee']) { + $object->setIsFixedFee($data['is_fixed_fee']); + unset($data['is_fixed_fee']); + } elseif (\array_key_exists('is_fixed_fee', $data) && null === $data['is_fixed_fee']) { + $object->setIsFixedFee(null); + } + if (\array_key_exists('bill_by', $data) && null !== $data['bill_by']) { + $object->setBillBy($data['bill_by']); + unset($data['bill_by']); + } elseif (\array_key_exists('bill_by', $data) && null === $data['bill_by']) { + $object->setBillBy(null); } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { + $object->setBudgetBy($data['budget_by']); + unset($data['budget_by']); + } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { + $object->setBudgetBy(null); + } + if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { + $object->setBudgetIsMonthly($data['budget_is_monthly']); + unset($data['budget_is_monthly']); + } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { + $object->setBudgetIsMonthly(null); + } + if (\array_key_exists('notify_when_over_budget', $data) && null !== $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget($data['notify_when_over_budget']); + unset($data['notify_when_over_budget']); + } elseif (\array_key_exists('notify_when_over_budget', $data) && null === $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget(null); + } + if (\array_key_exists('over_budget_notification_percentage', $data) && null !== $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage($data['over_budget_notification_percentage']); + unset($data['over_budget_notification_percentage']); + } elseif (\array_key_exists('over_budget_notification_percentage', $data) && null === $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage(null); + } + if (\array_key_exists('show_budget_to_all', $data) && null !== $data['show_budget_to_all']) { + $object->setShowBudgetToAll($data['show_budget_to_all']); + unset($data['show_budget_to_all']); + } elseif (\array_key_exists('show_budget_to_all', $data) && null === $data['show_budget_to_all']) { + $object->setShowBudgetToAll(null); + } + if (\array_key_exists('cost_budget', $data) && null !== $data['cost_budget']) { + $object->setCostBudget($data['cost_budget']); + unset($data['cost_budget']); + } elseif (\array_key_exists('cost_budget', $data) && null === $data['cost_budget']) { + $object->setCostBudget(null); + } + if (\array_key_exists('cost_budget_include_expenses', $data) && null !== $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses($data['cost_budget_include_expenses']); + unset($data['cost_budget_include_expenses']); + } elseif (\array_key_exists('cost_budget_include_expenses', $data) && null === $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses(null); + } + if (\array_key_exists('fee', $data) && null !== $data['fee']) { + $object->setFee($data['fee']); + unset($data['fee']); + } elseif (\array_key_exists('fee', $data) && null === $data['fee']) { + $object->setFee(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('starts_on', $data) && null !== $data['starts_on']) { + $object->setStartsOn(\DateTime::createFromFormat('Y-m-d', $data['starts_on'])->setTime(0, 0, 0)); + unset($data['starts_on']); + } elseif (\array_key_exists('starts_on', $data) && null === $data['starts_on']) { + $object->setStartsOn(null); + } + if (\array_key_exists('ends_on', $data) && null !== $data['ends_on']) { + $object->setEndsOn(\DateTime::createFromFormat('Y-m-d', $data['ends_on'])->setTime(0, 0, 0)); + unset($data['ends_on']); + } elseif (\array_key_exists('ends_on', $data) && null === $data['ends_on']) { + $object->setEndsOn(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['client_id'] = $object->getClientId(); + $data['name'] = $object->getName(); + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + $data['is_billable'] = $object->getIsBillable(); + if ($object->isInitialized('isFixedFee') && null !== $object->getIsFixedFee()) { + $data['is_fixed_fee'] = $object->getIsFixedFee(); + } + $data['bill_by'] = $object->getBillBy(); + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + $data['budget_by'] = $object->getBudgetBy(); + if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { + $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); + } + if ($object->isInitialized('notifyWhenOverBudget') && null !== $object->getNotifyWhenOverBudget()) { + $data['notify_when_over_budget'] = $object->getNotifyWhenOverBudget(); + } + if ($object->isInitialized('overBudgetNotificationPercentage') && null !== $object->getOverBudgetNotificationPercentage()) { + $data['over_budget_notification_percentage'] = $object->getOverBudgetNotificationPercentage(); + } + if ($object->isInitialized('showBudgetToAll') && null !== $object->getShowBudgetToAll()) { + $data['show_budget_to_all'] = $object->getShowBudgetToAll(); + } + if ($object->isInitialized('costBudget') && null !== $object->getCostBudget()) { + $data['cost_budget'] = $object->getCostBudget(); + } + if ($object->isInitialized('costBudgetIncludeExpenses') && null !== $object->getCostBudgetIncludeExpenses()) { + $data['cost_budget_include_expenses'] = $object->getCostBudgetIncludeExpenses(); + } + if ($object->isInitialized('fee') && null !== $object->getFee()) { + $data['fee'] = $object->getFee(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('startsOn') && null !== $object->getStartsOn()) { + $data['starts_on'] = $object->getStartsOn()->format('Y-m-d'); + } + if ($object->isInitialized('endsOn') && null !== $object->getEndsOn()) { + $data['ends_on'] = $object->getEndsOn()->format('Y-m-d'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsPostBody' => false]; + } } } diff --git a/generated/Normalizer/ProjectsProjectIdPatchBodyNormalizer.php b/generated/Normalizer/ProjectsProjectIdPatchBodyNormalizer.php index cbd256e..1b703f1 100644 --- a/generated/Normalizer/ProjectsProjectIdPatchBodyNormalizer.php +++ b/generated/Normalizer/ProjectsProjectIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,266 +22,514 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectsProjectIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectsProjectIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdPatchBody(); - if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { - $data['hourly_rate'] = (float) $data['hourly_rate']; - } - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; - } - if (\array_key_exists('over_budget_notification_percentage', $data) && \is_int($data['over_budget_notification_percentage'])) { - $data['over_budget_notification_percentage'] = (float) $data['over_budget_notification_percentage']; - } - if (\array_key_exists('cost_budget', $data) && \is_int($data['cost_budget'])) { - $data['cost_budget'] = (float) $data['cost_budget']; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' === $type; } - if (\array_key_exists('fee', $data) && \is_int($data['fee'])) { - $data['fee'] = (float) $data['fee']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdPatchBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (\array_key_exists('over_budget_notification_percentage', $data) && \is_int($data['over_budget_notification_percentage'])) { + $data['over_budget_notification_percentage'] = (float) $data['over_budget_notification_percentage']; + } + if (\array_key_exists('cost_budget', $data) && \is_int($data['cost_budget'])) { + $data['cost_budget'] = (float) $data['cost_budget']; + } + if (\array_key_exists('fee', $data) && \is_int($data['fee'])) { + $data['fee'] = (float) $data['fee']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_billable', $data) && null !== $data['is_billable']) { + $object->setIsBillable($data['is_billable']); + unset($data['is_billable']); + } elseif (\array_key_exists('is_billable', $data) && null === $data['is_billable']) { + $object->setIsBillable(null); + } + if (\array_key_exists('is_fixed_fee', $data) && null !== $data['is_fixed_fee']) { + $object->setIsFixedFee($data['is_fixed_fee']); + unset($data['is_fixed_fee']); + } elseif (\array_key_exists('is_fixed_fee', $data) && null === $data['is_fixed_fee']) { + $object->setIsFixedFee(null); + } + if (\array_key_exists('bill_by', $data) && null !== $data['bill_by']) { + $object->setBillBy($data['bill_by']); + unset($data['bill_by']); + } elseif (\array_key_exists('bill_by', $data) && null === $data['bill_by']) { + $object->setBillBy(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { + $object->setBudgetBy($data['budget_by']); + unset($data['budget_by']); + } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { + $object->setBudgetBy(null); + } + if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { + $object->setBudgetIsMonthly($data['budget_is_monthly']); + unset($data['budget_is_monthly']); + } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { + $object->setBudgetIsMonthly(null); + } + if (\array_key_exists('notify_when_over_budget', $data) && null !== $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget($data['notify_when_over_budget']); + unset($data['notify_when_over_budget']); + } elseif (\array_key_exists('notify_when_over_budget', $data) && null === $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget(null); + } + if (\array_key_exists('over_budget_notification_percentage', $data) && null !== $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage($data['over_budget_notification_percentage']); + unset($data['over_budget_notification_percentage']); + } elseif (\array_key_exists('over_budget_notification_percentage', $data) && null === $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage(null); + } + if (\array_key_exists('show_budget_to_all', $data) && null !== $data['show_budget_to_all']) { + $object->setShowBudgetToAll($data['show_budget_to_all']); + unset($data['show_budget_to_all']); + } elseif (\array_key_exists('show_budget_to_all', $data) && null === $data['show_budget_to_all']) { + $object->setShowBudgetToAll(null); + } + if (\array_key_exists('cost_budget', $data) && null !== $data['cost_budget']) { + $object->setCostBudget($data['cost_budget']); + unset($data['cost_budget']); + } elseif (\array_key_exists('cost_budget', $data) && null === $data['cost_budget']) { + $object->setCostBudget(null); + } + if (\array_key_exists('cost_budget_include_expenses', $data) && null !== $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses($data['cost_budget_include_expenses']); + unset($data['cost_budget_include_expenses']); + } elseif (\array_key_exists('cost_budget_include_expenses', $data) && null === $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses(null); + } + if (\array_key_exists('fee', $data) && null !== $data['fee']) { + $object->setFee($data['fee']); + unset($data['fee']); + } elseif (\array_key_exists('fee', $data) && null === $data['fee']) { + $object->setFee(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('starts_on', $data) && null !== $data['starts_on']) { + $object->setStartsOn(\DateTime::createFromFormat('Y-m-d', $data['starts_on'])->setTime(0, 0, 0)); + unset($data['starts_on']); + } elseif (\array_key_exists('starts_on', $data) && null === $data['starts_on']) { + $object->setStartsOn(null); + } + if (\array_key_exists('ends_on', $data) && null !== $data['ends_on']) { + $object->setEndsOn(\DateTime::createFromFormat('Y-m-d', $data['ends_on'])->setTime(0, 0, 0)); + unset($data['ends_on']); + } elseif (\array_key_exists('ends_on', $data) && null === $data['ends_on']) { + $object->setEndsOn(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('code', $data) && null !== $data['code']) { - $object->setCode($data['code']); - unset($data['code']); - } elseif (\array_key_exists('code', $data) && null === $data['code']) { - $object->setCode(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('is_billable', $data) && null !== $data['is_billable']) { - $object->setIsBillable($data['is_billable']); - unset($data['is_billable']); - } elseif (\array_key_exists('is_billable', $data) && null === $data['is_billable']) { - $object->setIsBillable(null); - } - if (\array_key_exists('is_fixed_fee', $data) && null !== $data['is_fixed_fee']) { - $object->setIsFixedFee($data['is_fixed_fee']); - unset($data['is_fixed_fee']); - } elseif (\array_key_exists('is_fixed_fee', $data) && null === $data['is_fixed_fee']) { - $object->setIsFixedFee(null); - } - if (\array_key_exists('bill_by', $data) && null !== $data['bill_by']) { - $object->setBillBy($data['bill_by']); - unset($data['bill_by']); - } elseif (\array_key_exists('bill_by', $data) && null === $data['bill_by']) { - $object->setBillBy(null); - } - if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { - $object->setHourlyRate($data['hourly_rate']); - unset($data['hourly_rate']); - } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { - $object->setHourlyRate(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { - $object->setBudgetBy($data['budget_by']); - unset($data['budget_by']); - } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { - $object->setBudgetBy(null); - } - if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { - $object->setBudgetIsMonthly($data['budget_is_monthly']); - unset($data['budget_is_monthly']); - } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { - $object->setBudgetIsMonthly(null); - } - if (\array_key_exists('notify_when_over_budget', $data) && null !== $data['notify_when_over_budget']) { - $object->setNotifyWhenOverBudget($data['notify_when_over_budget']); - unset($data['notify_when_over_budget']); - } elseif (\array_key_exists('notify_when_over_budget', $data) && null === $data['notify_when_over_budget']) { - $object->setNotifyWhenOverBudget(null); - } - if (\array_key_exists('over_budget_notification_percentage', $data) && null !== $data['over_budget_notification_percentage']) { - $object->setOverBudgetNotificationPercentage($data['over_budget_notification_percentage']); - unset($data['over_budget_notification_percentage']); - } elseif (\array_key_exists('over_budget_notification_percentage', $data) && null === $data['over_budget_notification_percentage']) { - $object->setOverBudgetNotificationPercentage(null); - } - if (\array_key_exists('show_budget_to_all', $data) && null !== $data['show_budget_to_all']) { - $object->setShowBudgetToAll($data['show_budget_to_all']); - unset($data['show_budget_to_all']); - } elseif (\array_key_exists('show_budget_to_all', $data) && null === $data['show_budget_to_all']) { - $object->setShowBudgetToAll(null); - } - if (\array_key_exists('cost_budget', $data) && null !== $data['cost_budget']) { - $object->setCostBudget($data['cost_budget']); - unset($data['cost_budget']); - } elseif (\array_key_exists('cost_budget', $data) && null === $data['cost_budget']) { - $object->setCostBudget(null); - } - if (\array_key_exists('cost_budget_include_expenses', $data) && null !== $data['cost_budget_include_expenses']) { - $object->setCostBudgetIncludeExpenses($data['cost_budget_include_expenses']); - unset($data['cost_budget_include_expenses']); - } elseif (\array_key_exists('cost_budget_include_expenses', $data) && null === $data['cost_budget_include_expenses']) { - $object->setCostBudgetIncludeExpenses(null); - } - if (\array_key_exists('fee', $data) && null !== $data['fee']) { - $object->setFee($data['fee']); - unset($data['fee']); - } elseif (\array_key_exists('fee', $data) && null === $data['fee']) { - $object->setFee(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('starts_on', $data) && null !== $data['starts_on']) { - $object->setStartsOn(\DateTime::createFromFormat('Y-m-d', $data['starts_on'])->setTime(0, 0, 0)); - unset($data['starts_on']); - } elseif (\array_key_exists('starts_on', $data) && null === $data['starts_on']) { - $object->setStartsOn(null); - } - if (\array_key_exists('ends_on', $data) && null !== $data['ends_on']) { - $object->setEndsOn(\DateTime::createFromFormat('Y-m-d', $data['ends_on'])->setTime(0, 0, 0)); - unset($data['ends_on']); - } elseif (\array_key_exists('ends_on', $data) && null === $data['ends_on']) { - $object->setEndsOn(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isBillable') && null !== $object->getIsBillable()) { + $data['is_billable'] = $object->getIsBillable(); + } + if ($object->isInitialized('isFixedFee') && null !== $object->getIsFixedFee()) { + $data['is_fixed_fee'] = $object->getIsFixedFee(); + } + if ($object->isInitialized('billBy') && null !== $object->getBillBy()) { + $data['bill_by'] = $object->getBillBy(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('budgetBy') && null !== $object->getBudgetBy()) { + $data['budget_by'] = $object->getBudgetBy(); + } + if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { + $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); + } + if ($object->isInitialized('notifyWhenOverBudget') && null !== $object->getNotifyWhenOverBudget()) { + $data['notify_when_over_budget'] = $object->getNotifyWhenOverBudget(); + } + if ($object->isInitialized('overBudgetNotificationPercentage') && null !== $object->getOverBudgetNotificationPercentage()) { + $data['over_budget_notification_percentage'] = $object->getOverBudgetNotificationPercentage(); + } + if ($object->isInitialized('showBudgetToAll') && null !== $object->getShowBudgetToAll()) { + $data['show_budget_to_all'] = $object->getShowBudgetToAll(); + } + if ($object->isInitialized('costBudget') && null !== $object->getCostBudget()) { + $data['cost_budget'] = $object->getCostBudget(); + } + if ($object->isInitialized('costBudgetIncludeExpenses') && null !== $object->getCostBudgetIncludeExpenses()) { + $data['cost_budget_include_expenses'] = $object->getCostBudgetIncludeExpenses(); + } + if ($object->isInitialized('fee') && null !== $object->getFee()) { + $data['fee'] = $object->getFee(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('startsOn') && null !== $object->getStartsOn()) { + $data['starts_on'] = $object->getStartsOn()->format('Y-m-d'); } + if ($object->isInitialized('endsOn') && null !== $object->getEndsOn()) { + $data['ends_on'] = $object->getEndsOn()->format('Y-m-d'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectsProjectIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('isBillable') && null !== $object->getIsBillable()) { - $data['is_billable'] = $object->getIsBillable(); - } - if ($object->isInitialized('isFixedFee') && null !== $object->getIsFixedFee()) { - $data['is_fixed_fee'] = $object->getIsFixedFee(); - } - if ($object->isInitialized('billBy') && null !== $object->getBillBy()) { - $data['bill_by'] = $object->getBillBy(); - } - if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { - $data['hourly_rate'] = $object->getHourlyRate(); - } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); - } - if ($object->isInitialized('budgetBy') && null !== $object->getBudgetBy()) { - $data['budget_by'] = $object->getBudgetBy(); - } - if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { - $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); - } - if ($object->isInitialized('notifyWhenOverBudget') && null !== $object->getNotifyWhenOverBudget()) { - $data['notify_when_over_budget'] = $object->getNotifyWhenOverBudget(); - } - if ($object->isInitialized('overBudgetNotificationPercentage') && null !== $object->getOverBudgetNotificationPercentage()) { - $data['over_budget_notification_percentage'] = $object->getOverBudgetNotificationPercentage(); - } - if ($object->isInitialized('showBudgetToAll') && null !== $object->getShowBudgetToAll()) { - $data['show_budget_to_all'] = $object->getShowBudgetToAll(); - } - if ($object->isInitialized('costBudget') && null !== $object->getCostBudget()) { - $data['cost_budget'] = $object->getCostBudget(); - } - if ($object->isInitialized('costBudgetIncludeExpenses') && null !== $object->getCostBudgetIncludeExpenses()) { - $data['cost_budget_include_expenses'] = $object->getCostBudgetIncludeExpenses(); - } - if ($object->isInitialized('fee') && null !== $object->getFee()) { - $data['fee'] = $object->getFee(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('startsOn') && null !== $object->getStartsOn()) { - $data['starts_on'] = $object->getStartsOn()->format('Y-m-d'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' === $type; } - if ($object->isInitialized('endsOn') && null !== $object->getEndsOn()) { - $data['ends_on'] = $object->getEndsOn()->format('Y-m-d'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdPatchBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (\array_key_exists('over_budget_notification_percentage', $data) && \is_int($data['over_budget_notification_percentage'])) { + $data['over_budget_notification_percentage'] = (float) $data['over_budget_notification_percentage']; + } + if (\array_key_exists('cost_budget', $data) && \is_int($data['cost_budget'])) { + $data['cost_budget'] = (float) $data['cost_budget']; + } + if (\array_key_exists('fee', $data) && \is_int($data['fee'])) { + $data['fee'] = (float) $data['fee']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_billable', $data) && null !== $data['is_billable']) { + $object->setIsBillable($data['is_billable']); + unset($data['is_billable']); + } elseif (\array_key_exists('is_billable', $data) && null === $data['is_billable']) { + $object->setIsBillable(null); + } + if (\array_key_exists('is_fixed_fee', $data) && null !== $data['is_fixed_fee']) { + $object->setIsFixedFee($data['is_fixed_fee']); + unset($data['is_fixed_fee']); + } elseif (\array_key_exists('is_fixed_fee', $data) && null === $data['is_fixed_fee']) { + $object->setIsFixedFee(null); + } + if (\array_key_exists('bill_by', $data) && null !== $data['bill_by']) { + $object->setBillBy($data['bill_by']); + unset($data['bill_by']); + } elseif (\array_key_exists('bill_by', $data) && null === $data['bill_by']) { + $object->setBillBy(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('budget_by', $data) && null !== $data['budget_by']) { + $object->setBudgetBy($data['budget_by']); + unset($data['budget_by']); + } elseif (\array_key_exists('budget_by', $data) && null === $data['budget_by']) { + $object->setBudgetBy(null); + } + if (\array_key_exists('budget_is_monthly', $data) && null !== $data['budget_is_monthly']) { + $object->setBudgetIsMonthly($data['budget_is_monthly']); + unset($data['budget_is_monthly']); + } elseif (\array_key_exists('budget_is_monthly', $data) && null === $data['budget_is_monthly']) { + $object->setBudgetIsMonthly(null); + } + if (\array_key_exists('notify_when_over_budget', $data) && null !== $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget($data['notify_when_over_budget']); + unset($data['notify_when_over_budget']); + } elseif (\array_key_exists('notify_when_over_budget', $data) && null === $data['notify_when_over_budget']) { + $object->setNotifyWhenOverBudget(null); + } + if (\array_key_exists('over_budget_notification_percentage', $data) && null !== $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage($data['over_budget_notification_percentage']); + unset($data['over_budget_notification_percentage']); + } elseif (\array_key_exists('over_budget_notification_percentage', $data) && null === $data['over_budget_notification_percentage']) { + $object->setOverBudgetNotificationPercentage(null); + } + if (\array_key_exists('show_budget_to_all', $data) && null !== $data['show_budget_to_all']) { + $object->setShowBudgetToAll($data['show_budget_to_all']); + unset($data['show_budget_to_all']); + } elseif (\array_key_exists('show_budget_to_all', $data) && null === $data['show_budget_to_all']) { + $object->setShowBudgetToAll(null); + } + if (\array_key_exists('cost_budget', $data) && null !== $data['cost_budget']) { + $object->setCostBudget($data['cost_budget']); + unset($data['cost_budget']); + } elseif (\array_key_exists('cost_budget', $data) && null === $data['cost_budget']) { + $object->setCostBudget(null); + } + if (\array_key_exists('cost_budget_include_expenses', $data) && null !== $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses($data['cost_budget_include_expenses']); + unset($data['cost_budget_include_expenses']); + } elseif (\array_key_exists('cost_budget_include_expenses', $data) && null === $data['cost_budget_include_expenses']) { + $object->setCostBudgetIncludeExpenses(null); + } + if (\array_key_exists('fee', $data) && null !== $data['fee']) { + $object->setFee($data['fee']); + unset($data['fee']); + } elseif (\array_key_exists('fee', $data) && null === $data['fee']) { + $object->setFee(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('starts_on', $data) && null !== $data['starts_on']) { + $object->setStartsOn(\DateTime::createFromFormat('Y-m-d', $data['starts_on'])->setTime(0, 0, 0)); + unset($data['starts_on']); + } elseif (\array_key_exists('starts_on', $data) && null === $data['starts_on']) { + $object->setStartsOn(null); + } + if (\array_key_exists('ends_on', $data) && null !== $data['ends_on']) { + $object->setEndsOn(\DateTime::createFromFormat('Y-m-d', $data['ends_on'])->setTime(0, 0, 0)); + unset($data['ends_on']); + } elseif (\array_key_exists('ends_on', $data) && null === $data['ends_on']) { + $object->setEndsOn(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isBillable') && null !== $object->getIsBillable()) { + $data['is_billable'] = $object->getIsBillable(); + } + if ($object->isInitialized('isFixedFee') && null !== $object->getIsFixedFee()) { + $data['is_fixed_fee'] = $object->getIsFixedFee(); + } + if ($object->isInitialized('billBy') && null !== $object->getBillBy()) { + $data['bill_by'] = $object->getBillBy(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('budgetBy') && null !== $object->getBudgetBy()) { + $data['budget_by'] = $object->getBudgetBy(); + } + if ($object->isInitialized('budgetIsMonthly') && null !== $object->getBudgetIsMonthly()) { + $data['budget_is_monthly'] = $object->getBudgetIsMonthly(); + } + if ($object->isInitialized('notifyWhenOverBudget') && null !== $object->getNotifyWhenOverBudget()) { + $data['notify_when_over_budget'] = $object->getNotifyWhenOverBudget(); + } + if ($object->isInitialized('overBudgetNotificationPercentage') && null !== $object->getOverBudgetNotificationPercentage()) { + $data['over_budget_notification_percentage'] = $object->getOverBudgetNotificationPercentage(); + } + if ($object->isInitialized('showBudgetToAll') && null !== $object->getShowBudgetToAll()) { + $data['show_budget_to_all'] = $object->getShowBudgetToAll(); + } + if ($object->isInitialized('costBudget') && null !== $object->getCostBudget()) { + $data['cost_budget'] = $object->getCostBudget(); + } + if ($object->isInitialized('costBudgetIncludeExpenses') && null !== $object->getCostBudgetIncludeExpenses()) { + $data['cost_budget_include_expenses'] = $object->getCostBudgetIncludeExpenses(); + } + if ($object->isInitialized('fee') && null !== $object->getFee()) { + $data['fee'] = $object->getFee(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('startsOn') && null !== $object->getStartsOn()) { + $data['starts_on'] = $object->getStartsOn()->format('Y-m-d'); + } + if ($object->isInitialized('endsOn') && null !== $object->getEndsOn()) { + $data['ends_on'] = $object->getEndsOn()->format('Y-m-d'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/ProjectsProjectIdTaskAssignmentsPostBodyNormalizer.php b/generated/Normalizer/ProjectsProjectIdTaskAssignmentsPostBodyNormalizer.php index a5fbfb6..49c7932 100644 --- a/generated/Normalizer/ProjectsProjectIdTaskAssignmentsPostBodyNormalizer.php +++ b/generated/Normalizer/ProjectsProjectIdTaskAssignmentsPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,120 +22,222 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectsProjectIdTaskAssignmentsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectsProjectIdTaskAssignmentsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdTaskAssignmentsPostBody(); - if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { - $data['hourly_rate'] = (float) $data['hourly_rate']; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' === $type; } - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdTaskAssignmentsPostBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { + $object->setTaskId($data['task_id']); + unset($data['task_id']); + } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { + $object->setTaskId(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { - $object->setTaskId($data['task_id']); - unset($data['task_id']); - } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { - $object->setTaskId(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('billable', $data) && null !== $data['billable']) { - $object->setBillable($data['billable']); - unset($data['billable']); - } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { - $object->setBillable(null); - } - if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { - $object->setHourlyRate($data['hourly_rate']); - unset($data['hourly_rate']); - } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { - $object->setHourlyRate(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['task_id'] = $object->getTaskId(); + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectsProjectIdTaskAssignmentsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['task_id'] = $object->getTaskId(); - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('billable') && null !== $object->getBillable()) { - $data['billable'] = $object->getBillable(); - } - if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { - $data['hourly_rate'] = $object->getHourlyRate(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' === $type; } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdTaskAssignmentsPostBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { + $object->setTaskId($data['task_id']); + unset($data['task_id']); + } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { + $object->setTaskId(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['task_id'] = $object->getTaskId(); + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsPostBody' => false]; + } } } diff --git a/generated/Normalizer/ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBodyNormalizer.php b/generated/Normalizer/ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBodyNormalizer.php index 7a01316..03fb733 100644 --- a/generated/Normalizer/ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBodyNormalizer.php +++ b/generated/Normalizer/ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,113 +22,208 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody(); - if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { - $data['hourly_rate'] = (float) $data['hourly_rate']; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' === $type; } - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('billable', $data) && null !== $data['billable']) { - $object->setBillable($data['billable']); - unset($data['billable']); - } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { - $object->setBillable(null); - } - if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { - $object->setHourlyRate($data['hourly_rate']); - unset($data['hourly_rate']); - } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { - $object->setHourlyRate(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('billable') && null !== $object->getBillable()) { - $data['billable'] = $object->getBillable(); - } - if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { - $data['hourly_rate'] = $object->getHourlyRate(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' === $type; } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdTaskAssignmentsTaskAssignmentIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/ProjectsProjectIdUserAssignmentsPostBodyNormalizer.php b/generated/Normalizer/ProjectsProjectIdUserAssignmentsPostBodyNormalizer.php index 3914985..34c32dd 100644 --- a/generated/Normalizer/ProjectsProjectIdUserAssignmentsPostBodyNormalizer.php +++ b/generated/Normalizer/ProjectsProjectIdUserAssignmentsPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,129 +22,240 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectsProjectIdUserAssignmentsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectsProjectIdUserAssignmentsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' === $type; } - $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdUserAssignmentsPostBody(); - if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { - $data['hourly_rate'] = (float) $data['hourly_rate']; - } - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdUserAssignmentsPostBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { + $object->setUserId($data['user_id']); + unset($data['user_id']); + } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { + $object->setUserId(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { + $object->setIsProjectManager($data['is_project_manager']); + unset($data['is_project_manager']); + } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { + $object->setIsProjectManager(null); + } + if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { + $object->setUseDefaultRates($data['use_default_rates']); + unset($data['use_default_rates']); + } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { + $object->setUseDefaultRates(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { - $object->setUserId($data['user_id']); - unset($data['user_id']); - } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { - $object->setUserId(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { - $object->setIsProjectManager($data['is_project_manager']); - unset($data['is_project_manager']); - } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { - $object->setIsProjectManager(null); - } - if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { - $object->setUseDefaultRates($data['use_default_rates']); - unset($data['use_default_rates']); - } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { - $object->setUseDefaultRates(null); - } - if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { - $object->setHourlyRate($data['hourly_rate']); - unset($data['hourly_rate']); - } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { - $object->setHourlyRate(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['user_id'] = $object->getUserId(); + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { + $data['is_project_manager'] = $object->getIsProjectManager(); + } + if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { + $data['use_default_rates'] = $object->getUseDefaultRates(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectsProjectIdUserAssignmentsPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['user_id'] = $object->getUserId(); - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { - $data['is_project_manager'] = $object->getIsProjectManager(); - } - if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { - $data['use_default_rates'] = $object->getUseDefaultRates(); - } - if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { - $data['hourly_rate'] = $object->getHourlyRate(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' === $type; } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdUserAssignmentsPostBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { + $object->setUserId($data['user_id']); + unset($data['user_id']); + } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { + $object->setUserId(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { + $object->setIsProjectManager($data['is_project_manager']); + unset($data['is_project_manager']); + } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { + $object->setIsProjectManager(null); } + if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { + $object->setUseDefaultRates($data['use_default_rates']); + unset($data['use_default_rates']); + } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { + $object->setUseDefaultRates(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['user_id'] = $object->getUserId(); + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { + $data['is_project_manager'] = $object->getIsProjectManager(); + } + if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { + $data['use_default_rates'] = $object->getUseDefaultRates(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsPostBody' => false]; + } } } diff --git a/generated/Normalizer/ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBodyNormalizer.php b/generated/Normalizer/ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBodyNormalizer.php index f570930..82132e3 100644 --- a/generated/Normalizer/ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBodyNormalizer.php +++ b/generated/Normalizer/ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,122 +22,226 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' === $type; } - $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody(); - if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { - $data['hourly_rate'] = (float) $data['hourly_rate']; - } - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { + $object->setIsProjectManager($data['is_project_manager']); + unset($data['is_project_manager']); + } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { + $object->setIsProjectManager(null); + } + if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { + $object->setUseDefaultRates($data['use_default_rates']); + unset($data['use_default_rates']); + } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { + $object->setUseDefaultRates(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { - $object->setIsProjectManager($data['is_project_manager']); - unset($data['is_project_manager']); - } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { - $object->setIsProjectManager(null); - } - if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { - $object->setUseDefaultRates($data['use_default_rates']); - unset($data['use_default_rates']); - } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { - $object->setUseDefaultRates(null); - } - if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { - $object->setHourlyRate($data['hourly_rate']); - unset($data['hourly_rate']); - } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { - $object->setHourlyRate(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { + $data['is_project_manager'] = $object->getIsProjectManager(); + } + if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { + $data['use_default_rates'] = $object->getUseDefaultRates(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { - $data['is_project_manager'] = $object->getIsProjectManager(); - } - if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { - $data['use_default_rates'] = $object->getUseDefaultRates(); - } - if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { - $data['hourly_rate'] = $object->getHourlyRate(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' === $type; } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { + $object->setIsProjectManager($data['is_project_manager']); + unset($data['is_project_manager']); + } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { + $object->setIsProjectManager(null); + } + if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { + $object->setUseDefaultRates($data['use_default_rates']); + unset($data['use_default_rates']); + } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { + $object->setUseDefaultRates(null); } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { + $data['is_project_manager'] = $object->getIsProjectManager(); + } + if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { + $data['use_default_rates'] = $object->getUseDefaultRates(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\ProjectsProjectIdUserAssignmentsUserAssignmentIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/RoleNormalizer.php b/generated/Normalizer/RoleNormalizer.php index c78eb0e..bcb7da0 100644 --- a/generated/Normalizer/RoleNormalizer.php +++ b/generated/Normalizer/RoleNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,124 +22,230 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class RoleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Role' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class RoleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Role' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Role' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Role' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Role(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Role(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('user_ids', $data) && null !== $data['user_ids']) { + $values = []; + foreach ($data['user_ids'] as $value) { + $values[] = $value; + } + $object->setUserIds($values); + unset($data['user_ids']); + } elseif (\array_key_exists('user_ids', $data) && null === $data['user_ids']) { + $object->setUserIds(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('user_ids', $data) && null !== $data['user_ids']) { - $values = []; - foreach ($data['user_ids'] as $value) { - $values[] = $value; - } - $object->setUserIds($values); - unset($data['user_ids']); - } elseif (\array_key_exists('user_ids', $data) && null === $data['user_ids']) { - $object->setUserIds(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('userIds') && null !== $object->getUserIds()) { + $values = []; + foreach ($object->getUserIds() as $value) { + $values[] = $value; + } + $data['user_ids'] = $values; + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Role' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class RoleNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Role' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Role' === $data::class; } - if ($object->isInitialized('userIds') && null !== $object->getUserIds()) { - $values = []; - foreach ($object->getUserIds() as $value) { - $values[] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['user_ids'] = $values; - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Role(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('user_ids', $data) && null !== $data['user_ids']) { + $values = []; + foreach ($data['user_ids'] as $value) { + $values[] = $value; + } + $object->setUserIds($values); + unset($data['user_ids']); + } elseif (\array_key_exists('user_ids', $data) && null === $data['user_ids']) { + $object->setUserIds(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('userIds') && null !== $object->getUserIds()) { + $values = []; + foreach ($object->getUserIds() as $value) { + $values[] = $value; + } + $data['user_ids'] = $values; + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Role' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Role' => false]; + } } } diff --git a/generated/Normalizer/RolesNormalizer.php b/generated/Normalizer/RolesNormalizer.php index e59e193..af0ff96 100644 --- a/generated/Normalizer/RolesNormalizer.php +++ b/generated/Normalizer/RolesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class RolesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Roles' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class RolesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Roles' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Roles' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Roles' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Roles(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Roles(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('roles', $data)) { + $values = []; + foreach ($data['roles'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Role', 'json', $context); + } + $object->setRoles($values); + unset($data['roles']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('roles', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['roles'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Role', 'json', $context); + foreach ($object->getRoles() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setRoles($values); - unset($data['roles']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['roles'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Roles' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class RolesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getRoles() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Roles' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Roles' === $data::class; } - $data['roles'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Roles(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('roles', $data)) { + $values = []; + foreach ($data['roles'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Role', 'json', $context); + } + $object->setRoles($values); + unset($data['roles']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getRoles() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['roles'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Roles' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Roles' => false]; + } } } diff --git a/generated/Normalizer/RolesPostBodyNormalizer.php b/generated/Normalizer/RolesPostBodyNormalizer.php index 1f49df8..3fb08a4 100644 --- a/generated/Normalizer/RolesPostBodyNormalizer.php +++ b/generated/Normalizer/RolesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,95 +22,172 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class RolesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class RolesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\RolesPostBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\RolesPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('user_ids', $data) && null !== $data['user_ids']) { + $values = []; + foreach ($data['user_ids'] as $value) { + $values[] = $value; + } + $object->setUserIds($values); + unset($data['user_ids']); + } elseif (\array_key_exists('user_ids', $data) && null === $data['user_ids']) { + $object->setUserIds(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('user_ids', $data) && null !== $data['user_ids']) { - $values = []; - foreach ($data['user_ids'] as $value) { - $values[] = $value; - } - $object->setUserIds($values); - unset($data['user_ids']); - } elseif (\array_key_exists('user_ids', $data) && null === $data['user_ids']) { - $object->setUserIds(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['name'] = $object->getName(); + if ($object->isInitialized('userIds') && null !== $object->getUserIds()) { + $values = []; + foreach ($object->getUserIds() as $value) { + $values[] = $value; + } + $data['user_ids'] = $values; } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\RolesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class RolesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['name'] = $object->getName(); - if ($object->isInitialized('userIds') && null !== $object->getUserIds()) { - $values = []; - foreach ($object->getUserIds() as $value) { - $values[] = $value; - } - $data['user_ids'] = $values; + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\RolesPostBody' === $data::class; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\RolesPostBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('user_ids', $data) && null !== $data['user_ids']) { + $values = []; + foreach ($data['user_ids'] as $value) { + $values[] = $value; + } + $object->setUserIds($values); + unset($data['user_ids']); + } elseif (\array_key_exists('user_ids', $data) && null === $data['user_ids']) { + $object->setUserIds(null); } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + if ($object->isInitialized('userIds') && null !== $object->getUserIds()) { + $values = []; + foreach ($object->getUserIds() as $value) { + $values[] = $value; + } + $data['user_ids'] = $values; + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\RolesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\RolesPostBody' => false]; + } } } diff --git a/generated/Normalizer/RolesRoleIdPatchBodyNormalizer.php b/generated/Normalizer/RolesRoleIdPatchBodyNormalizer.php index 394365b..a49cec6 100644 --- a/generated/Normalizer/RolesRoleIdPatchBodyNormalizer.php +++ b/generated/Normalizer/RolesRoleIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,97 +22,176 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class RolesRoleIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class RolesRoleIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\RolesRoleIdPatchBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\RolesRoleIdPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('user_ids', $data) && null !== $data['user_ids']) { + $values = []; + foreach ($data['user_ids'] as $value) { + $values[] = $value; + } + $object->setUserIds($values); + unset($data['user_ids']); + } elseif (\array_key_exists('user_ids', $data) && null === $data['user_ids']) { + $object->setUserIds(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('user_ids', $data) && null !== $data['user_ids']) { - $values = []; - foreach ($data['user_ids'] as $value) { - $values[] = $value; - } - $object->setUserIds($values); - unset($data['user_ids']); - } elseif (\array_key_exists('user_ids', $data) && null === $data['user_ids']) { - $object->setUserIds(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('userIds') && null !== $object->getUserIds()) { + $values = []; + foreach ($object->getUserIds() as $value) { + $values[] = $value; + } + $data['user_ids'] = $values; } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class RolesRoleIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' === $type; } - if ($object->isInitialized('userIds') && null !== $object->getUserIds()) { - $values = []; - foreach ($object->getUserIds() as $value) { - $values[] = $value; - } - $data['user_ids'] = $values; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' === $data::class; } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\RolesRoleIdPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('user_ids', $data) && null !== $data['user_ids']) { + $values = []; + foreach ($data['user_ids'] as $value) { + $values[] = $value; + } + $object->setUserIds($values); + unset($data['user_ids']); + } elseif (\array_key_exists('user_ids', $data) && null === $data['user_ids']) { + $object->setUserIds(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('userIds') && null !== $object->getUserIds()) { + $values = []; + foreach ($object->getUserIds() as $value) { + $values[] = $value; + } + $data['user_ids'] = $values; + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\RolesRoleIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/TaskAssignmentNormalizer.php b/generated/Normalizer/TaskAssignmentNormalizer.php index 417560f..dad4225 100644 --- a/generated/Normalizer/TaskAssignmentNormalizer.php +++ b/generated/Normalizer/TaskAssignmentNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,158 +22,298 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TaskAssignmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TaskAssignmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\TaskAssignment(); - if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { - $data['hourly_rate'] = (float) $data['hourly_rate']; - } - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TaskAssignment(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('task', $data) && null !== $data['task']) { + $object->setTask($this->denormalizer->denormalize($data['task'], 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask', 'json', $context)); + unset($data['task']); + } elseif (\array_key_exists('task', $data) && null === $data['task']) { + $object->setTask(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('project', $data) && null !== $data['project']) { - $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject', 'json', $context)); - unset($data['project']); - } elseif (\array_key_exists('project', $data) && null === $data['project']) { - $object->setProject(null); - } - if (\array_key_exists('task', $data) && null !== $data['task']) { - $object->setTask($this->denormalizer->denormalize($data['task'], 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask', 'json', $context)); - unset($data['task']); - } elseif (\array_key_exists('task', $data) && null === $data['task']) { - $object->setTask(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('billable', $data) && null !== $data['billable']) { - $object->setBillable($data['billable']); - unset($data['billable']); - } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { - $object->setBillable(null); - } - if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { - $object->setHourlyRate($data['hourly_rate']); - unset($data['hourly_rate']); - } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { - $object->setHourlyRate(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('task') && null !== $object->getTask()) { + $data['task'] = $this->normalizer->normalize($object->getTask(), 'json', $context); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignment' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TaskAssignmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('project') && null !== $object->getProject()) { - $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); - } - if ($object->isInitialized('task') && null !== $object->getTask()) { - $data['task'] = $this->normalizer->normalize($object->getTask(), 'json', $context); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('billable') && null !== $object->getBillable()) { - $data['billable'] = $object->getBillable(); - } - if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { - $data['hourly_rate'] = $object->getHourlyRate(); - } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TaskAssignment(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('task', $data) && null !== $data['task']) { + $object->setTask($this->denormalizer->denormalize($data['task'], 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask', 'json', $context)); + unset($data['task']); + } elseif (\array_key_exists('task', $data) && null === $data['task']) { + $object->setTask(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('task') && null !== $object->getTask()) { + $data['task'] = $this->normalizer->normalize($object->getTask(), 'json', $context); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignment' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignment' => false]; + } } } diff --git a/generated/Normalizer/TaskAssignmentProjectNormalizer.php b/generated/Normalizer/TaskAssignmentProjectNormalizer.php index 5bfa36b..215e2d0 100644 --- a/generated/Normalizer/TaskAssignmentProjectNormalizer.php +++ b/generated/Normalizer/TaskAssignmentProjectNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,98 +22,178 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TaskAssignmentProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TaskAssignmentProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TaskAssignmentProject(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TaskAssignmentProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('code', $data) && null !== $data['code']) { - $object->setCode($data['code']); - unset($data['code']); - } elseif (\array_key_exists('code', $data) && null === $data['code']) { - $object->setCode(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TaskAssignmentProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' === $type; } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TaskAssignmentProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignmentProject' => false]; + } } } diff --git a/generated/Normalizer/TaskAssignmentTaskNormalizer.php b/generated/Normalizer/TaskAssignmentTaskNormalizer.php index 199e8ef..6fd7422 100644 --- a/generated/Normalizer/TaskAssignmentTaskNormalizer.php +++ b/generated/Normalizer/TaskAssignmentTaskNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TaskAssignmentTaskNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TaskAssignmentTaskNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TaskAssignmentTask(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TaskAssignmentTask(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TaskAssignmentTaskNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TaskAssignmentTask(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignmentTask' => false]; + } } } diff --git a/generated/Normalizer/TaskAssignmentsNormalizer.php b/generated/Normalizer/TaskAssignmentsNormalizer.php index 86465e0..47c823d 100644 --- a/generated/Normalizer/TaskAssignmentsNormalizer.php +++ b/generated/Normalizer/TaskAssignmentsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TaskAssignmentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TaskAssignmentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TaskAssignments(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TaskAssignments(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('task_assignments', $data)) { + $values = []; + foreach ($data['task_assignments'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment', 'json', $context); + } + $object->setTaskAssignments($values); + unset($data['task_assignments']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('task_assignments', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['task_assignments'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment', 'json', $context); + foreach ($object->getTaskAssignments() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setTaskAssignments($values); - unset($data['task_assignments']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['task_assignments'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignments' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TaskAssignmentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getTaskAssignments() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TaskAssignments' === $data::class; } - $data['task_assignments'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TaskAssignments(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('task_assignments', $data)) { + $values = []; + foreach ($data['task_assignments'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment', 'json', $context); + } + $object->setTaskAssignments($values); + unset($data['task_assignments']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getTaskAssignments() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['task_assignments'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignments' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TaskAssignments' => false]; + } } } diff --git a/generated/Normalizer/TaskNormalizer.php b/generated/Normalizer/TaskNormalizer.php index bef30b4..edfd38f 100644 --- a/generated/Normalizer/TaskNormalizer.php +++ b/generated/Normalizer/TaskNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,146 +22,274 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TaskNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TaskNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\Task' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Task' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Task' === $type; } - $object = new \JoliCode\Harvest\Api\Model\Task(); - if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { - $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Task' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Task(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('billable_by_default', $data) && null !== $data['billable_by_default']) { + $object->setBillableByDefault($data['billable_by_default']); + unset($data['billable_by_default']); + } elseif (\array_key_exists('billable_by_default', $data) && null === $data['billable_by_default']) { + $object->setBillableByDefault(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('is_default', $data) && null !== $data['is_default']) { + $object->setIsDefault($data['is_default']); + unset($data['is_default']); + } elseif (\array_key_exists('is_default', $data) && null === $data['is_default']) { + $object->setIsDefault(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('billable_by_default', $data) && null !== $data['billable_by_default']) { - $object->setBillableByDefault($data['billable_by_default']); - unset($data['billable_by_default']); - } elseif (\array_key_exists('billable_by_default', $data) && null === $data['billable_by_default']) { - $object->setBillableByDefault(null); - } - if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { - $object->setDefaultHourlyRate($data['default_hourly_rate']); - unset($data['default_hourly_rate']); - } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { - $object->setDefaultHourlyRate(null); - } - if (\array_key_exists('is_default', $data) && null !== $data['is_default']) { - $object->setIsDefault($data['is_default']); - unset($data['is_default']); - } elseif (\array_key_exists('is_default', $data) && null === $data['is_default']) { - $object->setIsDefault(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('billableByDefault') && null !== $object->getBillableByDefault()) { + $data['billable_by_default'] = $object->getBillableByDefault(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('isDefault') && null !== $object->getIsDefault()) { + $data['is_default'] = $object->getIsDefault(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Task' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TaskNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('billableByDefault') && null !== $object->getBillableByDefault()) { - $data['billable_by_default'] = $object->getBillableByDefault(); - } - if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { - $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); - } - if ($object->isInitialized('isDefault') && null !== $object->getIsDefault()) { - $data['is_default'] = $object->getIsDefault(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Task' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Task' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Task(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('billable_by_default', $data) && null !== $data['billable_by_default']) { + $object->setBillableByDefault($data['billable_by_default']); + unset($data['billable_by_default']); + } elseif (\array_key_exists('billable_by_default', $data) && null === $data['billable_by_default']) { + $object->setBillableByDefault(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('is_default', $data) && null !== $data['is_default']) { + $object->setIsDefault($data['is_default']); + unset($data['is_default']); + } elseif (\array_key_exists('is_default', $data) && null === $data['is_default']) { + $object->setIsDefault(null); } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('billableByDefault') && null !== $object->getBillableByDefault()) { + $data['billable_by_default'] = $object->getBillableByDefault(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('isDefault') && null !== $object->getIsDefault()) { + $data['is_default'] = $object->getIsDefault(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Task' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Task' => false]; + } } } diff --git a/generated/Normalizer/TasksNormalizer.php b/generated/Normalizer/TasksNormalizer.php index f73dba9..8b558f2 100644 --- a/generated/Normalizer/TasksNormalizer.php +++ b/generated/Normalizer/TasksNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TasksNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Tasks' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TasksNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Tasks' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Tasks' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Tasks' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Tasks(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Tasks(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('tasks', $data)) { + $values = []; + foreach ($data['tasks'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Task', 'json', $context); + } + $object->setTasks($values); + unset($data['tasks']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('tasks', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['tasks'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Task', 'json', $context); + foreach ($object->getTasks() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setTasks($values); - unset($data['tasks']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['tasks'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Tasks' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TasksNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getTasks() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Tasks' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Tasks' === $data::class; } - $data['tasks'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Tasks(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('tasks', $data)) { + $values = []; + foreach ($data['tasks'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Task', 'json', $context); + } + $object->setTasks($values); + unset($data['tasks']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getTasks() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['tasks'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Tasks' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Tasks' => false]; + } } } diff --git a/generated/Normalizer/TasksPostBodyNormalizer.php b/generated/Normalizer/TasksPostBodyNormalizer.php index ea6cc19..da63e31 100644 --- a/generated/Normalizer/TasksPostBodyNormalizer.php +++ b/generated/Normalizer/TasksPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,117 +22,216 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TasksPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TasksPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\TasksPostBody(); - if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { - $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TasksPostBody(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('billable_by_default', $data) && null !== $data['billable_by_default']) { + $object->setBillableByDefault($data['billable_by_default']); + unset($data['billable_by_default']); + } elseif (\array_key_exists('billable_by_default', $data) && null === $data['billable_by_default']) { + $object->setBillableByDefault(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('is_default', $data) && null !== $data['is_default']) { + $object->setIsDefault($data['is_default']); + unset($data['is_default']); + } elseif (\array_key_exists('is_default', $data) && null === $data['is_default']) { + $object->setIsDefault(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('billable_by_default', $data) && null !== $data['billable_by_default']) { - $object->setBillableByDefault($data['billable_by_default']); - unset($data['billable_by_default']); - } elseif (\array_key_exists('billable_by_default', $data) && null === $data['billable_by_default']) { - $object->setBillableByDefault(null); - } - if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { - $object->setDefaultHourlyRate($data['default_hourly_rate']); - unset($data['default_hourly_rate']); - } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { - $object->setDefaultHourlyRate(null); - } - if (\array_key_exists('is_default', $data) && null !== $data['is_default']) { - $object->setIsDefault($data['is_default']); - unset($data['is_default']); - } elseif (\array_key_exists('is_default', $data) && null === $data['is_default']) { - $object->setIsDefault(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['name'] = $object->getName(); + if ($object->isInitialized('billableByDefault') && null !== $object->getBillableByDefault()) { + $data['billable_by_default'] = $object->getBillableByDefault(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('isDefault') && null !== $object->getIsDefault()) { + $data['is_default'] = $object->getIsDefault(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TasksPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TasksPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['name'] = $object->getName(); - if ($object->isInitialized('billableByDefault') && null !== $object->getBillableByDefault()) { - $data['billable_by_default'] = $object->getBillableByDefault(); - } - if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { - $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); - } - if ($object->isInitialized('isDefault') && null !== $object->getIsDefault()) { - $data['is_default'] = $object->getIsDefault(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' === $type; } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TasksPostBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TasksPostBody(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('billable_by_default', $data) && null !== $data['billable_by_default']) { + $object->setBillableByDefault($data['billable_by_default']); + unset($data['billable_by_default']); + } elseif (\array_key_exists('billable_by_default', $data) && null === $data['billable_by_default']) { + $object->setBillableByDefault(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('is_default', $data) && null !== $data['is_default']) { + $object->setIsDefault($data['is_default']); + unset($data['is_default']); + } elseif (\array_key_exists('is_default', $data) && null === $data['is_default']) { + $object->setIsDefault(null); } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + if ($object->isInitialized('billableByDefault') && null !== $object->getBillableByDefault()) { + $data['billable_by_default'] = $object->getBillableByDefault(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('isDefault') && null !== $object->getIsDefault()) { + $data['is_default'] = $object->getIsDefault(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TasksPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TasksPostBody' => false]; + } } } diff --git a/generated/Normalizer/TasksTaskIdPatchBodyNormalizer.php b/generated/Normalizer/TasksTaskIdPatchBodyNormalizer.php index 86aa841..42a8a58 100644 --- a/generated/Normalizer/TasksTaskIdPatchBodyNormalizer.php +++ b/generated/Normalizer/TasksTaskIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,119 +22,220 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TasksTaskIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TasksTaskIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\TasksTaskIdPatchBody(); - if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { - $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TasksTaskIdPatchBody(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('billable_by_default', $data) && null !== $data['billable_by_default']) { + $object->setBillableByDefault($data['billable_by_default']); + unset($data['billable_by_default']); + } elseif (\array_key_exists('billable_by_default', $data) && null === $data['billable_by_default']) { + $object->setBillableByDefault(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('is_default', $data) && null !== $data['is_default']) { + $object->setIsDefault($data['is_default']); + unset($data['is_default']); + } elseif (\array_key_exists('is_default', $data) && null === $data['is_default']) { + $object->setIsDefault(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('billable_by_default', $data) && null !== $data['billable_by_default']) { - $object->setBillableByDefault($data['billable_by_default']); - unset($data['billable_by_default']); - } elseif (\array_key_exists('billable_by_default', $data) && null === $data['billable_by_default']) { - $object->setBillableByDefault(null); - } - if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { - $object->setDefaultHourlyRate($data['default_hourly_rate']); - unset($data['default_hourly_rate']); - } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { - $object->setDefaultHourlyRate(null); - } - if (\array_key_exists('is_default', $data) && null !== $data['is_default']) { - $object->setIsDefault($data['is_default']); - unset($data['is_default']); - } elseif (\array_key_exists('is_default', $data) && null === $data['is_default']) { - $object->setIsDefault(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('billableByDefault') && null !== $object->getBillableByDefault()) { + $data['billable_by_default'] = $object->getBillableByDefault(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('isDefault') && null !== $object->getIsDefault()) { + $data['is_default'] = $object->getIsDefault(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TasksTaskIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('billableByDefault') && null !== $object->getBillableByDefault()) { - $data['billable_by_default'] = $object->getBillableByDefault(); - } - if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { - $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); - } - if ($object->isInitialized('isDefault') && null !== $object->getIsDefault()) { - $data['is_default'] = $object->getIsDefault(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' === $type; } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TasksTaskIdPatchBody(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('billable_by_default', $data) && null !== $data['billable_by_default']) { + $object->setBillableByDefault($data['billable_by_default']); + unset($data['billable_by_default']); + } elseif (\array_key_exists('billable_by_default', $data) && null === $data['billable_by_default']) { + $object->setBillableByDefault(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('is_default', $data) && null !== $data['is_default']) { + $object->setIsDefault($data['is_default']); + unset($data['is_default']); + } elseif (\array_key_exists('is_default', $data) && null === $data['is_default']) { + $object->setIsDefault(null); } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('billableByDefault') && null !== $object->getBillableByDefault()) { + $data['billable_by_default'] = $object->getBillableByDefault(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('isDefault') && null !== $object->getIsDefault()) { + $data['is_default'] = $object->getIsDefault(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TasksTaskIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/TeammateNormalizer.php b/generated/Normalizer/TeammateNormalizer.php index e2daf58..9d13c3e 100644 --- a/generated/Normalizer/TeammateNormalizer.php +++ b/generated/Normalizer/TeammateNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,107 +22,196 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TeammateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TeammateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\Teammate' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Teammate' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Teammate' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Teammate' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Teammate(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Teammate(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { - $object->setFirstName($data['first_name']); - unset($data['first_name']); - } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { - $object->setFirstName(null); - } - if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { - $object->setLastName($data['last_name']); - unset($data['last_name']); - } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { - $object->setLastName(null); - } - if (\array_key_exists('email', $data) && null !== $data['email']) { - $object->setEmail($data['email']); - unset($data['email']); - } elseif (\array_key_exists('email', $data) && null === $data['email']) { - $object->setEmail(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { + $data['first_name'] = $object->getFirstName(); + } + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Teammate' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TeammateNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { - $data['first_name'] = $object->getFirstName(); - } - if ($object->isInitialized('lastName') && null !== $object->getLastName()) { - $data['last_name'] = $object->getLastName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Teammate' === $type; } - if ($object->isInitialized('email') && null !== $object->getEmail()) { - $data['email'] = $object->getEmail(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Teammate' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Teammate(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { + $data['first_name'] = $object->getFirstName(); + } + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Teammate' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Teammate' => false]; + } } } diff --git a/generated/Normalizer/TeammatesNormalizer.php b/generated/Normalizer/TeammatesNormalizer.php index 6e2197d..19c608d 100644 --- a/generated/Normalizer/TeammatesNormalizer.php +++ b/generated/Normalizer/TeammatesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TeammatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Teammates' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TeammatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Teammates' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Teammates' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Teammates' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Teammates(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Teammates(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('teammates', $data)) { + $values = []; + foreach ($data['teammates'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Teammate', 'json', $context); + } + $object->setTeammates($values); + unset($data['teammates']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('teammates', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['teammates'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Teammate', 'json', $context); + foreach ($object->getTeammates() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setTeammates($values); - unset($data['teammates']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['teammates'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Teammates' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TeammatesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getTeammates() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Teammates' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Teammates' === $data::class; } - $data['teammates'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Teammates(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('teammates', $data)) { + $values = []; + foreach ($data['teammates'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Teammate', 'json', $context); + } + $object->setTeammates($values); + unset($data['teammates']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getTeammates() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['teammates'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Teammates' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Teammates' => false]; + } } } diff --git a/generated/Normalizer/TeammatesPatchResponseNormalizer.php b/generated/Normalizer/TeammatesPatchResponseNormalizer.php index 1811ccb..a689ff9 100644 --- a/generated/Normalizer/TeammatesPatchResponseNormalizer.php +++ b/generated/Normalizer/TeammatesPatchResponseNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,84 +22,150 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TeammatesPatchResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TeammatesPatchResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TeammatesPatchResponse(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TeammatesPatchResponse(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('teammates', $data)) { + $values = []; + foreach ($data['teammates'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Teammate', 'json', $context); + } + $object->setTeammates($values); + unset($data['teammates']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('teammates', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['teammates'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Teammate', 'json', $context); + foreach ($object->getTeammates() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setTeammates($values); - unset($data['teammates']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['teammates'] = $values; + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TeammatesPatchResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getTeammates() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' === $data::class; } - $data['teammates'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } + $object = new \JoliCode\Harvest\Api\Model\TeammatesPatchResponse(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('teammates', $data)) { + $values = []; + foreach ($data['teammates'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\Teammate', 'json', $context); + } + $object->setTeammates($values); + unset($data['teammates']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getTeammates() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['teammates'] = $values; + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TeammatesPatchResponse' => false]; + } } } diff --git a/generated/Normalizer/TimeEntriesNormalizer.php b/generated/Normalizer/TimeEntriesNormalizer.php index f84900e..2f35323 100644 --- a/generated/Normalizer/TimeEntriesNormalizer.php +++ b/generated/Normalizer/TimeEntriesNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntries(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntries(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('time_entries', $data)) { + $values = []; + foreach ($data['time_entries'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TimeEntry', 'json', $context); + } + $object->setTimeEntries($values); + unset($data['time_entries']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('time_entries', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['time_entries'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TimeEntry', 'json', $context); + foreach ($object->getTimeEntries() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setTimeEntries($values); - unset($data['time_entries']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['time_entries'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntries' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntriesNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getTimeEntries() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntries' === $data::class; } - $data['time_entries'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntries(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('time_entries', $data)) { + $values = []; + foreach ($data['time_entries'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TimeEntry', 'json', $context); + } + $object->setTimeEntries($values); + unset($data['time_entries']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getTimeEntries() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['time_entries'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntries' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntries' => false]; + } } } diff --git a/generated/Normalizer/TimeEntriesPostBodyExternalReferenceNormalizer.php b/generated/Normalizer/TimeEntriesPostBodyExternalReferenceNormalizer.php index 2e5befc..83402bf 100644 --- a/generated/Normalizer/TimeEntriesPostBodyExternalReferenceNormalizer.php +++ b/generated/Normalizer/TimeEntriesPostBodyExternalReferenceNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,107 +22,196 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntriesPostBodyExternalReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntriesPostBodyExternalReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntriesPostBodyExternalReference(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntriesPostBodyExternalReference(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('group_id', $data) && null !== $data['group_id']) { + $object->setGroupId($data['group_id']); + unset($data['group_id']); + } elseif (\array_key_exists('group_id', $data) && null === $data['group_id']) { + $object->setGroupId(null); + } + if (\array_key_exists('account_id', $data) && null !== $data['account_id']) { + $object->setAccountId($data['account_id']); + unset($data['account_id']); + } elseif (\array_key_exists('account_id', $data) && null === $data['account_id']) { + $object->setAccountId(null); + } + if (\array_key_exists('permalink', $data) && null !== $data['permalink']) { + $object->setPermalink($data['permalink']); + unset($data['permalink']); + } elseif (\array_key_exists('permalink', $data) && null === $data['permalink']) { + $object->setPermalink(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('group_id', $data) && null !== $data['group_id']) { - $object->setGroupId($data['group_id']); - unset($data['group_id']); - } elseif (\array_key_exists('group_id', $data) && null === $data['group_id']) { - $object->setGroupId(null); - } - if (\array_key_exists('account_id', $data) && null !== $data['account_id']) { - $object->setAccountId($data['account_id']); - unset($data['account_id']); - } elseif (\array_key_exists('account_id', $data) && null === $data['account_id']) { - $object->setAccountId(null); - } - if (\array_key_exists('permalink', $data) && null !== $data['permalink']) { - $object->setPermalink($data['permalink']); - unset($data['permalink']); - } elseif (\array_key_exists('permalink', $data) && null === $data['permalink']) { - $object->setPermalink(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('groupId') && null !== $object->getGroupId()) { + $data['group_id'] = $object->getGroupId(); + } + if ($object->isInitialized('accountId') && null !== $object->getAccountId()) { + $data['account_id'] = $object->getAccountId(); } + if ($object->isInitialized('permalink') && null !== $object->getPermalink()) { + $data['permalink'] = $object->getPermalink(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntriesPostBodyExternalReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('groupId') && null !== $object->getGroupId()) { - $data['group_id'] = $object->getGroupId(); - } - if ($object->isInitialized('accountId') && null !== $object->getAccountId()) { - $data['account_id'] = $object->getAccountId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' === $type; } - if ($object->isInitialized('permalink') && null !== $object->getPermalink()) { - $data['permalink'] = $object->getPermalink(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntriesPostBodyExternalReference(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('group_id', $data) && null !== $data['group_id']) { + $object->setGroupId($data['group_id']); + unset($data['group_id']); + } elseif (\array_key_exists('group_id', $data) && null === $data['group_id']) { + $object->setGroupId(null); + } + if (\array_key_exists('account_id', $data) && null !== $data['account_id']) { + $object->setAccountId($data['account_id']); + unset($data['account_id']); + } elseif (\array_key_exists('account_id', $data) && null === $data['account_id']) { + $object->setAccountId(null); + } + if (\array_key_exists('permalink', $data) && null !== $data['permalink']) { + $object->setPermalink($data['permalink']); + unset($data['permalink']); + } elseif (\array_key_exists('permalink', $data) && null === $data['permalink']) { + $object->setPermalink(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('groupId') && null !== $object->getGroupId()) { + $data['group_id'] = $object->getGroupId(); + } + if ($object->isInitialized('accountId') && null !== $object->getAccountId()) { + $data['account_id'] = $object->getAccountId(); + } + if ($object->isInitialized('permalink') && null !== $object->getPermalink()) { + $data['permalink'] = $object->getPermalink(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference' => false]; + } } } diff --git a/generated/Normalizer/TimeEntriesPostBodyNormalizer.php b/generated/Normalizer/TimeEntriesPostBodyNormalizer.php index 6c2891f..52b817d 100644 --- a/generated/Normalizer/TimeEntriesPostBodyNormalizer.php +++ b/generated/Normalizer/TimeEntriesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,149 +22,280 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' === $type; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntriesPostBody(); - if (\array_key_exists('hours', $data) && \is_int($data['hours'])) { - $data['hours'] = (float) $data['hours']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntriesPostBody(); + if (\array_key_exists('hours', $data) && \is_int($data['hours'])) { + $data['hours'] = (float) $data['hours']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { + $object->setUserId($data['user_id']); + unset($data['user_id']); + } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { + $object->setUserId(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { + $object->setTaskId($data['task_id']); + unset($data['task_id']); + } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { + $object->setTaskId(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('started_time', $data) && null !== $data['started_time']) { + $object->setStartedTime($data['started_time']); + unset($data['started_time']); + } elseif (\array_key_exists('started_time', $data) && null === $data['started_time']) { + $object->setStartedTime(null); + } + if (\array_key_exists('ended_time', $data) && null !== $data['ended_time']) { + $object->setEndedTime($data['ended_time']); + unset($data['ended_time']); + } elseif (\array_key_exists('ended_time', $data) && null === $data['ended_time']) { + $object->setEndedTime(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('external_reference', $data) && null !== $data['external_reference']) { + $object->setExternalReference($this->denormalizer->denormalize($data['external_reference'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference', 'json', $context)); + unset($data['external_reference']); + } elseif (\array_key_exists('external_reference', $data) && null === $data['external_reference']) { + $object->setExternalReference(null); + } + if (\array_key_exists('hours', $data) && null !== $data['hours']) { + $object->setHours($data['hours']); + unset($data['hours']); + } elseif (\array_key_exists('hours', $data) && null === $data['hours']) { + $object->setHours(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { - $object->setUserId($data['user_id']); - unset($data['user_id']); - } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { - $object->setUserId(null); - } - if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { - $object->setProjectId($data['project_id']); - unset($data['project_id']); - } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { - $object->setProjectId(null); - } - if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { - $object->setTaskId($data['task_id']); - unset($data['task_id']); - } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { - $object->setTaskId(null); - } - if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { - $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); - unset($data['spent_date']); - } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { - $object->setSpentDate(null); - } - if (\array_key_exists('started_time', $data) && null !== $data['started_time']) { - $object->setStartedTime($data['started_time']); - unset($data['started_time']); - } elseif (\array_key_exists('started_time', $data) && null === $data['started_time']) { - $object->setStartedTime(null); - } - if (\array_key_exists('ended_time', $data) && null !== $data['ended_time']) { - $object->setEndedTime($data['ended_time']); - unset($data['ended_time']); - } elseif (\array_key_exists('ended_time', $data) && null === $data['ended_time']) { - $object->setEndedTime(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('external_reference', $data) && null !== $data['external_reference']) { - $object->setExternalReference($this->denormalizer->denormalize($data['external_reference'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference', 'json', $context)); - unset($data['external_reference']); - } elseif (\array_key_exists('external_reference', $data) && null === $data['external_reference']) { - $object->setExternalReference(null); - } - if (\array_key_exists('hours', $data) && null !== $data['hours']) { - $object->setHours($data['hours']); - unset($data['hours']); - } elseif (\array_key_exists('hours', $data) && null === $data['hours']) { - $object->setHours(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('userId') && null !== $object->getUserId()) { + $data['user_id'] = $object->getUserId(); + } + $data['project_id'] = $object->getProjectId(); + $data['task_id'] = $object->getTaskId(); + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + if ($object->isInitialized('startedTime') && null !== $object->getStartedTime()) { + $data['started_time'] = $object->getStartedTime(); + } + if ($object->isInitialized('endedTime') && null !== $object->getEndedTime()) { + $data['ended_time'] = $object->getEndedTime(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('externalReference') && null !== $object->getExternalReference()) { + $data['external_reference'] = $this->normalizer->normalize($object->getExternalReference(), 'json', $context); + } + if ($object->isInitialized('hours') && null !== $object->getHours()) { + $data['hours'] = $object->getHours(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntriesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('userId') && null !== $object->getUserId()) { - $data['user_id'] = $object->getUserId(); - } - $data['project_id'] = $object->getProjectId(); - $data['task_id'] = $object->getTaskId(); - $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); - if ($object->isInitialized('startedTime') && null !== $object->getStartedTime()) { - $data['started_time'] = $object->getStartedTime(); - } - if ($object->isInitialized('endedTime') && null !== $object->getEndedTime()) { - $data['ended_time'] = $object->getEndedTime(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('externalReference') && null !== $object->getExternalReference()) { - $data['external_reference'] = $this->normalizer->normalize($object->getExternalReference(), 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' === $type; } - if ($object->isInitialized('hours') && null !== $object->getHours()) { - $data['hours'] = $object->getHours(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntriesPostBody(); + if (\array_key_exists('hours', $data) && \is_int($data['hours'])) { + $data['hours'] = (float) $data['hours']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { + $object->setUserId($data['user_id']); + unset($data['user_id']); + } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { + $object->setUserId(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { + $object->setTaskId($data['task_id']); + unset($data['task_id']); + } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { + $object->setTaskId(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('started_time', $data) && null !== $data['started_time']) { + $object->setStartedTime($data['started_time']); + unset($data['started_time']); + } elseif (\array_key_exists('started_time', $data) && null === $data['started_time']) { + $object->setStartedTime(null); } + if (\array_key_exists('ended_time', $data) && null !== $data['ended_time']) { + $object->setEndedTime($data['ended_time']); + unset($data['ended_time']); + } elseif (\array_key_exists('ended_time', $data) && null === $data['ended_time']) { + $object->setEndedTime(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('external_reference', $data) && null !== $data['external_reference']) { + $object->setExternalReference($this->denormalizer->denormalize($data['external_reference'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBodyExternalReference', 'json', $context)); + unset($data['external_reference']); + } elseif (\array_key_exists('external_reference', $data) && null === $data['external_reference']) { + $object->setExternalReference(null); + } + if (\array_key_exists('hours', $data) && null !== $data['hours']) { + $object->setHours($data['hours']); + unset($data['hours']); + } elseif (\array_key_exists('hours', $data) && null === $data['hours']) { + $object->setHours(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('userId') && null !== $object->getUserId()) { + $data['user_id'] = $object->getUserId(); + } + $data['project_id'] = $object->getProjectId(); + $data['task_id'] = $object->getTaskId(); + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + if ($object->isInitialized('startedTime') && null !== $object->getStartedTime()) { + $data['started_time'] = $object->getStartedTime(); + } + if ($object->isInitialized('endedTime') && null !== $object->getEndedTime()) { + $data['ended_time'] = $object->getEndedTime(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('externalReference') && null !== $object->getExternalReference()) { + $data['external_reference'] = $this->normalizer->normalize($object->getExternalReference(), 'json', $context); + } + if ($object->isInitialized('hours') && null !== $object->getHours()) { + $data['hours'] = $object->getHours(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesPostBody' => false]; + } } } diff --git a/generated/Normalizer/TimeEntriesTimeEntryIdPatchBodyExternalReferenceNormalizer.php b/generated/Normalizer/TimeEntriesTimeEntryIdPatchBodyExternalReferenceNormalizer.php index d9a0497..44cda9f 100644 --- a/generated/Normalizer/TimeEntriesTimeEntryIdPatchBodyExternalReferenceNormalizer.php +++ b/generated/Normalizer/TimeEntriesTimeEntryIdPatchBodyExternalReferenceNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,107 +22,196 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntriesTimeEntryIdPatchBodyExternalReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntriesTimeEntryIdPatchBodyExternalReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntriesTimeEntryIdPatchBodyExternalReference(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntriesTimeEntryIdPatchBodyExternalReference(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('group_id', $data) && null !== $data['group_id']) { + $object->setGroupId($data['group_id']); + unset($data['group_id']); + } elseif (\array_key_exists('group_id', $data) && null === $data['group_id']) { + $object->setGroupId(null); + } + if (\array_key_exists('account_id', $data) && null !== $data['account_id']) { + $object->setAccountId($data['account_id']); + unset($data['account_id']); + } elseif (\array_key_exists('account_id', $data) && null === $data['account_id']) { + $object->setAccountId(null); + } + if (\array_key_exists('permalink', $data) && null !== $data['permalink']) { + $object->setPermalink($data['permalink']); + unset($data['permalink']); + } elseif (\array_key_exists('permalink', $data) && null === $data['permalink']) { + $object->setPermalink(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('group_id', $data) && null !== $data['group_id']) { - $object->setGroupId($data['group_id']); - unset($data['group_id']); - } elseif (\array_key_exists('group_id', $data) && null === $data['group_id']) { - $object->setGroupId(null); - } - if (\array_key_exists('account_id', $data) && null !== $data['account_id']) { - $object->setAccountId($data['account_id']); - unset($data['account_id']); - } elseif (\array_key_exists('account_id', $data) && null === $data['account_id']) { - $object->setAccountId(null); - } - if (\array_key_exists('permalink', $data) && null !== $data['permalink']) { - $object->setPermalink($data['permalink']); - unset($data['permalink']); - } elseif (\array_key_exists('permalink', $data) && null === $data['permalink']) { - $object->setPermalink(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('groupId') && null !== $object->getGroupId()) { + $data['group_id'] = $object->getGroupId(); + } + if ($object->isInitialized('accountId') && null !== $object->getAccountId()) { + $data['account_id'] = $object->getAccountId(); } + if ($object->isInitialized('permalink') && null !== $object->getPermalink()) { + $data['permalink'] = $object->getPermalink(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntriesTimeEntryIdPatchBodyExternalReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('groupId') && null !== $object->getGroupId()) { - $data['group_id'] = $object->getGroupId(); - } - if ($object->isInitialized('accountId') && null !== $object->getAccountId()) { - $data['account_id'] = $object->getAccountId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' === $type; } - if ($object->isInitialized('permalink') && null !== $object->getPermalink()) { - $data['permalink'] = $object->getPermalink(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntriesTimeEntryIdPatchBodyExternalReference(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('group_id', $data) && null !== $data['group_id']) { + $object->setGroupId($data['group_id']); + unset($data['group_id']); + } elseif (\array_key_exists('group_id', $data) && null === $data['group_id']) { + $object->setGroupId(null); + } + if (\array_key_exists('account_id', $data) && null !== $data['account_id']) { + $object->setAccountId($data['account_id']); + unset($data['account_id']); + } elseif (\array_key_exists('account_id', $data) && null === $data['account_id']) { + $object->setAccountId(null); + } + if (\array_key_exists('permalink', $data) && null !== $data['permalink']) { + $object->setPermalink($data['permalink']); + unset($data['permalink']); + } elseif (\array_key_exists('permalink', $data) && null === $data['permalink']) { + $object->setPermalink(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('groupId') && null !== $object->getGroupId()) { + $data['group_id'] = $object->getGroupId(); + } + if ($object->isInitialized('accountId') && null !== $object->getAccountId()) { + $data['account_id'] = $object->getAccountId(); + } + if ($object->isInitialized('permalink') && null !== $object->getPermalink()) { + $data['permalink'] = $object->getPermalink(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference' => false]; + } } } diff --git a/generated/Normalizer/TimeEntriesTimeEntryIdPatchBodyNormalizer.php b/generated/Normalizer/TimeEntriesTimeEntryIdPatchBodyNormalizer.php index 9c20eb7..00de8ba 100644 --- a/generated/Normalizer/TimeEntriesTimeEntryIdPatchBodyNormalizer.php +++ b/generated/Normalizer/TimeEntriesTimeEntryIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,146 +22,274 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntriesTimeEntryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntriesTimeEntryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' === $type; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntriesTimeEntryIdPatchBody(); - if (\array_key_exists('hours', $data) && \is_int($data['hours'])) { - $data['hours'] = (float) $data['hours']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntriesTimeEntryIdPatchBody(); + if (\array_key_exists('hours', $data) && \is_int($data['hours'])) { + $data['hours'] = (float) $data['hours']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { + $object->setTaskId($data['task_id']); + unset($data['task_id']); + } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { + $object->setTaskId(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('started_time', $data) && null !== $data['started_time']) { + $object->setStartedTime($data['started_time']); + unset($data['started_time']); + } elseif (\array_key_exists('started_time', $data) && null === $data['started_time']) { + $object->setStartedTime(null); + } + if (\array_key_exists('ended_time', $data) && null !== $data['ended_time']) { + $object->setEndedTime($data['ended_time']); + unset($data['ended_time']); + } elseif (\array_key_exists('ended_time', $data) && null === $data['ended_time']) { + $object->setEndedTime(null); + } + if (\array_key_exists('hours', $data) && null !== $data['hours']) { + $object->setHours($data['hours']); + unset($data['hours']); + } elseif (\array_key_exists('hours', $data) && null === $data['hours']) { + $object->setHours(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('external_reference', $data) && null !== $data['external_reference']) { + $object->setExternalReference($this->denormalizer->denormalize($data['external_reference'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference', 'json', $context)); + unset($data['external_reference']); + } elseif (\array_key_exists('external_reference', $data) && null === $data['external_reference']) { + $object->setExternalReference(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { - $object->setProjectId($data['project_id']); - unset($data['project_id']); - } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { - $object->setProjectId(null); - } - if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { - $object->setTaskId($data['task_id']); - unset($data['task_id']); - } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { - $object->setTaskId(null); - } - if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { - $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); - unset($data['spent_date']); - } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { - $object->setSpentDate(null); - } - if (\array_key_exists('started_time', $data) && null !== $data['started_time']) { - $object->setStartedTime($data['started_time']); - unset($data['started_time']); - } elseif (\array_key_exists('started_time', $data) && null === $data['started_time']) { - $object->setStartedTime(null); - } - if (\array_key_exists('ended_time', $data) && null !== $data['ended_time']) { - $object->setEndedTime($data['ended_time']); - unset($data['ended_time']); - } elseif (\array_key_exists('ended_time', $data) && null === $data['ended_time']) { - $object->setEndedTime(null); - } - if (\array_key_exists('hours', $data) && null !== $data['hours']) { - $object->setHours($data['hours']); - unset($data['hours']); - } elseif (\array_key_exists('hours', $data) && null === $data['hours']) { - $object->setHours(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('external_reference', $data) && null !== $data['external_reference']) { - $object->setExternalReference($this->denormalizer->denormalize($data['external_reference'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference', 'json', $context)); - unset($data['external_reference']); - } elseif (\array_key_exists('external_reference', $data) && null === $data['external_reference']) { - $object->setExternalReference(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('taskId') && null !== $object->getTaskId()) { + $data['task_id'] = $object->getTaskId(); + } + if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + } + if ($object->isInitialized('startedTime') && null !== $object->getStartedTime()) { + $data['started_time'] = $object->getStartedTime(); + } + if ($object->isInitialized('endedTime') && null !== $object->getEndedTime()) { + $data['ended_time'] = $object->getEndedTime(); + } + if ($object->isInitialized('hours') && null !== $object->getHours()) { + $data['hours'] = $object->getHours(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('externalReference') && null !== $object->getExternalReference()) { + $data['external_reference'] = $this->normalizer->normalize($object->getExternalReference(), 'json', $context); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntriesTimeEntryIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { - $data['project_id'] = $object->getProjectId(); - } - if ($object->isInitialized('taskId') && null !== $object->getTaskId()) { - $data['task_id'] = $object->getTaskId(); - } - if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { - $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); - } - if ($object->isInitialized('startedTime') && null !== $object->getStartedTime()) { - $data['started_time'] = $object->getStartedTime(); - } - if ($object->isInitialized('endedTime') && null !== $object->getEndedTime()) { - $data['ended_time'] = $object->getEndedTime(); - } - if ($object->isInitialized('hours') && null !== $object->getHours()) { - $data['hours'] = $object->getHours(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' === $type; } - if ($object->isInitialized('externalReference') && null !== $object->getExternalReference()) { - $data['external_reference'] = $this->normalizer->normalize($object->getExternalReference(), 'json', $context); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntriesTimeEntryIdPatchBody(); + if (\array_key_exists('hours', $data) && \is_int($data['hours'])) { + $data['hours'] = (float) $data['hours']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { + $object->setTaskId($data['task_id']); + unset($data['task_id']); + } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { + $object->setTaskId(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('started_time', $data) && null !== $data['started_time']) { + $object->setStartedTime($data['started_time']); + unset($data['started_time']); + } elseif (\array_key_exists('started_time', $data) && null === $data['started_time']) { + $object->setStartedTime(null); + } + if (\array_key_exists('ended_time', $data) && null !== $data['ended_time']) { + $object->setEndedTime($data['ended_time']); + unset($data['ended_time']); + } elseif (\array_key_exists('ended_time', $data) && null === $data['ended_time']) { + $object->setEndedTime(null); } + if (\array_key_exists('hours', $data) && null !== $data['hours']) { + $object->setHours($data['hours']); + unset($data['hours']); + } elseif (\array_key_exists('hours', $data) && null === $data['hours']) { + $object->setHours(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('external_reference', $data) && null !== $data['external_reference']) { + $object->setExternalReference($this->denormalizer->denormalize($data['external_reference'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBodyExternalReference', 'json', $context)); + unset($data['external_reference']); + } elseif (\array_key_exists('external_reference', $data) && null === $data['external_reference']) { + $object->setExternalReference(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('taskId') && null !== $object->getTaskId()) { + $data['task_id'] = $object->getTaskId(); + } + if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + } + if ($object->isInitialized('startedTime') && null !== $object->getStartedTime()) { + $data['started_time'] = $object->getStartedTime(); + } + if ($object->isInitialized('endedTime') && null !== $object->getEndedTime()) { + $data['ended_time'] = $object->getEndedTime(); + } + if ($object->isInitialized('hours') && null !== $object->getHours()) { + $data['hours'] = $object->getHours(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('externalReference') && null !== $object->getExternalReference()) { + $data['external_reference'] = $this->normalizer->normalize($object->getExternalReference(), 'json', $context); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntriesTimeEntryIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/TimeEntryClientNormalizer.php b/generated/Normalizer/TimeEntryClientNormalizer.php index 59bd820..ba55f55 100644 --- a/generated/Normalizer/TimeEntryClientNormalizer.php +++ b/generated/Normalizer/TimeEntryClientNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntryClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntryClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntryClient(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntryClientNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryClient(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryClient' => false]; + } } } diff --git a/generated/Normalizer/TimeEntryExternalReferenceNormalizer.php b/generated/Normalizer/TimeEntryExternalReferenceNormalizer.php index 5cb0e9c..0700d3a 100644 --- a/generated/Normalizer/TimeEntryExternalReferenceNormalizer.php +++ b/generated/Normalizer/TimeEntryExternalReferenceNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,125 +22,232 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntryExternalReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntryExternalReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntryExternalReference(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryExternalReference(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('group_id', $data) && null !== $data['group_id']) { + $object->setGroupId($data['group_id']); + unset($data['group_id']); + } elseif (\array_key_exists('group_id', $data) && null === $data['group_id']) { + $object->setGroupId(null); + } + if (\array_key_exists('account_id', $data) && null !== $data['account_id']) { + $object->setAccountId($data['account_id']); + unset($data['account_id']); + } elseif (\array_key_exists('account_id', $data) && null === $data['account_id']) { + $object->setAccountId(null); + } + if (\array_key_exists('permalink', $data) && null !== $data['permalink']) { + $object->setPermalink($data['permalink']); + unset($data['permalink']); + } elseif (\array_key_exists('permalink', $data) && null === $data['permalink']) { + $object->setPermalink(null); + } + if (\array_key_exists('service', $data) && null !== $data['service']) { + $object->setService($data['service']); + unset($data['service']); + } elseif (\array_key_exists('service', $data) && null === $data['service']) { + $object->setService(null); + } + if (\array_key_exists('service_icon_url', $data) && null !== $data['service_icon_url']) { + $object->setServiceIconUrl($data['service_icon_url']); + unset($data['service_icon_url']); + } elseif (\array_key_exists('service_icon_url', $data) && null === $data['service_icon_url']) { + $object->setServiceIconUrl(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('group_id', $data) && null !== $data['group_id']) { - $object->setGroupId($data['group_id']); - unset($data['group_id']); - } elseif (\array_key_exists('group_id', $data) && null === $data['group_id']) { - $object->setGroupId(null); - } - if (\array_key_exists('account_id', $data) && null !== $data['account_id']) { - $object->setAccountId($data['account_id']); - unset($data['account_id']); - } elseif (\array_key_exists('account_id', $data) && null === $data['account_id']) { - $object->setAccountId(null); - } - if (\array_key_exists('permalink', $data) && null !== $data['permalink']) { - $object->setPermalink($data['permalink']); - unset($data['permalink']); - } elseif (\array_key_exists('permalink', $data) && null === $data['permalink']) { - $object->setPermalink(null); - } - if (\array_key_exists('service', $data) && null !== $data['service']) { - $object->setService($data['service']); - unset($data['service']); - } elseif (\array_key_exists('service', $data) && null === $data['service']) { - $object->setService(null); - } - if (\array_key_exists('service_icon_url', $data) && null !== $data['service_icon_url']) { - $object->setServiceIconUrl($data['service_icon_url']); - unset($data['service_icon_url']); - } elseif (\array_key_exists('service_icon_url', $data) && null === $data['service_icon_url']) { - $object->setServiceIconUrl(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('groupId') && null !== $object->getGroupId()) { + $data['group_id'] = $object->getGroupId(); + } + if ($object->isInitialized('accountId') && null !== $object->getAccountId()) { + $data['account_id'] = $object->getAccountId(); + } + if ($object->isInitialized('permalink') && null !== $object->getPermalink()) { + $data['permalink'] = $object->getPermalink(); } + if ($object->isInitialized('service') && null !== $object->getService()) { + $data['service'] = $object->getService(); + } + if ($object->isInitialized('serviceIconUrl') && null !== $object->getServiceIconUrl()) { + $data['service_icon_url'] = $object->getServiceIconUrl(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntryExternalReferenceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('groupId') && null !== $object->getGroupId()) { - $data['group_id'] = $object->getGroupId(); - } - if ($object->isInitialized('accountId') && null !== $object->getAccountId()) { - $data['account_id'] = $object->getAccountId(); - } - if ($object->isInitialized('permalink') && null !== $object->getPermalink()) { - $data['permalink'] = $object->getPermalink(); - } - if ($object->isInitialized('service') && null !== $object->getService()) { - $data['service'] = $object->getService(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' === $type; } - if ($object->isInitialized('serviceIconUrl') && null !== $object->getServiceIconUrl()) { - $data['service_icon_url'] = $object->getServiceIconUrl(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryExternalReference(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('group_id', $data) && null !== $data['group_id']) { + $object->setGroupId($data['group_id']); + unset($data['group_id']); + } elseif (\array_key_exists('group_id', $data) && null === $data['group_id']) { + $object->setGroupId(null); + } + if (\array_key_exists('account_id', $data) && null !== $data['account_id']) { + $object->setAccountId($data['account_id']); + unset($data['account_id']); + } elseif (\array_key_exists('account_id', $data) && null === $data['account_id']) { + $object->setAccountId(null); + } + if (\array_key_exists('permalink', $data) && null !== $data['permalink']) { + $object->setPermalink($data['permalink']); + unset($data['permalink']); + } elseif (\array_key_exists('permalink', $data) && null === $data['permalink']) { + $object->setPermalink(null); + } + if (\array_key_exists('service', $data) && null !== $data['service']) { + $object->setService($data['service']); + unset($data['service']); + } elseif (\array_key_exists('service', $data) && null === $data['service']) { + $object->setService(null); } + if (\array_key_exists('service_icon_url', $data) && null !== $data['service_icon_url']) { + $object->setServiceIconUrl($data['service_icon_url']); + unset($data['service_icon_url']); + } elseif (\array_key_exists('service_icon_url', $data) && null === $data['service_icon_url']) { + $object->setServiceIconUrl(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('groupId') && null !== $object->getGroupId()) { + $data['group_id'] = $object->getGroupId(); + } + if ($object->isInitialized('accountId') && null !== $object->getAccountId()) { + $data['account_id'] = $object->getAccountId(); + } + if ($object->isInitialized('permalink') && null !== $object->getPermalink()) { + $data['permalink'] = $object->getPermalink(); + } + if ($object->isInitialized('service') && null !== $object->getService()) { + $data['service'] = $object->getService(); + } + if ($object->isInitialized('serviceIconUrl') && null !== $object->getServiceIconUrl()) { + $data['service_icon_url'] = $object->getServiceIconUrl(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference' => false]; + } } } diff --git a/generated/Normalizer/TimeEntryInvoiceNormalizer.php b/generated/Normalizer/TimeEntryInvoiceNormalizer.php index cde1cb4..4637a92 100644 --- a/generated/Normalizer/TimeEntryInvoiceNormalizer.php +++ b/generated/Normalizer/TimeEntryInvoiceNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntryInvoiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntryInvoiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntryInvoice(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryInvoice(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('number', $data) && null !== $data['number']) { - $object->setNumber($data['number']); - unset($data['number']); - } elseif (\array_key_exists('number', $data) && null === $data['number']) { - $object->setNumber(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntryInvoiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' === $type; } - if ($object->isInitialized('number') && null !== $object->getNumber()) { - $data['number'] = $object->getNumber(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryInvoice(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('number', $data) && null !== $data['number']) { + $object->setNumber($data['number']); + unset($data['number']); + } elseif (\array_key_exists('number', $data) && null === $data['number']) { + $object->setNumber(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('number') && null !== $object->getNumber()) { + $data['number'] = $object->getNumber(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice' => false]; + } } } diff --git a/generated/Normalizer/TimeEntryNormalizer.php b/generated/Normalizer/TimeEntryNormalizer.php index b07bc00..365a270 100644 --- a/generated/Normalizer/TimeEntryNormalizer.php +++ b/generated/Normalizer/TimeEntryNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,334 +22,650 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' === $type; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntry(); - if (\array_key_exists('hours', $data) && \is_int($data['hours'])) { - $data['hours'] = (float) $data['hours']; - } - if (\array_key_exists('hours_without_timer', $data) && \is_int($data['hours_without_timer'])) { - $data['hours_without_timer'] = (float) $data['hours_without_timer']; - } - if (\array_key_exists('rounded_hours', $data) && \is_int($data['rounded_hours'])) { - $data['rounded_hours'] = (float) $data['rounded_hours']; - } - if (\array_key_exists('billable_rate', $data) && \is_int($data['billable_rate'])) { - $data['billable_rate'] = (float) $data['billable_rate']; - } - if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { - $data['cost_rate'] = (float) $data['cost_rate']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntry(); + if (\array_key_exists('hours', $data) && \is_int($data['hours'])) { + $data['hours'] = (float) $data['hours']; + } + if (\array_key_exists('hours_without_timer', $data) && \is_int($data['hours_without_timer'])) { + $data['hours_without_timer'] = (float) $data['hours_without_timer']; + } + if (\array_key_exists('rounded_hours', $data) && \is_int($data['rounded_hours'])) { + $data['rounded_hours'] = (float) $data['rounded_hours']; + } + if (\array_key_exists('billable_rate', $data) && \is_int($data['billable_rate'])) { + $data['billable_rate'] = (float) $data['billable_rate']; + } + if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { + $data['cost_rate'] = (float) $data['cost_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('user', $data) && null !== $data['user']) { + $object->setUser($this->denormalizer->denormalize($data['user'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser', 'json', $context)); + unset($data['user']); + } elseif (\array_key_exists('user', $data) && null === $data['user']) { + $object->setUser(null); + } + if (\array_key_exists('user_assignment', $data)) { + $object->setUserAssignment($this->denormalizer->denormalize($data['user_assignment'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignment', 'json', $context)); + unset($data['user_assignment']); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('task', $data) && null !== $data['task']) { + $object->setTask($this->denormalizer->denormalize($data['task'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask', 'json', $context)); + unset($data['task']); + } elseif (\array_key_exists('task', $data) && null === $data['task']) { + $object->setTask(null); + } + if (\array_key_exists('task_assignment', $data)) { + $object->setTaskAssignment($this->denormalizer->denormalize($data['task_assignment'], 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment', 'json', $context)); + unset($data['task_assignment']); + } + if (\array_key_exists('external_reference', $data) && null !== $data['external_reference']) { + $object->setExternalReference($this->denormalizer->denormalize($data['external_reference'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference', 'json', $context)); + unset($data['external_reference']); + } elseif (\array_key_exists('external_reference', $data) && null === $data['external_reference']) { + $object->setExternalReference(null); + } + if (\array_key_exists('invoice', $data) && null !== $data['invoice']) { + $object->setInvoice($this->denormalizer->denormalize($data['invoice'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice', 'json', $context)); + unset($data['invoice']); + } elseif (\array_key_exists('invoice', $data) && null === $data['invoice']) { + $object->setInvoice(null); + } + if (\array_key_exists('hours', $data) && null !== $data['hours']) { + $object->setHours($data['hours']); + unset($data['hours']); + } elseif (\array_key_exists('hours', $data) && null === $data['hours']) { + $object->setHours(null); + } + if (\array_key_exists('hours_without_timer', $data) && null !== $data['hours_without_timer']) { + $object->setHoursWithoutTimer($data['hours_without_timer']); + unset($data['hours_without_timer']); + } elseif (\array_key_exists('hours_without_timer', $data) && null === $data['hours_without_timer']) { + $object->setHoursWithoutTimer(null); + } + if (\array_key_exists('rounded_hours', $data) && null !== $data['rounded_hours']) { + $object->setRoundedHours($data['rounded_hours']); + unset($data['rounded_hours']); + } elseif (\array_key_exists('rounded_hours', $data) && null === $data['rounded_hours']) { + $object->setRoundedHours(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('is_locked', $data) && null !== $data['is_locked']) { + $object->setIsLocked($data['is_locked']); + unset($data['is_locked']); + } elseif (\array_key_exists('is_locked', $data) && null === $data['is_locked']) { + $object->setIsLocked(null); + } + if (\array_key_exists('locked_reason', $data) && null !== $data['locked_reason']) { + $object->setLockedReason($data['locked_reason']); + unset($data['locked_reason']); + } elseif (\array_key_exists('locked_reason', $data) && null === $data['locked_reason']) { + $object->setLockedReason(null); + } + if (\array_key_exists('is_closed', $data) && null !== $data['is_closed']) { + $object->setIsClosed($data['is_closed']); + unset($data['is_closed']); + } elseif (\array_key_exists('is_closed', $data) && null === $data['is_closed']) { + $object->setIsClosed(null); + } + if (\array_key_exists('is_billed', $data) && null !== $data['is_billed']) { + $object->setIsBilled($data['is_billed']); + unset($data['is_billed']); + } elseif (\array_key_exists('is_billed', $data) && null === $data['is_billed']) { + $object->setIsBilled(null); + } + if (\array_key_exists('timer_started_at', $data) && null !== $data['timer_started_at']) { + $object->setTimerStartedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['timer_started_at'])); + unset($data['timer_started_at']); + } elseif (\array_key_exists('timer_started_at', $data) && null === $data['timer_started_at']) { + $object->setTimerStartedAt(null); + } + if (\array_key_exists('started_time', $data) && null !== $data['started_time']) { + $object->setStartedTime($data['started_time']); + unset($data['started_time']); + } elseif (\array_key_exists('started_time', $data) && null === $data['started_time']) { + $object->setStartedTime(null); + } + if (\array_key_exists('ended_time', $data) && null !== $data['ended_time']) { + $object->setEndedTime($data['ended_time']); + unset($data['ended_time']); + } elseif (\array_key_exists('ended_time', $data) && null === $data['ended_time']) { + $object->setEndedTime(null); + } + if (\array_key_exists('is_running', $data) && null !== $data['is_running']) { + $object->setIsRunning($data['is_running']); + unset($data['is_running']); + } elseif (\array_key_exists('is_running', $data) && null === $data['is_running']) { + $object->setIsRunning(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('budgeted', $data) && null !== $data['budgeted']) { + $object->setBudgeted($data['budgeted']); + unset($data['budgeted']); + } elseif (\array_key_exists('budgeted', $data) && null === $data['budgeted']) { + $object->setBudgeted(null); + } + if (\array_key_exists('billable_rate', $data) && null !== $data['billable_rate']) { + $object->setBillableRate($data['billable_rate']); + unset($data['billable_rate']); + } elseif (\array_key_exists('billable_rate', $data) && null === $data['billable_rate']) { + $object->setBillableRate(null); + } + if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { + $object->setCostRate($data['cost_rate']); + unset($data['cost_rate']); + } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { + $object->setCostRate(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { - $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); - unset($data['spent_date']); - } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { - $object->setSpentDate(null); - } - if (\array_key_exists('user', $data) && null !== $data['user']) { - $object->setUser($this->denormalizer->denormalize($data['user'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser', 'json', $context)); - unset($data['user']); - } elseif (\array_key_exists('user', $data) && null === $data['user']) { - $object->setUser(null); - } - if (\array_key_exists('user_assignment', $data)) { - $object->setUserAssignment($this->denormalizer->denormalize($data['user_assignment'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignment', 'json', $context)); - unset($data['user_assignment']); - } - if (\array_key_exists('client', $data) && null !== $data['client']) { - $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient', 'json', $context)); - unset($data['client']); - } elseif (\array_key_exists('client', $data) && null === $data['client']) { - $object->setClient(null); - } - if (\array_key_exists('project', $data) && null !== $data['project']) { - $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject', 'json', $context)); - unset($data['project']); - } elseif (\array_key_exists('project', $data) && null === $data['project']) { - $object->setProject(null); - } - if (\array_key_exists('task', $data) && null !== $data['task']) { - $object->setTask($this->denormalizer->denormalize($data['task'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask', 'json', $context)); - unset($data['task']); - } elseif (\array_key_exists('task', $data) && null === $data['task']) { - $object->setTask(null); - } - if (\array_key_exists('task_assignment', $data)) { - $object->setTaskAssignment($this->denormalizer->denormalize($data['task_assignment'], 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment', 'json', $context)); - unset($data['task_assignment']); - } - if (\array_key_exists('external_reference', $data) && null !== $data['external_reference']) { - $object->setExternalReference($this->denormalizer->denormalize($data['external_reference'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference', 'json', $context)); - unset($data['external_reference']); - } elseif (\array_key_exists('external_reference', $data) && null === $data['external_reference']) { - $object->setExternalReference(null); - } - if (\array_key_exists('invoice', $data) && null !== $data['invoice']) { - $object->setInvoice($this->denormalizer->denormalize($data['invoice'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice', 'json', $context)); - unset($data['invoice']); - } elseif (\array_key_exists('invoice', $data) && null === $data['invoice']) { - $object->setInvoice(null); - } - if (\array_key_exists('hours', $data) && null !== $data['hours']) { - $object->setHours($data['hours']); - unset($data['hours']); - } elseif (\array_key_exists('hours', $data) && null === $data['hours']) { - $object->setHours(null); - } - if (\array_key_exists('hours_without_timer', $data) && null !== $data['hours_without_timer']) { - $object->setHoursWithoutTimer($data['hours_without_timer']); - unset($data['hours_without_timer']); - } elseif (\array_key_exists('hours_without_timer', $data) && null === $data['hours_without_timer']) { - $object->setHoursWithoutTimer(null); - } - if (\array_key_exists('rounded_hours', $data) && null !== $data['rounded_hours']) { - $object->setRoundedHours($data['rounded_hours']); - unset($data['rounded_hours']); - } elseif (\array_key_exists('rounded_hours', $data) && null === $data['rounded_hours']) { - $object->setRoundedHours(null); - } - if (\array_key_exists('notes', $data) && null !== $data['notes']) { - $object->setNotes($data['notes']); - unset($data['notes']); - } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { - $object->setNotes(null); - } - if (\array_key_exists('is_locked', $data) && null !== $data['is_locked']) { - $object->setIsLocked($data['is_locked']); - unset($data['is_locked']); - } elseif (\array_key_exists('is_locked', $data) && null === $data['is_locked']) { - $object->setIsLocked(null); - } - if (\array_key_exists('locked_reason', $data) && null !== $data['locked_reason']) { - $object->setLockedReason($data['locked_reason']); - unset($data['locked_reason']); - } elseif (\array_key_exists('locked_reason', $data) && null === $data['locked_reason']) { - $object->setLockedReason(null); - } - if (\array_key_exists('is_closed', $data) && null !== $data['is_closed']) { - $object->setIsClosed($data['is_closed']); - unset($data['is_closed']); - } elseif (\array_key_exists('is_closed', $data) && null === $data['is_closed']) { - $object->setIsClosed(null); - } - if (\array_key_exists('is_billed', $data) && null !== $data['is_billed']) { - $object->setIsBilled($data['is_billed']); - unset($data['is_billed']); - } elseif (\array_key_exists('is_billed', $data) && null === $data['is_billed']) { - $object->setIsBilled(null); - } - if (\array_key_exists('timer_started_at', $data) && null !== $data['timer_started_at']) { - $object->setTimerStartedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['timer_started_at'])); - unset($data['timer_started_at']); - } elseif (\array_key_exists('timer_started_at', $data) && null === $data['timer_started_at']) { - $object->setTimerStartedAt(null); - } - if (\array_key_exists('started_time', $data) && null !== $data['started_time']) { - $object->setStartedTime($data['started_time']); - unset($data['started_time']); - } elseif (\array_key_exists('started_time', $data) && null === $data['started_time']) { - $object->setStartedTime(null); - } - if (\array_key_exists('ended_time', $data) && null !== $data['ended_time']) { - $object->setEndedTime($data['ended_time']); - unset($data['ended_time']); - } elseif (\array_key_exists('ended_time', $data) && null === $data['ended_time']) { - $object->setEndedTime(null); - } - if (\array_key_exists('is_running', $data) && null !== $data['is_running']) { - $object->setIsRunning($data['is_running']); - unset($data['is_running']); - } elseif (\array_key_exists('is_running', $data) && null === $data['is_running']) { - $object->setIsRunning(null); - } - if (\array_key_exists('billable', $data) && null !== $data['billable']) { - $object->setBillable($data['billable']); - unset($data['billable']); - } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { - $object->setBillable(null); - } - if (\array_key_exists('budgeted', $data) && null !== $data['budgeted']) { - $object->setBudgeted($data['budgeted']); - unset($data['budgeted']); - } elseif (\array_key_exists('budgeted', $data) && null === $data['budgeted']) { - $object->setBudgeted(null); - } - if (\array_key_exists('billable_rate', $data) && null !== $data['billable_rate']) { - $object->setBillableRate($data['billable_rate']); - unset($data['billable_rate']); - } elseif (\array_key_exists('billable_rate', $data) && null === $data['billable_rate']) { - $object->setBillableRate(null); - } - if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { - $object->setCostRate($data['cost_rate']); - unset($data['cost_rate']); - } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { - $object->setCostRate(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + } + if ($object->isInitialized('user') && null !== $object->getUser()) { + $data['user'] = $this->normalizer->normalize($object->getUser(), 'json', $context); + } + if ($object->isInitialized('userAssignment') && null !== $object->getUserAssignment()) { + $data['user_assignment'] = $this->normalizer->normalize($object->getUserAssignment(), 'json', $context); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('task') && null !== $object->getTask()) { + $data['task'] = $this->normalizer->normalize($object->getTask(), 'json', $context); + } + if ($object->isInitialized('taskAssignment') && null !== $object->getTaskAssignment()) { + $data['task_assignment'] = $this->normalizer->normalize($object->getTaskAssignment(), 'json', $context); + } + if ($object->isInitialized('externalReference') && null !== $object->getExternalReference()) { + $data['external_reference'] = $this->normalizer->normalize($object->getExternalReference(), 'json', $context); + } + if ($object->isInitialized('invoice') && null !== $object->getInvoice()) { + $data['invoice'] = $this->normalizer->normalize($object->getInvoice(), 'json', $context); + } + if ($object->isInitialized('hours') && null !== $object->getHours()) { + $data['hours'] = $object->getHours(); + } + if ($object->isInitialized('hoursWithoutTimer') && null !== $object->getHoursWithoutTimer()) { + $data['hours_without_timer'] = $object->getHoursWithoutTimer(); + } + if ($object->isInitialized('roundedHours') && null !== $object->getRoundedHours()) { + $data['rounded_hours'] = $object->getRoundedHours(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('isLocked') && null !== $object->getIsLocked()) { + $data['is_locked'] = $object->getIsLocked(); + } + if ($object->isInitialized('lockedReason') && null !== $object->getLockedReason()) { + $data['locked_reason'] = $object->getLockedReason(); + } + if ($object->isInitialized('isClosed') && null !== $object->getIsClosed()) { + $data['is_closed'] = $object->getIsClosed(); + } + if ($object->isInitialized('isBilled') && null !== $object->getIsBilled()) { + $data['is_billed'] = $object->getIsBilled(); + } + if ($object->isInitialized('timerStartedAt') && null !== $object->getTimerStartedAt()) { + $data['timer_started_at'] = $object->getTimerStartedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('startedTime') && null !== $object->getStartedTime()) { + $data['started_time'] = $object->getStartedTime(); + } + if ($object->isInitialized('endedTime') && null !== $object->getEndedTime()) { + $data['ended_time'] = $object->getEndedTime(); + } + if ($object->isInitialized('isRunning') && null !== $object->getIsRunning()) { + $data['is_running'] = $object->getIsRunning(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('budgeted') && null !== $object->getBudgeted()) { + $data['budgeted'] = $object->getBudgeted(); + } + if ($object->isInitialized('billableRate') && null !== $object->getBillableRate()) { + $data['billable_rate'] = $object->getBillableRate(); + } + if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { + $data['cost_rate'] = $object->getCostRate(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntry' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntryNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { - $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); - } - if ($object->isInitialized('user') && null !== $object->getUser()) { - $data['user'] = $this->normalizer->normalize($object->getUser(), 'json', $context); - } - if ($object->isInitialized('userAssignment') && null !== $object->getUserAssignment()) { - $data['user_assignment'] = $this->normalizer->normalize($object->getUserAssignment(), 'json', $context); - } - if ($object->isInitialized('client') && null !== $object->getClient()) { - $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); - } - if ($object->isInitialized('project') && null !== $object->getProject()) { - $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); - } - if ($object->isInitialized('task') && null !== $object->getTask()) { - $data['task'] = $this->normalizer->normalize($object->getTask(), 'json', $context); - } - if ($object->isInitialized('taskAssignment') && null !== $object->getTaskAssignment()) { - $data['task_assignment'] = $this->normalizer->normalize($object->getTaskAssignment(), 'json', $context); - } - if ($object->isInitialized('externalReference') && null !== $object->getExternalReference()) { - $data['external_reference'] = $this->normalizer->normalize($object->getExternalReference(), 'json', $context); - } - if ($object->isInitialized('invoice') && null !== $object->getInvoice()) { - $data['invoice'] = $this->normalizer->normalize($object->getInvoice(), 'json', $context); - } - if ($object->isInitialized('hours') && null !== $object->getHours()) { - $data['hours'] = $object->getHours(); - } - if ($object->isInitialized('hoursWithoutTimer') && null !== $object->getHoursWithoutTimer()) { - $data['hours_without_timer'] = $object->getHoursWithoutTimer(); - } - if ($object->isInitialized('roundedHours') && null !== $object->getRoundedHours()) { - $data['rounded_hours'] = $object->getRoundedHours(); - } - if ($object->isInitialized('notes') && null !== $object->getNotes()) { - $data['notes'] = $object->getNotes(); - } - if ($object->isInitialized('isLocked') && null !== $object->getIsLocked()) { - $data['is_locked'] = $object->getIsLocked(); - } - if ($object->isInitialized('lockedReason') && null !== $object->getLockedReason()) { - $data['locked_reason'] = $object->getLockedReason(); - } - if ($object->isInitialized('isClosed') && null !== $object->getIsClosed()) { - $data['is_closed'] = $object->getIsClosed(); - } - if ($object->isInitialized('isBilled') && null !== $object->getIsBilled()) { - $data['is_billed'] = $object->getIsBilled(); - } - if ($object->isInitialized('timerStartedAt') && null !== $object->getTimerStartedAt()) { - $data['timer_started_at'] = $object->getTimerStartedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('startedTime') && null !== $object->getStartedTime()) { - $data['started_time'] = $object->getStartedTime(); - } - if ($object->isInitialized('endedTime') && null !== $object->getEndedTime()) { - $data['ended_time'] = $object->getEndedTime(); - } - if ($object->isInitialized('isRunning') && null !== $object->getIsRunning()) { - $data['is_running'] = $object->getIsRunning(); - } - if ($object->isInitialized('billable') && null !== $object->getBillable()) { - $data['billable'] = $object->getBillable(); - } - if ($object->isInitialized('budgeted') && null !== $object->getBudgeted()) { - $data['budgeted'] = $object->getBudgeted(); - } - if ($object->isInitialized('billableRate') && null !== $object->getBillableRate()) { - $data['billable_rate'] = $object->getBillableRate(); - } - if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { - $data['cost_rate'] = $object->getCostRate(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntry' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntry(); + if (\array_key_exists('hours', $data) && \is_int($data['hours'])) { + $data['hours'] = (float) $data['hours']; + } + if (\array_key_exists('hours_without_timer', $data) && \is_int($data['hours_without_timer'])) { + $data['hours_without_timer'] = (float) $data['hours_without_timer']; + } + if (\array_key_exists('rounded_hours', $data) && \is_int($data['rounded_hours'])) { + $data['rounded_hours'] = (float) $data['rounded_hours']; + } + if (\array_key_exists('billable_rate', $data) && \is_int($data['billable_rate'])) { + $data['billable_rate'] = (float) $data['billable_rate']; + } + if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { + $data['cost_rate'] = (float) $data['cost_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('spent_date', $data) && null !== $data['spent_date']) { + $object->setSpentDate(\DateTime::createFromFormat('Y-m-d', $data['spent_date'])->setTime(0, 0, 0)); + unset($data['spent_date']); + } elseif (\array_key_exists('spent_date', $data) && null === $data['spent_date']) { + $object->setSpentDate(null); + } + if (\array_key_exists('user', $data) && null !== $data['user']) { + $object->setUser($this->denormalizer->denormalize($data['user'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser', 'json', $context)); + unset($data['user']); + } elseif (\array_key_exists('user', $data) && null === $data['user']) { + $object->setUser(null); + } + if (\array_key_exists('user_assignment', $data)) { + $object->setUserAssignment($this->denormalizer->denormalize($data['user_assignment'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignment', 'json', $context)); + unset($data['user_assignment']); + } + if (\array_key_exists('client', $data) && null !== $data['client']) { + $object->setClient($this->denormalizer->denormalize($data['client'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryClient', 'json', $context)); + unset($data['client']); + } elseif (\array_key_exists('client', $data) && null === $data['client']) { + $object->setClient(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('task', $data) && null !== $data['task']) { + $object->setTask($this->denormalizer->denormalize($data['task'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask', 'json', $context)); + unset($data['task']); + } elseif (\array_key_exists('task', $data) && null === $data['task']) { + $object->setTask(null); + } + if (\array_key_exists('task_assignment', $data)) { + $object->setTaskAssignment($this->denormalizer->denormalize($data['task_assignment'], 'JoliCode\\Harvest\\Api\\Model\\TaskAssignment', 'json', $context)); + unset($data['task_assignment']); + } + if (\array_key_exists('external_reference', $data) && null !== $data['external_reference']) { + $object->setExternalReference($this->denormalizer->denormalize($data['external_reference'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryExternalReference', 'json', $context)); + unset($data['external_reference']); + } elseif (\array_key_exists('external_reference', $data) && null === $data['external_reference']) { + $object->setExternalReference(null); + } + if (\array_key_exists('invoice', $data) && null !== $data['invoice']) { + $object->setInvoice($this->denormalizer->denormalize($data['invoice'], 'JoliCode\\Harvest\\Api\\Model\\TimeEntryInvoice', 'json', $context)); + unset($data['invoice']); + } elseif (\array_key_exists('invoice', $data) && null === $data['invoice']) { + $object->setInvoice(null); + } + if (\array_key_exists('hours', $data) && null !== $data['hours']) { + $object->setHours($data['hours']); + unset($data['hours']); + } elseif (\array_key_exists('hours', $data) && null === $data['hours']) { + $object->setHours(null); + } + if (\array_key_exists('hours_without_timer', $data) && null !== $data['hours_without_timer']) { + $object->setHoursWithoutTimer($data['hours_without_timer']); + unset($data['hours_without_timer']); + } elseif (\array_key_exists('hours_without_timer', $data) && null === $data['hours_without_timer']) { + $object->setHoursWithoutTimer(null); } + if (\array_key_exists('rounded_hours', $data) && null !== $data['rounded_hours']) { + $object->setRoundedHours($data['rounded_hours']); + unset($data['rounded_hours']); + } elseif (\array_key_exists('rounded_hours', $data) && null === $data['rounded_hours']) { + $object->setRoundedHours(null); + } + if (\array_key_exists('notes', $data) && null !== $data['notes']) { + $object->setNotes($data['notes']); + unset($data['notes']); + } elseif (\array_key_exists('notes', $data) && null === $data['notes']) { + $object->setNotes(null); + } + if (\array_key_exists('is_locked', $data) && null !== $data['is_locked']) { + $object->setIsLocked($data['is_locked']); + unset($data['is_locked']); + } elseif (\array_key_exists('is_locked', $data) && null === $data['is_locked']) { + $object->setIsLocked(null); + } + if (\array_key_exists('locked_reason', $data) && null !== $data['locked_reason']) { + $object->setLockedReason($data['locked_reason']); + unset($data['locked_reason']); + } elseif (\array_key_exists('locked_reason', $data) && null === $data['locked_reason']) { + $object->setLockedReason(null); + } + if (\array_key_exists('is_closed', $data) && null !== $data['is_closed']) { + $object->setIsClosed($data['is_closed']); + unset($data['is_closed']); + } elseif (\array_key_exists('is_closed', $data) && null === $data['is_closed']) { + $object->setIsClosed(null); + } + if (\array_key_exists('is_billed', $data) && null !== $data['is_billed']) { + $object->setIsBilled($data['is_billed']); + unset($data['is_billed']); + } elseif (\array_key_exists('is_billed', $data) && null === $data['is_billed']) { + $object->setIsBilled(null); + } + if (\array_key_exists('timer_started_at', $data) && null !== $data['timer_started_at']) { + $object->setTimerStartedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['timer_started_at'])); + unset($data['timer_started_at']); + } elseif (\array_key_exists('timer_started_at', $data) && null === $data['timer_started_at']) { + $object->setTimerStartedAt(null); + } + if (\array_key_exists('started_time', $data) && null !== $data['started_time']) { + $object->setStartedTime($data['started_time']); + unset($data['started_time']); + } elseif (\array_key_exists('started_time', $data) && null === $data['started_time']) { + $object->setStartedTime(null); + } + if (\array_key_exists('ended_time', $data) && null !== $data['ended_time']) { + $object->setEndedTime($data['ended_time']); + unset($data['ended_time']); + } elseif (\array_key_exists('ended_time', $data) && null === $data['ended_time']) { + $object->setEndedTime(null); + } + if (\array_key_exists('is_running', $data) && null !== $data['is_running']) { + $object->setIsRunning($data['is_running']); + unset($data['is_running']); + } elseif (\array_key_exists('is_running', $data) && null === $data['is_running']) { + $object->setIsRunning(null); + } + if (\array_key_exists('billable', $data) && null !== $data['billable']) { + $object->setBillable($data['billable']); + unset($data['billable']); + } elseif (\array_key_exists('billable', $data) && null === $data['billable']) { + $object->setBillable(null); + } + if (\array_key_exists('budgeted', $data) && null !== $data['budgeted']) { + $object->setBudgeted($data['budgeted']); + unset($data['budgeted']); + } elseif (\array_key_exists('budgeted', $data) && null === $data['budgeted']) { + $object->setBudgeted(null); + } + if (\array_key_exists('billable_rate', $data) && null !== $data['billable_rate']) { + $object->setBillableRate($data['billable_rate']); + unset($data['billable_rate']); + } elseif (\array_key_exists('billable_rate', $data) && null === $data['billable_rate']) { + $object->setBillableRate(null); + } + if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { + $object->setCostRate($data['cost_rate']); + unset($data['cost_rate']); + } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { + $object->setCostRate(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('spentDate') && null !== $object->getSpentDate()) { + $data['spent_date'] = $object->getSpentDate()->format('Y-m-d'); + } + if ($object->isInitialized('user') && null !== $object->getUser()) { + $data['user'] = $this->normalizer->normalize($object->getUser(), 'json', $context); + } + if ($object->isInitialized('userAssignment') && null !== $object->getUserAssignment()) { + $data['user_assignment'] = $this->normalizer->normalize($object->getUserAssignment(), 'json', $context); + } + if ($object->isInitialized('client') && null !== $object->getClient()) { + $data['client'] = $this->normalizer->normalize($object->getClient(), 'json', $context); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('task') && null !== $object->getTask()) { + $data['task'] = $this->normalizer->normalize($object->getTask(), 'json', $context); + } + if ($object->isInitialized('taskAssignment') && null !== $object->getTaskAssignment()) { + $data['task_assignment'] = $this->normalizer->normalize($object->getTaskAssignment(), 'json', $context); + } + if ($object->isInitialized('externalReference') && null !== $object->getExternalReference()) { + $data['external_reference'] = $this->normalizer->normalize($object->getExternalReference(), 'json', $context); + } + if ($object->isInitialized('invoice') && null !== $object->getInvoice()) { + $data['invoice'] = $this->normalizer->normalize($object->getInvoice(), 'json', $context); + } + if ($object->isInitialized('hours') && null !== $object->getHours()) { + $data['hours'] = $object->getHours(); + } + if ($object->isInitialized('hoursWithoutTimer') && null !== $object->getHoursWithoutTimer()) { + $data['hours_without_timer'] = $object->getHoursWithoutTimer(); + } + if ($object->isInitialized('roundedHours') && null !== $object->getRoundedHours()) { + $data['rounded_hours'] = $object->getRoundedHours(); + } + if ($object->isInitialized('notes') && null !== $object->getNotes()) { + $data['notes'] = $object->getNotes(); + } + if ($object->isInitialized('isLocked') && null !== $object->getIsLocked()) { + $data['is_locked'] = $object->getIsLocked(); + } + if ($object->isInitialized('lockedReason') && null !== $object->getLockedReason()) { + $data['locked_reason'] = $object->getLockedReason(); + } + if ($object->isInitialized('isClosed') && null !== $object->getIsClosed()) { + $data['is_closed'] = $object->getIsClosed(); + } + if ($object->isInitialized('isBilled') && null !== $object->getIsBilled()) { + $data['is_billed'] = $object->getIsBilled(); + } + if ($object->isInitialized('timerStartedAt') && null !== $object->getTimerStartedAt()) { + $data['timer_started_at'] = $object->getTimerStartedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('startedTime') && null !== $object->getStartedTime()) { + $data['started_time'] = $object->getStartedTime(); + } + if ($object->isInitialized('endedTime') && null !== $object->getEndedTime()) { + $data['ended_time'] = $object->getEndedTime(); + } + if ($object->isInitialized('isRunning') && null !== $object->getIsRunning()) { + $data['is_running'] = $object->getIsRunning(); + } + if ($object->isInitialized('billable') && null !== $object->getBillable()) { + $data['billable'] = $object->getBillable(); + } + if ($object->isInitialized('budgeted') && null !== $object->getBudgeted()) { + $data['budgeted'] = $object->getBudgeted(); + } + if ($object->isInitialized('billableRate') && null !== $object->getBillableRate()) { + $data['billable_rate'] = $object->getBillableRate(); + } + if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { + $data['cost_rate'] = $object->getCostRate(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntry' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntry' => false]; + } } } diff --git a/generated/Normalizer/TimeEntryProjectNormalizer.php b/generated/Normalizer/TimeEntryProjectNormalizer.php index f5f2590..6245679 100644 --- a/generated/Normalizer/TimeEntryProjectNormalizer.php +++ b/generated/Normalizer/TimeEntryProjectNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntryProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntryProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntryProject(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntryProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryProject' => false]; + } } } diff --git a/generated/Normalizer/TimeEntryTaskNormalizer.php b/generated/Normalizer/TimeEntryTaskNormalizer.php index 58f851e..221d3dc 100644 --- a/generated/Normalizer/TimeEntryTaskNormalizer.php +++ b/generated/Normalizer/TimeEntryTaskNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntryTaskNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntryTaskNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntryTask(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryTask(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntryTaskNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryTask(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryTask' => false]; + } } } diff --git a/generated/Normalizer/TimeEntryUserNormalizer.php b/generated/Normalizer/TimeEntryUserNormalizer.php index 2e2e3b0..b596fb2 100644 --- a/generated/Normalizer/TimeEntryUserNormalizer.php +++ b/generated/Normalizer/TimeEntryUserNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeEntryUserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeEntryUserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TimeEntryUser(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryUser(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeEntryUserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeEntryUser(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeEntryUser' => false]; + } } } diff --git a/generated/Normalizer/TimeReportsResultNormalizer.php b/generated/Normalizer/TimeReportsResultNormalizer.php index 8851e05..c2acb8c 100644 --- a/generated/Normalizer/TimeReportsResultNormalizer.php +++ b/generated/Normalizer/TimeReportsResultNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,215 +22,412 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeReportsResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeReportsResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\TimeReportsResult(); - if (\array_key_exists('total_hours', $data) && \is_int($data['total_hours'])) { - $data['total_hours'] = (float) $data['total_hours']; + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' === $type; } - if (\array_key_exists('billable_hours', $data) && \is_int($data['billable_hours'])) { - $data['billable_hours'] = (float) $data['billable_hours']; - } - if (\array_key_exists('billable_amount', $data) && \is_int($data['billable_amount'])) { - $data['billable_amount'] = (float) $data['billable_amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeReportsResult(); + if (\array_key_exists('total_hours', $data) && \is_int($data['total_hours'])) { + $data['total_hours'] = (float) $data['total_hours']; + } + if (\array_key_exists('billable_hours', $data) && \is_int($data['billable_hours'])) { + $data['billable_hours'] = (float) $data['billable_hours']; + } + if (\array_key_exists('billable_amount', $data) && \is_int($data['billable_amount'])) { + $data['billable_amount'] = (float) $data['billable_amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { + $object->setClientName($data['client_name']); + unset($data['client_name']); + } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { + $object->setClientName(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { + $object->setProjectName($data['project_name']); + unset($data['project_name']); + } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { + $object->setProjectName(null); + } + if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { + $object->setTaskId($data['task_id']); + unset($data['task_id']); + } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { + $object->setTaskId(null); + } + if (\array_key_exists('task_name', $data) && null !== $data['task_name']) { + $object->setTaskName($data['task_name']); + unset($data['task_name']); + } elseif (\array_key_exists('task_name', $data) && null === $data['task_name']) { + $object->setTaskName(null); + } + if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { + $object->setUserId($data['user_id']); + unset($data['user_id']); + } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { + $object->setUserId(null); + } + if (\array_key_exists('user_name', $data) && null !== $data['user_name']) { + $object->setUserName($data['user_name']); + unset($data['user_name']); + } elseif (\array_key_exists('user_name', $data) && null === $data['user_name']) { + $object->setUserName(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + if (\array_key_exists('avatar_url', $data) && null !== $data['avatar_url']) { + $object->setAvatarUrl($data['avatar_url']); + unset($data['avatar_url']); + } elseif (\array_key_exists('avatar_url', $data) && null === $data['avatar_url']) { + $object->setAvatarUrl(null); + } + if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { + $object->setIsContractor($data['is_contractor']); + unset($data['is_contractor']); + } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { + $object->setIsContractor(null); + } + if (\array_key_exists('total_hours', $data) && null !== $data['total_hours']) { + $object->setTotalHours($data['total_hours']); + unset($data['total_hours']); + } elseif (\array_key_exists('total_hours', $data) && null === $data['total_hours']) { + $object->setTotalHours(null); + } + if (\array_key_exists('billable_hours', $data) && null !== $data['billable_hours']) { + $object->setBillableHours($data['billable_hours']); + unset($data['billable_hours']); + } elseif (\array_key_exists('billable_hours', $data) && null === $data['billable_hours']) { + $object->setBillableHours(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('billable_amount', $data) && null !== $data['billable_amount']) { + $object->setBillableAmount($data['billable_amount']); + unset($data['billable_amount']); + } elseif (\array_key_exists('billable_amount', $data) && null === $data['billable_amount']) { + $object->setBillableAmount(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { - $object->setClientName($data['client_name']); - unset($data['client_name']); - } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { - $object->setClientName(null); - } - if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { - $object->setProjectId($data['project_id']); - unset($data['project_id']); - } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { - $object->setProjectId(null); - } - if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { - $object->setProjectName($data['project_name']); - unset($data['project_name']); - } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { - $object->setProjectName(null); - } - if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { - $object->setTaskId($data['task_id']); - unset($data['task_id']); - } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { - $object->setTaskId(null); - } - if (\array_key_exists('task_name', $data) && null !== $data['task_name']) { - $object->setTaskName($data['task_name']); - unset($data['task_name']); - } elseif (\array_key_exists('task_name', $data) && null === $data['task_name']) { - $object->setTaskName(null); - } - if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { - $object->setUserId($data['user_id']); - unset($data['user_id']); - } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { - $object->setUserId(null); - } - if (\array_key_exists('user_name', $data) && null !== $data['user_name']) { - $object->setUserName($data['user_name']); - unset($data['user_name']); - } elseif (\array_key_exists('user_name', $data) && null === $data['user_name']) { - $object->setUserName(null); - } - if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { - $object->setWeeklyCapacity($data['weekly_capacity']); - unset($data['weekly_capacity']); - } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { - $object->setWeeklyCapacity(null); - } - if (\array_key_exists('avatar_url', $data) && null !== $data['avatar_url']) { - $object->setAvatarUrl($data['avatar_url']); - unset($data['avatar_url']); - } elseif (\array_key_exists('avatar_url', $data) && null === $data['avatar_url']) { - $object->setAvatarUrl(null); - } - if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { - $object->setIsContractor($data['is_contractor']); - unset($data['is_contractor']); - } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { - $object->setIsContractor(null); - } - if (\array_key_exists('total_hours', $data) && null !== $data['total_hours']) { - $object->setTotalHours($data['total_hours']); - unset($data['total_hours']); - } elseif (\array_key_exists('total_hours', $data) && null === $data['total_hours']) { - $object->setTotalHours(null); - } - if (\array_key_exists('billable_hours', $data) && null !== $data['billable_hours']) { - $object->setBillableHours($data['billable_hours']); - unset($data['billable_hours']); - } elseif (\array_key_exists('billable_hours', $data) && null === $data['billable_hours']) { - $object->setBillableHours(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - if (\array_key_exists('billable_amount', $data) && null !== $data['billable_amount']) { - $object->setBillableAmount($data['billable_amount']); - unset($data['billable_amount']); - } elseif (\array_key_exists('billable_amount', $data) && null === $data['billable_amount']) { - $object->setBillableAmount(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('clientName') && null !== $object->getClientName()) { + $data['client_name'] = $object->getClientName(); + } + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { + $data['project_name'] = $object->getProjectName(); + } + if ($object->isInitialized('taskId') && null !== $object->getTaskId()) { + $data['task_id'] = $object->getTaskId(); + } + if ($object->isInitialized('taskName') && null !== $object->getTaskName()) { + $data['task_name'] = $object->getTaskName(); + } + if ($object->isInitialized('userId') && null !== $object->getUserId()) { + $data['user_id'] = $object->getUserId(); + } + if ($object->isInitialized('userName') && null !== $object->getUserName()) { + $data['user_name'] = $object->getUserName(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + if ($object->isInitialized('avatarUrl') && null !== $object->getAvatarUrl()) { + $data['avatar_url'] = $object->getAvatarUrl(); + } + if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { + $data['is_contractor'] = $object->getIsContractor(); + } + if ($object->isInitialized('totalHours') && null !== $object->getTotalHours()) { + $data['total_hours'] = $object->getTotalHours(); + } + if ($object->isInitialized('billableHours') && null !== $object->getBillableHours()) { + $data['billable_hours'] = $object->getBillableHours(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('billableAmount') && null !== $object->getBillableAmount()) { + $data['billable_amount'] = $object->getBillableAmount(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeReportsResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('clientName') && null !== $object->getClientName()) { - $data['client_name'] = $object->getClientName(); - } - if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { - $data['project_id'] = $object->getProjectId(); - } - if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { - $data['project_name'] = $object->getProjectName(); - } - if ($object->isInitialized('taskId') && null !== $object->getTaskId()) { - $data['task_id'] = $object->getTaskId(); - } - if ($object->isInitialized('taskName') && null !== $object->getTaskName()) { - $data['task_name'] = $object->getTaskName(); - } - if ($object->isInitialized('userId') && null !== $object->getUserId()) { - $data['user_id'] = $object->getUserId(); - } - if ($object->isInitialized('userName') && null !== $object->getUserName()) { - $data['user_name'] = $object->getUserName(); - } - if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { - $data['weekly_capacity'] = $object->getWeeklyCapacity(); - } - if ($object->isInitialized('avatarUrl') && null !== $object->getAvatarUrl()) { - $data['avatar_url'] = $object->getAvatarUrl(); - } - if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { - $data['is_contractor'] = $object->getIsContractor(); - } - if ($object->isInitialized('totalHours') && null !== $object->getTotalHours()) { - $data['total_hours'] = $object->getTotalHours(); - } - if ($object->isInitialized('billableHours') && null !== $object->getBillableHours()) { - $data['billable_hours'] = $object->getBillableHours(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' === $type; } - if ($object->isInitialized('billableAmount') && null !== $object->getBillableAmount()) { - $data['billable_amount'] = $object->getBillableAmount(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeReportsResult(); + if (\array_key_exists('total_hours', $data) && \is_int($data['total_hours'])) { + $data['total_hours'] = (float) $data['total_hours']; + } + if (\array_key_exists('billable_hours', $data) && \is_int($data['billable_hours'])) { + $data['billable_hours'] = (float) $data['billable_hours']; + } + if (\array_key_exists('billable_amount', $data) && \is_int($data['billable_amount'])) { + $data['billable_amount'] = (float) $data['billable_amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { + $object->setClientName($data['client_name']); + unset($data['client_name']); + } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { + $object->setClientName(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { + $object->setProjectName($data['project_name']); + unset($data['project_name']); + } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { + $object->setProjectName(null); + } + if (\array_key_exists('task_id', $data) && null !== $data['task_id']) { + $object->setTaskId($data['task_id']); + unset($data['task_id']); + } elseif (\array_key_exists('task_id', $data) && null === $data['task_id']) { + $object->setTaskId(null); + } + if (\array_key_exists('task_name', $data) && null !== $data['task_name']) { + $object->setTaskName($data['task_name']); + unset($data['task_name']); + } elseif (\array_key_exists('task_name', $data) && null === $data['task_name']) { + $object->setTaskName(null); + } + if (\array_key_exists('user_id', $data) && null !== $data['user_id']) { + $object->setUserId($data['user_id']); + unset($data['user_id']); + } elseif (\array_key_exists('user_id', $data) && null === $data['user_id']) { + $object->setUserId(null); } + if (\array_key_exists('user_name', $data) && null !== $data['user_name']) { + $object->setUserName($data['user_name']); + unset($data['user_name']); + } elseif (\array_key_exists('user_name', $data) && null === $data['user_name']) { + $object->setUserName(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + if (\array_key_exists('avatar_url', $data) && null !== $data['avatar_url']) { + $object->setAvatarUrl($data['avatar_url']); + unset($data['avatar_url']); + } elseif (\array_key_exists('avatar_url', $data) && null === $data['avatar_url']) { + $object->setAvatarUrl(null); + } + if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { + $object->setIsContractor($data['is_contractor']); + unset($data['is_contractor']); + } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { + $object->setIsContractor(null); + } + if (\array_key_exists('total_hours', $data) && null !== $data['total_hours']) { + $object->setTotalHours($data['total_hours']); + unset($data['total_hours']); + } elseif (\array_key_exists('total_hours', $data) && null === $data['total_hours']) { + $object->setTotalHours(null); + } + if (\array_key_exists('billable_hours', $data) && null !== $data['billable_hours']) { + $object->setBillableHours($data['billable_hours']); + unset($data['billable_hours']); + } elseif (\array_key_exists('billable_hours', $data) && null === $data['billable_hours']) { + $object->setBillableHours(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('billable_amount', $data) && null !== $data['billable_amount']) { + $object->setBillableAmount($data['billable_amount']); + unset($data['billable_amount']); + } elseif (\array_key_exists('billable_amount', $data) && null === $data['billable_amount']) { + $object->setBillableAmount(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('clientName') && null !== $object->getClientName()) { + $data['client_name'] = $object->getClientName(); + } + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { + $data['project_name'] = $object->getProjectName(); + } + if ($object->isInitialized('taskId') && null !== $object->getTaskId()) { + $data['task_id'] = $object->getTaskId(); + } + if ($object->isInitialized('taskName') && null !== $object->getTaskName()) { + $data['task_name'] = $object->getTaskName(); + } + if ($object->isInitialized('userId') && null !== $object->getUserId()) { + $data['user_id'] = $object->getUserId(); + } + if ($object->isInitialized('userName') && null !== $object->getUserName()) { + $data['user_name'] = $object->getUserName(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + if ($object->isInitialized('avatarUrl') && null !== $object->getAvatarUrl()) { + $data['avatar_url'] = $object->getAvatarUrl(); + } + if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { + $data['is_contractor'] = $object->getIsContractor(); + } + if ($object->isInitialized('totalHours') && null !== $object->getTotalHours()) { + $data['total_hours'] = $object->getTotalHours(); + } + if ($object->isInitialized('billableHours') && null !== $object->getBillableHours()) { + $data['billable_hours'] = $object->getBillableHours(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('billableAmount') && null !== $object->getBillableAmount()) { + $data['billable_amount'] = $object->getBillableAmount(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeReportsResult' => false]; + } } } diff --git a/generated/Normalizer/TimeReportsResultsNormalizer.php b/generated/Normalizer/TimeReportsResultsNormalizer.php index ede05ed..5e8eeea 100644 --- a/generated/Normalizer/TimeReportsResultsNormalizer.php +++ b/generated/Normalizer/TimeReportsResultsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class TimeReportsResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class TimeReportsResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\TimeReportsResults(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeReportsResults(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('results', $data)) { + $values = []; + foreach ($data['results'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult', 'json', $context); + } + $object->setResults($values); + unset($data['results']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('results', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['results'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult', 'json', $context); + foreach ($object->getResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setResults($values); - unset($data['results']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['results'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class TimeReportsResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getResults() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' === $data::class; } - $data['results'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\TimeReportsResults(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('results', $data)) { + $values = []; + foreach ($data['results'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\TimeReportsResult', 'json', $context); + } + $object->setResults($values); + unset($data['results']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['results'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\TimeReportsResults' => false]; + } } } diff --git a/generated/Normalizer/UninvoicedReportResultNormalizer.php b/generated/Normalizer/UninvoicedReportResultNormalizer.php index 38a1f37..3bea2ed 100644 --- a/generated/Normalizer/UninvoicedReportResultNormalizer.php +++ b/generated/Normalizer/UninvoicedReportResultNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,164 +22,310 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UninvoicedReportResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UninvoicedReportResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\UninvoicedReportResult(); - if (\array_key_exists('total_hours', $data) && \is_int($data['total_hours'])) { - $data['total_hours'] = (float) $data['total_hours']; - } - if (\array_key_exists('uninvoiced_hours', $data) && \is_int($data['uninvoiced_hours'])) { - $data['uninvoiced_hours'] = (float) $data['uninvoiced_hours']; - } - if (\array_key_exists('uninvoiced_expenses', $data) && \is_int($data['uninvoiced_expenses'])) { - $data['uninvoiced_expenses'] = (float) $data['uninvoiced_expenses']; - } - if (\array_key_exists('uninvoiced_amount', $data) && \is_int($data['uninvoiced_amount'])) { - $data['uninvoiced_amount'] = (float) $data['uninvoiced_amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UninvoicedReportResult(); + if (\array_key_exists('total_hours', $data) && \is_int($data['total_hours'])) { + $data['total_hours'] = (float) $data['total_hours']; + } + if (\array_key_exists('uninvoiced_hours', $data) && \is_int($data['uninvoiced_hours'])) { + $data['uninvoiced_hours'] = (float) $data['uninvoiced_hours']; + } + if (\array_key_exists('uninvoiced_expenses', $data) && \is_int($data['uninvoiced_expenses'])) { + $data['uninvoiced_expenses'] = (float) $data['uninvoiced_expenses']; + } + if (\array_key_exists('uninvoiced_amount', $data) && \is_int($data['uninvoiced_amount'])) { + $data['uninvoiced_amount'] = (float) $data['uninvoiced_amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { + $object->setClientName($data['client_name']); + unset($data['client_name']); + } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { + $object->setClientName(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { + $object->setProjectName($data['project_name']); + unset($data['project_name']); + } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { + $object->setProjectName(null); + } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('total_hours', $data) && null !== $data['total_hours']) { + $object->setTotalHours($data['total_hours']); + unset($data['total_hours']); + } elseif (\array_key_exists('total_hours', $data) && null === $data['total_hours']) { + $object->setTotalHours(null); + } + if (\array_key_exists('uninvoiced_hours', $data) && null !== $data['uninvoiced_hours']) { + $object->setUninvoicedHours($data['uninvoiced_hours']); + unset($data['uninvoiced_hours']); + } elseif (\array_key_exists('uninvoiced_hours', $data) && null === $data['uninvoiced_hours']) { + $object->setUninvoicedHours(null); + } + if (\array_key_exists('uninvoiced_expenses', $data) && null !== $data['uninvoiced_expenses']) { + $object->setUninvoicedExpenses($data['uninvoiced_expenses']); + unset($data['uninvoiced_expenses']); + } elseif (\array_key_exists('uninvoiced_expenses', $data) && null === $data['uninvoiced_expenses']) { + $object->setUninvoicedExpenses(null); + } + if (\array_key_exists('uninvoiced_amount', $data) && null !== $data['uninvoiced_amount']) { + $object->setUninvoicedAmount($data['uninvoiced_amount']); + unset($data['uninvoiced_amount']); + } elseif (\array_key_exists('uninvoiced_amount', $data) && null === $data['uninvoiced_amount']) { + $object->setUninvoicedAmount(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { - $object->setClientId($data['client_id']); - unset($data['client_id']); - } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { - $object->setClientId(null); - } - if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { - $object->setClientName($data['client_name']); - unset($data['client_name']); - } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { - $object->setClientName(null); - } - if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { - $object->setProjectId($data['project_id']); - unset($data['project_id']); - } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { - $object->setProjectId(null); - } - if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { - $object->setProjectName($data['project_name']); - unset($data['project_name']); - } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { - $object->setProjectName(null); - } - if (\array_key_exists('currency', $data) && null !== $data['currency']) { - $object->setCurrency($data['currency']); - unset($data['currency']); - } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { - $object->setCurrency(null); - } - if (\array_key_exists('total_hours', $data) && null !== $data['total_hours']) { - $object->setTotalHours($data['total_hours']); - unset($data['total_hours']); - } elseif (\array_key_exists('total_hours', $data) && null === $data['total_hours']) { - $object->setTotalHours(null); - } - if (\array_key_exists('uninvoiced_hours', $data) && null !== $data['uninvoiced_hours']) { - $object->setUninvoicedHours($data['uninvoiced_hours']); - unset($data['uninvoiced_hours']); - } elseif (\array_key_exists('uninvoiced_hours', $data) && null === $data['uninvoiced_hours']) { - $object->setUninvoicedHours(null); - } - if (\array_key_exists('uninvoiced_expenses', $data) && null !== $data['uninvoiced_expenses']) { - $object->setUninvoicedExpenses($data['uninvoiced_expenses']); - unset($data['uninvoiced_expenses']); - } elseif (\array_key_exists('uninvoiced_expenses', $data) && null === $data['uninvoiced_expenses']) { - $object->setUninvoicedExpenses(null); - } - if (\array_key_exists('uninvoiced_amount', $data) && null !== $data['uninvoiced_amount']) { - $object->setUninvoicedAmount($data['uninvoiced_amount']); - unset($data['uninvoiced_amount']); - } elseif (\array_key_exists('uninvoiced_amount', $data) && null === $data['uninvoiced_amount']) { - $object->setUninvoicedAmount(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('clientName') && null !== $object->getClientName()) { + $data['client_name'] = $object->getClientName(); + } + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { + $data['project_name'] = $object->getProjectName(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('totalHours') && null !== $object->getTotalHours()) { + $data['total_hours'] = $object->getTotalHours(); + } + if ($object->isInitialized('uninvoicedHours') && null !== $object->getUninvoicedHours()) { + $data['uninvoiced_hours'] = $object->getUninvoicedHours(); + } + if ($object->isInitialized('uninvoicedExpenses') && null !== $object->getUninvoicedExpenses()) { + $data['uninvoiced_expenses'] = $object->getUninvoicedExpenses(); + } + if ($object->isInitialized('uninvoicedAmount') && null !== $object->getUninvoicedAmount()) { + $data['uninvoiced_amount'] = $object->getUninvoicedAmount(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UninvoicedReportResultNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('clientId') && null !== $object->getClientId()) { - $data['client_id'] = $object->getClientId(); - } - if ($object->isInitialized('clientName') && null !== $object->getClientName()) { - $data['client_name'] = $object->getClientName(); - } - if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { - $data['project_id'] = $object->getProjectId(); - } - if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { - $data['project_name'] = $object->getProjectName(); - } - if ($object->isInitialized('currency') && null !== $object->getCurrency()) { - $data['currency'] = $object->getCurrency(); - } - if ($object->isInitialized('totalHours') && null !== $object->getTotalHours()) { - $data['total_hours'] = $object->getTotalHours(); - } - if ($object->isInitialized('uninvoicedHours') && null !== $object->getUninvoicedHours()) { - $data['uninvoiced_hours'] = $object->getUninvoicedHours(); - } - if ($object->isInitialized('uninvoicedExpenses') && null !== $object->getUninvoicedExpenses()) { - $data['uninvoiced_expenses'] = $object->getUninvoicedExpenses(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' === $type; } - if ($object->isInitialized('uninvoicedAmount') && null !== $object->getUninvoicedAmount()) { - $data['uninvoiced_amount'] = $object->getUninvoicedAmount(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UninvoicedReportResult(); + if (\array_key_exists('total_hours', $data) && \is_int($data['total_hours'])) { + $data['total_hours'] = (float) $data['total_hours']; + } + if (\array_key_exists('uninvoiced_hours', $data) && \is_int($data['uninvoiced_hours'])) { + $data['uninvoiced_hours'] = (float) $data['uninvoiced_hours']; + } + if (\array_key_exists('uninvoiced_expenses', $data) && \is_int($data['uninvoiced_expenses'])) { + $data['uninvoiced_expenses'] = (float) $data['uninvoiced_expenses']; + } + if (\array_key_exists('uninvoiced_amount', $data) && \is_int($data['uninvoiced_amount'])) { + $data['uninvoiced_amount'] = (float) $data['uninvoiced_amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('client_id', $data) && null !== $data['client_id']) { + $object->setClientId($data['client_id']); + unset($data['client_id']); + } elseif (\array_key_exists('client_id', $data) && null === $data['client_id']) { + $object->setClientId(null); + } + if (\array_key_exists('client_name', $data) && null !== $data['client_name']) { + $object->setClientName($data['client_name']); + unset($data['client_name']); + } elseif (\array_key_exists('client_name', $data) && null === $data['client_name']) { + $object->setClientName(null); + } + if (\array_key_exists('project_id', $data) && null !== $data['project_id']) { + $object->setProjectId($data['project_id']); + unset($data['project_id']); + } elseif (\array_key_exists('project_id', $data) && null === $data['project_id']) { + $object->setProjectId(null); + } + if (\array_key_exists('project_name', $data) && null !== $data['project_name']) { + $object->setProjectName($data['project_name']); + unset($data['project_name']); + } elseif (\array_key_exists('project_name', $data) && null === $data['project_name']) { + $object->setProjectName(null); } + if (\array_key_exists('currency', $data) && null !== $data['currency']) { + $object->setCurrency($data['currency']); + unset($data['currency']); + } elseif (\array_key_exists('currency', $data) && null === $data['currency']) { + $object->setCurrency(null); + } + if (\array_key_exists('total_hours', $data) && null !== $data['total_hours']) { + $object->setTotalHours($data['total_hours']); + unset($data['total_hours']); + } elseif (\array_key_exists('total_hours', $data) && null === $data['total_hours']) { + $object->setTotalHours(null); + } + if (\array_key_exists('uninvoiced_hours', $data) && null !== $data['uninvoiced_hours']) { + $object->setUninvoicedHours($data['uninvoiced_hours']); + unset($data['uninvoiced_hours']); + } elseif (\array_key_exists('uninvoiced_hours', $data) && null === $data['uninvoiced_hours']) { + $object->setUninvoicedHours(null); + } + if (\array_key_exists('uninvoiced_expenses', $data) && null !== $data['uninvoiced_expenses']) { + $object->setUninvoicedExpenses($data['uninvoiced_expenses']); + unset($data['uninvoiced_expenses']); + } elseif (\array_key_exists('uninvoiced_expenses', $data) && null === $data['uninvoiced_expenses']) { + $object->setUninvoicedExpenses(null); + } + if (\array_key_exists('uninvoiced_amount', $data) && null !== $data['uninvoiced_amount']) { + $object->setUninvoicedAmount($data['uninvoiced_amount']); + unset($data['uninvoiced_amount']); + } elseif (\array_key_exists('uninvoiced_amount', $data) && null === $data['uninvoiced_amount']) { + $object->setUninvoicedAmount(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('clientId') && null !== $object->getClientId()) { + $data['client_id'] = $object->getClientId(); + } + if ($object->isInitialized('clientName') && null !== $object->getClientName()) { + $data['client_name'] = $object->getClientName(); + } + if ($object->isInitialized('projectId') && null !== $object->getProjectId()) { + $data['project_id'] = $object->getProjectId(); + } + if ($object->isInitialized('projectName') && null !== $object->getProjectName()) { + $data['project_name'] = $object->getProjectName(); + } + if ($object->isInitialized('currency') && null !== $object->getCurrency()) { + $data['currency'] = $object->getCurrency(); + } + if ($object->isInitialized('totalHours') && null !== $object->getTotalHours()) { + $data['total_hours'] = $object->getTotalHours(); + } + if ($object->isInitialized('uninvoicedHours') && null !== $object->getUninvoicedHours()) { + $data['uninvoiced_hours'] = $object->getUninvoicedHours(); + } + if ($object->isInitialized('uninvoicedExpenses') && null !== $object->getUninvoicedExpenses()) { + $data['uninvoiced_expenses'] = $object->getUninvoicedExpenses(); + } + if ($object->isInitialized('uninvoicedAmount') && null !== $object->getUninvoicedAmount()) { + $data['uninvoiced_amount'] = $object->getUninvoicedAmount(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult' => false]; + } } } diff --git a/generated/Normalizer/UninvoicedReportResultsNormalizer.php b/generated/Normalizer/UninvoicedReportResultsNormalizer.php index 7e6b8e7..be862af 100644 --- a/generated/Normalizer/UninvoicedReportResultsNormalizer.php +++ b/generated/Normalizer/UninvoicedReportResultsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UninvoicedReportResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UninvoicedReportResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\UninvoicedReportResults(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UninvoicedReportResults(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('results', $data)) { + $values = []; + foreach ($data['results'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult', 'json', $context); + } + $object->setResults($values); + unset($data['results']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('results', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['results'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult', 'json', $context); + foreach ($object->getResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setResults($values); - unset($data['results']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['results'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UninvoicedReportResultsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getResults() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' === $data::class; } - $data['results'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UninvoicedReportResults(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('results', $data)) { + $values = []; + foreach ($data['results'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResult', 'json', $context); + } + $object->setResults($values); + unset($data['results']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getResults() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['results'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UninvoicedReportResults' => false]; + } } } diff --git a/generated/Normalizer/UserAssignmentNormalizer.php b/generated/Normalizer/UserAssignmentNormalizer.php index 840426a..b22c223 100644 --- a/generated/Normalizer/UserAssignmentNormalizer.php +++ b/generated/Normalizer/UserAssignmentNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,167 +22,316 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UserAssignmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UserAssignmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\UserAssignment(); - if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { - $data['hourly_rate'] = (float) $data['hourly_rate']; - } - if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { - $data['budget'] = (float) $data['budget']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UserAssignment(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('user', $data) && null !== $data['user']) { + $object->setUser($this->denormalizer->denormalize($data['user'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser', 'json', $context)); + unset($data['user']); + } elseif (\array_key_exists('user', $data) && null === $data['user']) { + $object->setUser(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { + $object->setIsProjectManager($data['is_project_manager']); + unset($data['is_project_manager']); + } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { + $object->setIsProjectManager(null); + } + if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { + $object->setUseDefaultRates($data['use_default_rates']); + unset($data['use_default_rates']); + } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { + $object->setUseDefaultRates(null); + } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('project', $data) && null !== $data['project']) { - $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject', 'json', $context)); - unset($data['project']); - } elseif (\array_key_exists('project', $data) && null === $data['project']) { - $object->setProject(null); - } - if (\array_key_exists('user', $data) && null !== $data['user']) { - $object->setUser($this->denormalizer->denormalize($data['user'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser', 'json', $context)); - unset($data['user']); - } elseif (\array_key_exists('user', $data) && null === $data['user']) { - $object->setUser(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { - $object->setIsProjectManager($data['is_project_manager']); - unset($data['is_project_manager']); - } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { - $object->setIsProjectManager(null); - } - if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { - $object->setUseDefaultRates($data['use_default_rates']); - unset($data['use_default_rates']); - } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { - $object->setUseDefaultRates(null); - } - if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { - $object->setHourlyRate($data['hourly_rate']); - unset($data['hourly_rate']); - } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { - $object->setHourlyRate(null); - } - if (\array_key_exists('budget', $data) && null !== $data['budget']) { - $object->setBudget($data['budget']); - unset($data['budget']); - } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { - $object->setBudget(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('user') && null !== $object->getUser()) { + $data['user'] = $this->normalizer->normalize($object->getUser(), 'json', $context); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { + $data['is_project_manager'] = $object->getIsProjectManager(); + } + if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { + $data['use_default_rates'] = $object->getUseDefaultRates(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UserAssignment' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UserAssignmentNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('project') && null !== $object->getProject()) { - $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); - } - if ($object->isInitialized('user') && null !== $object->getUser()) { - $data['user'] = $this->normalizer->normalize($object->getUser(), 'json', $context); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { - $data['is_project_manager'] = $object->getIsProjectManager(); - } - if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { - $data['use_default_rates'] = $object->getUseDefaultRates(); - } - if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { - $data['hourly_rate'] = $object->getHourlyRate(); - } - if ($object->isInitialized('budget') && null !== $object->getBudget()) { - $data['budget'] = $object->getBudget(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' === $type; } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignment' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UserAssignment(); + if (\array_key_exists('hourly_rate', $data) && \is_int($data['hourly_rate'])) { + $data['hourly_rate'] = (float) $data['hourly_rate']; + } + if (\array_key_exists('budget', $data) && \is_int($data['budget'])) { + $data['budget'] = (float) $data['budget']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('project', $data) && null !== $data['project']) { + $object->setProject($this->denormalizer->denormalize($data['project'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject', 'json', $context)); + unset($data['project']); + } elseif (\array_key_exists('project', $data) && null === $data['project']) { + $object->setProject(null); + } + if (\array_key_exists('user', $data) && null !== $data['user']) { + $object->setUser($this->denormalizer->denormalize($data['user'], 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser', 'json', $context)); + unset($data['user']); + } elseif (\array_key_exists('user', $data) && null === $data['user']) { + $object->setUser(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('is_project_manager', $data) && null !== $data['is_project_manager']) { + $object->setIsProjectManager($data['is_project_manager']); + unset($data['is_project_manager']); + } elseif (\array_key_exists('is_project_manager', $data) && null === $data['is_project_manager']) { + $object->setIsProjectManager(null); + } + if (\array_key_exists('use_default_rates', $data) && null !== $data['use_default_rates']) { + $object->setUseDefaultRates($data['use_default_rates']); + unset($data['use_default_rates']); + } elseif (\array_key_exists('use_default_rates', $data) && null === $data['use_default_rates']) { + $object->setUseDefaultRates(null); } + if (\array_key_exists('hourly_rate', $data) && null !== $data['hourly_rate']) { + $object->setHourlyRate($data['hourly_rate']); + unset($data['hourly_rate']); + } elseif (\array_key_exists('hourly_rate', $data) && null === $data['hourly_rate']) { + $object->setHourlyRate(null); + } + if (\array_key_exists('budget', $data) && null !== $data['budget']) { + $object->setBudget($data['budget']); + unset($data['budget']); + } elseif (\array_key_exists('budget', $data) && null === $data['budget']) { + $object->setBudget(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('project') && null !== $object->getProject()) { + $data['project'] = $this->normalizer->normalize($object->getProject(), 'json', $context); + } + if ($object->isInitialized('user') && null !== $object->getUser()) { + $data['user'] = $this->normalizer->normalize($object->getUser(), 'json', $context); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('isProjectManager') && null !== $object->getIsProjectManager()) { + $data['is_project_manager'] = $object->getIsProjectManager(); + } + if ($object->isInitialized('useDefaultRates') && null !== $object->getUseDefaultRates()) { + $data['use_default_rates'] = $object->getUseDefaultRates(); + } + if ($object->isInitialized('hourlyRate') && null !== $object->getHourlyRate()) { + $data['hourly_rate'] = $object->getHourlyRate(); + } + if ($object->isInitialized('budget') && null !== $object->getBudget()) { + $data['budget'] = $object->getBudget(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UserAssignment' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UserAssignment' => false]; + } } } diff --git a/generated/Normalizer/UserAssignmentProjectNormalizer.php b/generated/Normalizer/UserAssignmentProjectNormalizer.php index d945e6e..c6a8e2d 100644 --- a/generated/Normalizer/UserAssignmentProjectNormalizer.php +++ b/generated/Normalizer/UserAssignmentProjectNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,98 +22,178 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UserAssignmentProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UserAssignmentProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\UserAssignmentProject(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UserAssignmentProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - if (\array_key_exists('code', $data) && null !== $data['code']) { - $object->setCode($data['code']); - unset($data['code']); - } elseif (\array_key_exists('code', $data) && null === $data['code']) { - $object->setCode(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UserAssignmentProjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' === $type; } - if ($object->isInitialized('code') && null !== $object->getCode()) { - $data['code'] = $object->getCode(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UserAssignmentProject(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + if (\array_key_exists('code', $data) && null !== $data['code']) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && null === $data['code']) { + $object->setCode(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('code') && null !== $object->getCode()) { + $data['code'] = $object->getCode(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UserAssignmentProject' => false]; + } } } diff --git a/generated/Normalizer/UserAssignmentUserNormalizer.php b/generated/Normalizer/UserAssignmentUserNormalizer.php index 02f5c6e..9587c73 100644 --- a/generated/Normalizer/UserAssignmentUserNormalizer.php +++ b/generated/Normalizer/UserAssignmentUserNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,89 +22,160 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UserAssignmentUserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UserAssignmentUserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\UserAssignmentUser(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UserAssignmentUser(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('name', $data) && null !== $data['name']) { - $object->setName($data['name']); - unset($data['name']); - } elseif (\array_key_exists('name', $data) && null === $data['name']) { - $object->setName(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UserAssignmentUserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' === $type; } - if ($object->isInitialized('name') && null !== $object->getName()) { - $data['name'] = $object->getName(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' === $data::class; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UserAssignmentUser(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('name', $data) && null !== $data['name']) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && null === $data['name']) { + $object->setName(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('name') && null !== $object->getName()) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UserAssignmentUser' => false]; + } } } diff --git a/generated/Normalizer/UserAssignmentsNormalizer.php b/generated/Normalizer/UserAssignmentsNormalizer.php index 0c0d994..35defb2 100644 --- a/generated/Normalizer/UserAssignmentsNormalizer.php +++ b/generated/Normalizer/UserAssignmentsNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UserAssignmentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UserAssignmentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\UserAssignments(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UserAssignments(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('user_assignments', $data)) { + $values = []; + foreach ($data['user_assignments'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\UserAssignment', 'json', $context); + } + $object->setUserAssignments($values); + unset($data['user_assignments']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('user_assignments', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['user_assignments'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\UserAssignment', 'json', $context); + foreach ($object->getUserAssignments() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setUserAssignments($values); - unset($data['user_assignments']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['user_assignments'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UserAssignments' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UserAssignmentsNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getUserAssignments() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UserAssignments' === $data::class; } - $data['user_assignments'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UserAssignments(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('user_assignments', $data)) { + $values = []; + foreach ($data['user_assignments'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\UserAssignment', 'json', $context); + } + $object->setUserAssignments($values); + unset($data['user_assignments']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getUserAssignments() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['user_assignments'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UserAssignments' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UserAssignments' => false]; + } } } diff --git a/generated/Normalizer/UserNormalizer.php b/generated/Normalizer/UserNormalizer.php index dac74d9..c472c48 100644 --- a/generated/Normalizer/UserNormalizer.php +++ b/generated/Normalizer/UserNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,246 +22,474 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\User' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\User' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\User' === $type; } - $object = new \JoliCode\Harvest\Api\Model\User(); - if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { - $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; - } - if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { - $data['cost_rate'] = (float) $data['cost_rate']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\User' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\User(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { + $data['cost_rate'] = (float) $data['cost_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('telephone', $data) && null !== $data['telephone']) { + $object->setTelephone($data['telephone']); + unset($data['telephone']); + } elseif (\array_key_exists('telephone', $data) && null === $data['telephone']) { + $object->setTelephone(null); + } + if (\array_key_exists('timezone', $data) && null !== $data['timezone']) { + $object->setTimezone($data['timezone']); + unset($data['timezone']); + } elseif (\array_key_exists('timezone', $data) && null === $data['timezone']) { + $object->setTimezone(null); + } + if (\array_key_exists('has_access_to_all_future_projects', $data) && null !== $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects($data['has_access_to_all_future_projects']); + unset($data['has_access_to_all_future_projects']); + } elseif (\array_key_exists('has_access_to_all_future_projects', $data) && null === $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects(null); + } + if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { + $object->setIsContractor($data['is_contractor']); + unset($data['is_contractor']); + } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { + $object->setIsContractor(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { + $object->setCostRate($data['cost_rate']); + unset($data['cost_rate']); + } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { + $object->setCostRate(null); + } + if (\array_key_exists('roles', $data) && null !== $data['roles']) { + $values = []; + foreach ($data['roles'] as $value) { + $values[] = $value; + } + $object->setRoles($values); + unset($data['roles']); + } elseif (\array_key_exists('roles', $data) && null === $data['roles']) { + $object->setRoles(null); + } + if (\array_key_exists('access_roles', $data) && null !== $data['access_roles']) { + $values_1 = []; + foreach ($data['access_roles'] as $value_1) { + $values_1[] = $value_1; + } + $object->setAccessRoles($values_1); + unset($data['access_roles']); + } elseif (\array_key_exists('access_roles', $data) && null === $data['access_roles']) { + $object->setAccessRoles(null); + } + if (\array_key_exists('avatar_url', $data) && null !== $data['avatar_url']) { + $object->setAvatarUrl($data['avatar_url']); + unset($data['avatar_url']); + } elseif (\array_key_exists('avatar_url', $data) && null === $data['avatar_url']) { + $object->setAvatarUrl(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } - if (\array_key_exists('id', $data) && null !== $data['id']) { - $object->setId($data['id']); - unset($data['id']); - } elseif (\array_key_exists('id', $data) && null === $data['id']) { - $object->setId(null); - } - if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { - $object->setFirstName($data['first_name']); - unset($data['first_name']); - } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { - $object->setFirstName(null); - } - if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { - $object->setLastName($data['last_name']); - unset($data['last_name']); - } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { - $object->setLastName(null); - } - if (\array_key_exists('email', $data) && null !== $data['email']) { - $object->setEmail($data['email']); - unset($data['email']); - } elseif (\array_key_exists('email', $data) && null === $data['email']) { - $object->setEmail(null); - } - if (\array_key_exists('telephone', $data) && null !== $data['telephone']) { - $object->setTelephone($data['telephone']); - unset($data['telephone']); - } elseif (\array_key_exists('telephone', $data) && null === $data['telephone']) { - $object->setTelephone(null); - } - if (\array_key_exists('timezone', $data) && null !== $data['timezone']) { - $object->setTimezone($data['timezone']); - unset($data['timezone']); - } elseif (\array_key_exists('timezone', $data) && null === $data['timezone']) { - $object->setTimezone(null); - } - if (\array_key_exists('has_access_to_all_future_projects', $data) && null !== $data['has_access_to_all_future_projects']) { - $object->setHasAccessToAllFutureProjects($data['has_access_to_all_future_projects']); - unset($data['has_access_to_all_future_projects']); - } elseif (\array_key_exists('has_access_to_all_future_projects', $data) && null === $data['has_access_to_all_future_projects']) { - $object->setHasAccessToAllFutureProjects(null); - } - if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { - $object->setIsContractor($data['is_contractor']); - unset($data['is_contractor']); - } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { - $object->setIsContractor(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { - $object->setWeeklyCapacity($data['weekly_capacity']); - unset($data['weekly_capacity']); - } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { - $object->setWeeklyCapacity(null); - } - if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { - $object->setDefaultHourlyRate($data['default_hourly_rate']); - unset($data['default_hourly_rate']); - } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { - $object->setDefaultHourlyRate(null); - } - if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { - $object->setCostRate($data['cost_rate']); - unset($data['cost_rate']); - } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { - $object->setCostRate(null); - } - if (\array_key_exists('roles', $data) && null !== $data['roles']) { - $values = []; - foreach ($data['roles'] as $value) { - $values[] = $value; - } - $object->setRoles($values); - unset($data['roles']); - } elseif (\array_key_exists('roles', $data) && null === $data['roles']) { - $object->setRoles(null); - } - if (\array_key_exists('access_roles', $data) && null !== $data['access_roles']) { - $values_1 = []; - foreach ($data['access_roles'] as $value_1) { - $values_1[] = $value_1; - } - $object->setAccessRoles($values_1); - unset($data['access_roles']); - } elseif (\array_key_exists('access_roles', $data) && null === $data['access_roles']) { - $object->setAccessRoles(null); - } - if (\array_key_exists('avatar_url', $data) && null !== $data['avatar_url']) { - $object->setAvatarUrl($data['avatar_url']); - unset($data['avatar_url']); - } elseif (\array_key_exists('avatar_url', $data) && null === $data['avatar_url']) { - $object->setAvatarUrl(null); - } - if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { - $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); - unset($data['created_at']); - } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { - $object->setCreatedAt(null); - } - if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { - $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); - unset($data['updated_at']); - } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { - $object->setUpdatedAt(null); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { + $data['first_name'] = $object->getFirstName(); + } + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + if ($object->isInitialized('telephone') && null !== $object->getTelephone()) { + $data['telephone'] = $object->getTelephone(); + } + if ($object->isInitialized('timezone') && null !== $object->getTimezone()) { + $data['timezone'] = $object->getTimezone(); + } + if ($object->isInitialized('hasAccessToAllFutureProjects') && null !== $object->getHasAccessToAllFutureProjects()) { + $data['has_access_to_all_future_projects'] = $object->getHasAccessToAllFutureProjects(); + } + if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { + $data['is_contractor'] = $object->getIsContractor(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { + $data['cost_rate'] = $object->getCostRate(); + } + if ($object->isInitialized('roles') && null !== $object->getRoles()) { + $values = []; + foreach ($object->getRoles() as $value) { + $values[] = $value; + } + $data['roles'] = $values; + } + if ($object->isInitialized('accessRoles') && null !== $object->getAccessRoles()) { + $values_1 = []; + foreach ($object->getAccessRoles() as $value_1) { + $values_1[] = $value_1; + } + $data['access_roles'] = $values_1; + } + if ($object->isInitialized('avatarUrl') && null !== $object->getAvatarUrl()) { + $data['avatar_url'] = $object->getAvatarUrl(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\User' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UserNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('id') && null !== $object->getId()) { - $data['id'] = $object->getId(); - } - if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { - $data['first_name'] = $object->getFirstName(); - } - if ($object->isInitialized('lastName') && null !== $object->getLastName()) { - $data['last_name'] = $object->getLastName(); - } - if ($object->isInitialized('email') && null !== $object->getEmail()) { - $data['email'] = $object->getEmail(); - } - if ($object->isInitialized('telephone') && null !== $object->getTelephone()) { - $data['telephone'] = $object->getTelephone(); - } - if ($object->isInitialized('timezone') && null !== $object->getTimezone()) { - $data['timezone'] = $object->getTimezone(); - } - if ($object->isInitialized('hasAccessToAllFutureProjects') && null !== $object->getHasAccessToAllFutureProjects()) { - $data['has_access_to_all_future_projects'] = $object->getHasAccessToAllFutureProjects(); - } - if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { - $data['is_contractor'] = $object->getIsContractor(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { - $data['weekly_capacity'] = $object->getWeeklyCapacity(); - } - if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { - $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\User' === $type; } - if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { - $data['cost_rate'] = $object->getCostRate(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\User' === $data::class; } - if ($object->isInitialized('roles') && null !== $object->getRoles()) { - $values = []; - foreach ($object->getRoles() as $value) { - $values[] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['roles'] = $values; - } - if ($object->isInitialized('accessRoles') && null !== $object->getAccessRoles()) { - $values_1 = []; - foreach ($object->getAccessRoles() as $value_1) { - $values_1[] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - $data['access_roles'] = $values_1; - } - if ($object->isInitialized('avatarUrl') && null !== $object->getAvatarUrl()) { - $data['avatar_url'] = $object->getAvatarUrl(); - } - if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { - $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { - $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; + $object = new \JoliCode\Harvest\Api\Model\User(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { + $data['cost_rate'] = (float) $data['cost_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('id', $data) && null !== $data['id']) { + $object->setId($data['id']); + unset($data['id']); + } elseif (\array_key_exists('id', $data) && null === $data['id']) { + $object->setId(null); + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('telephone', $data) && null !== $data['telephone']) { + $object->setTelephone($data['telephone']); + unset($data['telephone']); + } elseif (\array_key_exists('telephone', $data) && null === $data['telephone']) { + $object->setTelephone(null); + } + if (\array_key_exists('timezone', $data) && null !== $data['timezone']) { + $object->setTimezone($data['timezone']); + unset($data['timezone']); + } elseif (\array_key_exists('timezone', $data) && null === $data['timezone']) { + $object->setTimezone(null); + } + if (\array_key_exists('has_access_to_all_future_projects', $data) && null !== $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects($data['has_access_to_all_future_projects']); + unset($data['has_access_to_all_future_projects']); + } elseif (\array_key_exists('has_access_to_all_future_projects', $data) && null === $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects(null); + } + if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { + $object->setIsContractor($data['is_contractor']); + unset($data['is_contractor']); + } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { + $object->setIsContractor(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { + $object->setCostRate($data['cost_rate']); + unset($data['cost_rate']); + } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { + $object->setCostRate(null); + } + if (\array_key_exists('roles', $data) && null !== $data['roles']) { + $values = []; + foreach ($data['roles'] as $value) { + $values[] = $value; + } + $object->setRoles($values); + unset($data['roles']); + } elseif (\array_key_exists('roles', $data) && null === $data['roles']) { + $object->setRoles(null); + } + if (\array_key_exists('access_roles', $data) && null !== $data['access_roles']) { + $values_1 = []; + foreach ($data['access_roles'] as $value_1) { + $values_1[] = $value_1; + } + $object->setAccessRoles($values_1); + unset($data['access_roles']); + } elseif (\array_key_exists('access_roles', $data) && null === $data['access_roles']) { + $object->setAccessRoles(null); + } + if (\array_key_exists('avatar_url', $data) && null !== $data['avatar_url']) { + $object->setAvatarUrl($data['avatar_url']); + unset($data['avatar_url']); + } elseif (\array_key_exists('avatar_url', $data) && null === $data['avatar_url']) { + $object->setAvatarUrl(null); + } + if (\array_key_exists('created_at', $data) && null !== $data['created_at']) { + $object->setCreatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['created_at'])); + unset($data['created_at']); + } elseif (\array_key_exists('created_at', $data) && null === $data['created_at']) { + $object->setCreatedAt(null); + } + if (\array_key_exists('updated_at', $data) && null !== $data['updated_at']) { + $object->setUpdatedAt(\DateTime::createFromFormat('Y-m-d\\TH:i:s\\Z', $data['updated_at'])); + unset($data['updated_at']); + } elseif (\array_key_exists('updated_at', $data) && null === $data['updated_at']) { + $object->setUpdatedAt(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('id') && null !== $object->getId()) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { + $data['first_name'] = $object->getFirstName(); + } + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + if ($object->isInitialized('telephone') && null !== $object->getTelephone()) { + $data['telephone'] = $object->getTelephone(); + } + if ($object->isInitialized('timezone') && null !== $object->getTimezone()) { + $data['timezone'] = $object->getTimezone(); + } + if ($object->isInitialized('hasAccessToAllFutureProjects') && null !== $object->getHasAccessToAllFutureProjects()) { + $data['has_access_to_all_future_projects'] = $object->getHasAccessToAllFutureProjects(); + } + if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { + $data['is_contractor'] = $object->getIsContractor(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { + $data['cost_rate'] = $object->getCostRate(); + } + if ($object->isInitialized('roles') && null !== $object->getRoles()) { + $values = []; + foreach ($object->getRoles() as $value) { + $values[] = $value; + } + $data['roles'] = $values; + } + if ($object->isInitialized('accessRoles') && null !== $object->getAccessRoles()) { + $values_1 = []; + foreach ($object->getAccessRoles() as $value_1) { + $values_1[] = $value_1; + } + $data['access_roles'] = $values_1; + } + if ($object->isInitialized('avatarUrl') && null !== $object->getAvatarUrl()) { + $data['avatar_url'] = $object->getAvatarUrl(); + } + if ($object->isInitialized('createdAt') && null !== $object->getCreatedAt()) { + $data['created_at'] = $object->getCreatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + if ($object->isInitialized('updatedAt') && null !== $object->getUpdatedAt()) { + $data['updated_at'] = $object->getUpdatedAt()->format('Y-m-d\\TH:i:s\\Z'); + } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\User' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\User' => false]; + } } } diff --git a/generated/Normalizer/UsersNormalizer.php b/generated/Normalizer/UsersNormalizer.php index b04c4e4..d5c74e0 100644 --- a/generated/Normalizer/UsersNormalizer.php +++ b/generated/Normalizer/UsersNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,123 +22,228 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UsersNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\Users' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UsersNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Users' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Users' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Users' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\Users(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Users(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('users', $data)) { + $values = []; + foreach ($data['users'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\User', 'json', $context); + } + $object->setUsers($values); + unset($data['users']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); + } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('users', $data)) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['users'] as $value) { - $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\User', 'json', $context); + foreach ($object->getUsers() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } - $object->setUsers($values); - unset($data['users']); - } - if (\array_key_exists('per_page', $data)) { - $object->setPerPage($data['per_page']); - unset($data['per_page']); - } - if (\array_key_exists('total_pages', $data)) { - $object->setTotalPages($data['total_pages']); - unset($data['total_pages']); - } - if (\array_key_exists('total_entries', $data)) { - $object->setTotalEntries($data['total_entries']); - unset($data['total_entries']); - } - if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { - $object->setNextPage($data['next_page']); - unset($data['next_page']); - } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { - $object->setNextPage(null); - } - if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { - $object->setPreviousPage($data['previous_page']); - unset($data['previous_page']); - } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { - $object->setPreviousPage(null); - } - if (\array_key_exists('page', $data)) { - $object->setPage($data['page']); - unset($data['page']); - } - if (\array_key_exists('links', $data)) { - $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); - unset($data['links']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['users'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Users' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UsersNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getUsers() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\Users' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\Users' === $data::class; } - $data['users'] = $values; - $data['per_page'] = $object->getPerPage(); - $data['total_pages'] = $object->getTotalPages(); - $data['total_entries'] = $object->getTotalEntries(); - $data['next_page'] = $object->getNextPage(); - $data['previous_page'] = $object->getPreviousPage(); - $data['page'] = $object->getPage(); - $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\Users(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('users', $data)) { + $values = []; + foreach ($data['users'] as $value) { + $values[] = $this->denormalizer->denormalize($value, 'JoliCode\\Harvest\\Api\\Model\\User', 'json', $context); + } + $object->setUsers($values); + unset($data['users']); + } + if (\array_key_exists('per_page', $data)) { + $object->setPerPage($data['per_page']); + unset($data['per_page']); + } + if (\array_key_exists('total_pages', $data)) { + $object->setTotalPages($data['total_pages']); + unset($data['total_pages']); + } + if (\array_key_exists('total_entries', $data)) { + $object->setTotalEntries($data['total_entries']); + unset($data['total_entries']); + } + if (\array_key_exists('next_page', $data) && null !== $data['next_page']) { + $object->setNextPage($data['next_page']); + unset($data['next_page']); + } elseif (\array_key_exists('next_page', $data) && null === $data['next_page']) { + $object->setNextPage(null); } + if (\array_key_exists('previous_page', $data) && null !== $data['previous_page']) { + $object->setPreviousPage($data['previous_page']); + unset($data['previous_page']); + } elseif (\array_key_exists('previous_page', $data) && null === $data['previous_page']) { + $object->setPreviousPage(null); + } + if (\array_key_exists('page', $data)) { + $object->setPage($data['page']); + unset($data['page']); + } + if (\array_key_exists('links', $data)) { + $object->setLinks($this->denormalizer->denormalize($data['links'], 'JoliCode\\Harvest\\Api\\Model\\PaginationLinks', 'json', $context)); + unset($data['links']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getUsers() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['users'] = $values; + $data['per_page'] = $object->getPerPage(); + $data['total_pages'] = $object->getTotalPages(); + $data['total_entries'] = $object->getTotalEntries(); + $data['next_page'] = $object->getNextPage(); + $data['previous_page'] = $object->getPreviousPage(); + $data['page'] = $object->getPage(); + $data['links'] = $this->normalizer->normalize($object->getLinks(), 'json', $context); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\Users' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\Users' => false]; + } } } diff --git a/generated/Normalizer/UsersPostBodyNormalizer.php b/generated/Normalizer/UsersPostBodyNormalizer.php index 67784b1..32f41c2 100644 --- a/generated/Normalizer/UsersPostBodyNormalizer.php +++ b/generated/Normalizer/UsersPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,195 +22,372 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UsersPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UsersPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\UsersPostBody(); - if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { - $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; - } - if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { - $data['cost_rate'] = (float) $data['cost_rate']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UsersPostBody(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { + $data['cost_rate'] = (float) $data['cost_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('timezone', $data) && null !== $data['timezone']) { + $object->setTimezone($data['timezone']); + unset($data['timezone']); + } elseif (\array_key_exists('timezone', $data) && null === $data['timezone']) { + $object->setTimezone(null); + } + if (\array_key_exists('has_access_to_all_future_projects', $data) && null !== $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects($data['has_access_to_all_future_projects']); + unset($data['has_access_to_all_future_projects']); + } elseif (\array_key_exists('has_access_to_all_future_projects', $data) && null === $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects(null); + } + if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { + $object->setIsContractor($data['is_contractor']); + unset($data['is_contractor']); + } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { + $object->setIsContractor(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { + $object->setCostRate($data['cost_rate']); + unset($data['cost_rate']); + } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { + $object->setCostRate(null); + } + if (\array_key_exists('roles', $data) && null !== $data['roles']) { + $values = []; + foreach ($data['roles'] as $value) { + $values[] = $value; + } + $object->setRoles($values); + unset($data['roles']); + } elseif (\array_key_exists('roles', $data) && null === $data['roles']) { + $object->setRoles(null); + } + if (\array_key_exists('access_roles', $data) && null !== $data['access_roles']) { + $values_1 = []; + foreach ($data['access_roles'] as $value_1) { + $values_1[] = $value_1; + } + $object->setAccessRoles($values_1); + unset($data['access_roles']); + } elseif (\array_key_exists('access_roles', $data) && null === $data['access_roles']) { + $object->setAccessRoles(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } - if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { - $object->setFirstName($data['first_name']); - unset($data['first_name']); - } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { - $object->setFirstName(null); - } - if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { - $object->setLastName($data['last_name']); - unset($data['last_name']); - } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { - $object->setLastName(null); - } - if (\array_key_exists('email', $data) && null !== $data['email']) { - $object->setEmail($data['email']); - unset($data['email']); - } elseif (\array_key_exists('email', $data) && null === $data['email']) { - $object->setEmail(null); - } - if (\array_key_exists('timezone', $data) && null !== $data['timezone']) { - $object->setTimezone($data['timezone']); - unset($data['timezone']); - } elseif (\array_key_exists('timezone', $data) && null === $data['timezone']) { - $object->setTimezone(null); - } - if (\array_key_exists('has_access_to_all_future_projects', $data) && null !== $data['has_access_to_all_future_projects']) { - $object->setHasAccessToAllFutureProjects($data['has_access_to_all_future_projects']); - unset($data['has_access_to_all_future_projects']); - } elseif (\array_key_exists('has_access_to_all_future_projects', $data) && null === $data['has_access_to_all_future_projects']) { - $object->setHasAccessToAllFutureProjects(null); - } - if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { - $object->setIsContractor($data['is_contractor']); - unset($data['is_contractor']); - } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { - $object->setIsContractor(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { - $object->setWeeklyCapacity($data['weekly_capacity']); - unset($data['weekly_capacity']); - } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { - $object->setWeeklyCapacity(null); - } - if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { - $object->setDefaultHourlyRate($data['default_hourly_rate']); - unset($data['default_hourly_rate']); - } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { - $object->setDefaultHourlyRate(null); - } - if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { - $object->setCostRate($data['cost_rate']); - unset($data['cost_rate']); - } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { - $object->setCostRate(null); - } - if (\array_key_exists('roles', $data) && null !== $data['roles']) { - $values = []; - foreach ($data['roles'] as $value) { - $values[] = $value; - } - $object->setRoles($values); - unset($data['roles']); - } elseif (\array_key_exists('roles', $data) && null === $data['roles']) { - $object->setRoles(null); - } - if (\array_key_exists('access_roles', $data) && null !== $data['access_roles']) { - $values_1 = []; - foreach ($data['access_roles'] as $value_1) { - $values_1[] = $value_1; - } - $object->setAccessRoles($values_1); - unset($data['access_roles']); - } elseif (\array_key_exists('access_roles', $data) && null === $data['access_roles']) { - $object->setAccessRoles(null); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['first_name'] = $object->getFirstName(); + $data['last_name'] = $object->getLastName(); + $data['email'] = $object->getEmail(); + if ($object->isInitialized('timezone') && null !== $object->getTimezone()) { + $data['timezone'] = $object->getTimezone(); + } + if ($object->isInitialized('hasAccessToAllFutureProjects') && null !== $object->getHasAccessToAllFutureProjects()) { + $data['has_access_to_all_future_projects'] = $object->getHasAccessToAllFutureProjects(); + } + if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { + $data['is_contractor'] = $object->getIsContractor(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { + $data['cost_rate'] = $object->getCostRate(); } + if ($object->isInitialized('roles') && null !== $object->getRoles()) { + $values = []; + foreach ($object->getRoles() as $value) { + $values[] = $value; + } + $data['roles'] = $values; + } + if ($object->isInitialized('accessRoles') && null !== $object->getAccessRoles()) { + $values_1 = []; + foreach ($object->getAccessRoles() as $value_1) { + $values_1[] = $value_1; + } + $data['access_roles'] = $values_1; + } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UsersPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UsersPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['first_name'] = $object->getFirstName(); - $data['last_name'] = $object->getLastName(); - $data['email'] = $object->getEmail(); - if ($object->isInitialized('timezone') && null !== $object->getTimezone()) { - $data['timezone'] = $object->getTimezone(); - } - if ($object->isInitialized('hasAccessToAllFutureProjects') && null !== $object->getHasAccessToAllFutureProjects()) { - $data['has_access_to_all_future_projects'] = $object->getHasAccessToAllFutureProjects(); - } - if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { - $data['is_contractor'] = $object->getIsContractor(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { - $data['weekly_capacity'] = $object->getWeeklyCapacity(); - } - if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { - $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' === $type; } - if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { - $data['cost_rate'] = $object->getCostRate(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersPostBody' === $data::class; } - if ($object->isInitialized('roles') && null !== $object->getRoles()) { - $values = []; - foreach ($object->getRoles() as $value) { - $values[] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['roles'] = $values; - } - if ($object->isInitialized('accessRoles') && null !== $object->getAccessRoles()) { - $values_1 = []; - foreach ($object->getAccessRoles() as $value_1) { - $values_1[] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - $data['access_roles'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; + $object = new \JoliCode\Harvest\Api\Model\UsersPostBody(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { + $data['cost_rate'] = (float) $data['cost_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('timezone', $data) && null !== $data['timezone']) { + $object->setTimezone($data['timezone']); + unset($data['timezone']); + } elseif (\array_key_exists('timezone', $data) && null === $data['timezone']) { + $object->setTimezone(null); + } + if (\array_key_exists('has_access_to_all_future_projects', $data) && null !== $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects($data['has_access_to_all_future_projects']); + unset($data['has_access_to_all_future_projects']); + } elseif (\array_key_exists('has_access_to_all_future_projects', $data) && null === $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects(null); + } + if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { + $object->setIsContractor($data['is_contractor']); + unset($data['is_contractor']); + } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { + $object->setIsContractor(null); } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { + $object->setCostRate($data['cost_rate']); + unset($data['cost_rate']); + } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { + $object->setCostRate(null); + } + if (\array_key_exists('roles', $data) && null !== $data['roles']) { + $values = []; + foreach ($data['roles'] as $value) { + $values[] = $value; + } + $object->setRoles($values); + unset($data['roles']); + } elseif (\array_key_exists('roles', $data) && null === $data['roles']) { + $object->setRoles(null); + } + if (\array_key_exists('access_roles', $data) && null !== $data['access_roles']) { + $values_1 = []; + foreach ($data['access_roles'] as $value_1) { + $values_1[] = $value_1; + } + $object->setAccessRoles($values_1); + unset($data['access_roles']); + } elseif (\array_key_exists('access_roles', $data) && null === $data['access_roles']) { + $object->setAccessRoles(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['first_name'] = $object->getFirstName(); + $data['last_name'] = $object->getLastName(); + $data['email'] = $object->getEmail(); + if ($object->isInitialized('timezone') && null !== $object->getTimezone()) { + $data['timezone'] = $object->getTimezone(); + } + if ($object->isInitialized('hasAccessToAllFutureProjects') && null !== $object->getHasAccessToAllFutureProjects()) { + $data['has_access_to_all_future_projects'] = $object->getHasAccessToAllFutureProjects(); + } + if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { + $data['is_contractor'] = $object->getIsContractor(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { + $data['cost_rate'] = $object->getCostRate(); + } + if ($object->isInitialized('roles') && null !== $object->getRoles()) { + $values = []; + foreach ($object->getRoles() as $value) { + $values[] = $value; + } + $data['roles'] = $values; + } + if ($object->isInitialized('accessRoles') && null !== $object->getAccessRoles()) { + $values_1 = []; + foreach ($object->getAccessRoles() as $value_1) { + $values_1[] = $value_1; + } + $data['access_roles'] = $values_1; + } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UsersPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UsersPostBody' => false]; + } } } diff --git a/generated/Normalizer/UsersUserIdBillableRatesPostBodyNormalizer.php b/generated/Normalizer/UsersUserIdBillableRatesPostBodyNormalizer.php index 8d22e5a..2ca7b50 100644 --- a/generated/Normalizer/UsersUserIdBillableRatesPostBodyNormalizer.php +++ b/generated/Normalizer/UsersUserIdBillableRatesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,90 +22,162 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UsersUserIdBillableRatesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UsersUserIdBillableRatesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\UsersUserIdBillableRatesPostBody(); - if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { - $data['amount'] = (float) $data['amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UsersUserIdBillableRatesPostBody(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { + $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); + unset($data['start_date']); + } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { + $object->setStartDate(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('amount', $data) && null !== $data['amount']) { - $object->setAmount($data['amount']); - unset($data['amount']); - } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { - $object->setAmount(null); - } - if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { - $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); - unset($data['start_date']); - } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { - $object->setStartDate(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['amount'] = $object->getAmount(); + if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { + $data['start_date'] = $object->getStartDate()->format('Y-m-d'); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UsersUserIdBillableRatesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['amount'] = $object->getAmount(); - if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { - $data['start_date'] = $object->getStartDate()->format('Y-m-d'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' === $type; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' === $data::class; + } + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UsersUserIdBillableRatesPostBody(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { + $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); + unset($data['start_date']); + } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { + $object->setStartDate(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['amount'] = $object->getAmount(); + if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { + $data['start_date'] = $object->getStartDate()->format('Y-m-d'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdBillableRatesPostBody' => false]; + } } } diff --git a/generated/Normalizer/UsersUserIdCostRatesPostBodyNormalizer.php b/generated/Normalizer/UsersUserIdCostRatesPostBodyNormalizer.php index 7f57417..3061082 100644 --- a/generated/Normalizer/UsersUserIdCostRatesPostBodyNormalizer.php +++ b/generated/Normalizer/UsersUserIdCostRatesPostBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,90 +22,162 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UsersUserIdCostRatesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool - { - return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UsersUserIdCostRatesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); - } - $object = new \JoliCode\Harvest\Api\Model\UsersUserIdCostRatesPostBody(); - if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { - $data['amount'] = (float) $data['amount']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UsersUserIdCostRatesPostBody(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { + $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); + unset($data['start_date']); + } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { + $object->setStartDate(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; } - if (\array_key_exists('amount', $data) && null !== $data['amount']) { - $object->setAmount($data['amount']); - unset($data['amount']); - } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { - $object->setAmount(null); - } - if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { - $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); - unset($data['start_date']); - } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { - $object->setStartDate(null); - } - foreach ($data as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + $data['amount'] = $object->getAmount(); + if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { + $data['start_date'] = $object->getStartDate()->format('Y-m-d'); } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UsersUserIdCostRatesPostBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $data['amount'] = $object->getAmount(); - if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { - $data['start_date'] = $object->getStartDate()->format('Y-m-d'); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' === $type; } - foreach ($object as $key => $value) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' === $data::class; + } + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UsersUserIdCostRatesPostBody(); + if (\array_key_exists('amount', $data) && \is_int($data['amount'])) { + $data['amount'] = (float) $data['amount']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('amount', $data) && null !== $data['amount']) { + $object->setAmount($data['amount']); + unset($data['amount']); + } elseif (\array_key_exists('amount', $data) && null === $data['amount']) { + $object->setAmount(null); + } + if (\array_key_exists('start_date', $data) && null !== $data['start_date']) { + $object->setStartDate(\DateTime::createFromFormat('Y-m-d', $data['start_date'])->setTime(0, 0, 0)); + unset($data['start_date']); + } elseif (\array_key_exists('start_date', $data) && null === $data['start_date']) { + $object->setStartDate(null); } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['amount'] = $object->getAmount(); + if ($object->isInitialized('startDate') && null !== $object->getStartDate()) { + $data['start_date'] = $object->getStartDate()->format('Y-m-d'); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdCostRatesPostBody' => false]; + } } } diff --git a/generated/Normalizer/UsersUserIdPatchBodyNormalizer.php b/generated/Normalizer/UsersUserIdPatchBodyNormalizer.php index 0012995..49954f4 100644 --- a/generated/Normalizer/UsersUserIdPatchBodyNormalizer.php +++ b/generated/Normalizer/UsersUserIdPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,201 +22,384 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UsersUserIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UsersUserIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' === $type; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' === $data::class; - } - - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); - } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' === $type; } - $object = new \JoliCode\Harvest\Api\Model\UsersUserIdPatchBody(); - if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { - $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; - } - if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { - $data['cost_rate'] = (float) $data['cost_rate']; + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' === $data::class; } - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UsersUserIdPatchBody(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { + $data['cost_rate'] = (float) $data['cost_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('timezone', $data) && null !== $data['timezone']) { + $object->setTimezone($data['timezone']); + unset($data['timezone']); + } elseif (\array_key_exists('timezone', $data) && null === $data['timezone']) { + $object->setTimezone(null); + } + if (\array_key_exists('has_access_to_all_future_projects', $data) && null !== $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects($data['has_access_to_all_future_projects']); + unset($data['has_access_to_all_future_projects']); + } elseif (\array_key_exists('has_access_to_all_future_projects', $data) && null === $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects(null); + } + if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { + $object->setIsContractor($data['is_contractor']); + unset($data['is_contractor']); + } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { + $object->setIsContractor(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); + } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { + $object->setCostRate($data['cost_rate']); + unset($data['cost_rate']); + } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { + $object->setCostRate(null); + } + if (\array_key_exists('roles', $data) && null !== $data['roles']) { + $values = []; + foreach ($data['roles'] as $value) { + $values[] = $value; + } + $object->setRoles($values); + unset($data['roles']); + } elseif (\array_key_exists('roles', $data) && null === $data['roles']) { + $object->setRoles(null); + } + if (\array_key_exists('access_roles', $data) && null !== $data['access_roles']) { + $values_1 = []; + foreach ($data['access_roles'] as $value_1) { + $values_1[] = $value_1; + } + $object->setAccessRoles($values_1); + unset($data['access_roles']); + } elseif (\array_key_exists('access_roles', $data) && null === $data['access_roles']) { + $object->setAccessRoles(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; } - if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { - $object->setFirstName($data['first_name']); - unset($data['first_name']); - } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { - $object->setFirstName(null); - } - if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { - $object->setLastName($data['last_name']); - unset($data['last_name']); - } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { - $object->setLastName(null); - } - if (\array_key_exists('email', $data) && null !== $data['email']) { - $object->setEmail($data['email']); - unset($data['email']); - } elseif (\array_key_exists('email', $data) && null === $data['email']) { - $object->setEmail(null); - } - if (\array_key_exists('timezone', $data) && null !== $data['timezone']) { - $object->setTimezone($data['timezone']); - unset($data['timezone']); - } elseif (\array_key_exists('timezone', $data) && null === $data['timezone']) { - $object->setTimezone(null); - } - if (\array_key_exists('has_access_to_all_future_projects', $data) && null !== $data['has_access_to_all_future_projects']) { - $object->setHasAccessToAllFutureProjects($data['has_access_to_all_future_projects']); - unset($data['has_access_to_all_future_projects']); - } elseif (\array_key_exists('has_access_to_all_future_projects', $data) && null === $data['has_access_to_all_future_projects']) { - $object->setHasAccessToAllFutureProjects(null); - } - if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { - $object->setIsContractor($data['is_contractor']); - unset($data['is_contractor']); - } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { - $object->setIsContractor(null); - } - if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { - $object->setIsActive($data['is_active']); - unset($data['is_active']); - } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { - $object->setIsActive(null); - } - if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { - $object->setWeeklyCapacity($data['weekly_capacity']); - unset($data['weekly_capacity']); - } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { - $object->setWeeklyCapacity(null); - } - if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { - $object->setDefaultHourlyRate($data['default_hourly_rate']); - unset($data['default_hourly_rate']); - } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { - $object->setDefaultHourlyRate(null); - } - if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { - $object->setCostRate($data['cost_rate']); - unset($data['cost_rate']); - } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { - $object->setCostRate(null); - } - if (\array_key_exists('roles', $data) && null !== $data['roles']) { - $values = []; - foreach ($data['roles'] as $value) { - $values[] = $value; - } - $object->setRoles($values); - unset($data['roles']); - } elseif (\array_key_exists('roles', $data) && null === $data['roles']) { - $object->setRoles(null); - } - if (\array_key_exists('access_roles', $data) && null !== $data['access_roles']) { - $values_1 = []; - foreach ($data['access_roles'] as $value_1) { - $values_1[] = $value_1; - } - $object->setAccessRoles($values_1); - unset($data['access_roles']); - } elseif (\array_key_exists('access_roles', $data) && null === $data['access_roles']) { - $object->setAccessRoles(null); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; + if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { + $data['first_name'] = $object->getFirstName(); + } + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + if ($object->isInitialized('timezone') && null !== $object->getTimezone()) { + $data['timezone'] = $object->getTimezone(); + } + if ($object->isInitialized('hasAccessToAllFutureProjects') && null !== $object->getHasAccessToAllFutureProjects()) { + $data['has_access_to_all_future_projects'] = $object->getHasAccessToAllFutureProjects(); + } + if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { + $data['is_contractor'] = $object->getIsContractor(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { + $data['cost_rate'] = $object->getCostRate(); + } + if ($object->isInitialized('roles') && null !== $object->getRoles()) { + $values = []; + foreach ($object->getRoles() as $value) { + $values[] = $value; + } + $data['roles'] = $values; + } + if ($object->isInitialized('accessRoles') && null !== $object->getAccessRoles()) { + $values_1 = []; + foreach ($object->getAccessRoles() as $value_1) { + $values_1[] = $value_1; + } + $data['access_roles'] = $values_1; } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UsersUserIdPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { - $data['first_name'] = $object->getFirstName(); - } - if ($object->isInitialized('lastName') && null !== $object->getLastName()) { - $data['last_name'] = $object->getLastName(); - } - if ($object->isInitialized('email') && null !== $object->getEmail()) { - $data['email'] = $object->getEmail(); - } - if ($object->isInitialized('timezone') && null !== $object->getTimezone()) { - $data['timezone'] = $object->getTimezone(); - } - if ($object->isInitialized('hasAccessToAllFutureProjects') && null !== $object->getHasAccessToAllFutureProjects()) { - $data['has_access_to_all_future_projects'] = $object->getHasAccessToAllFutureProjects(); - } - if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { - $data['is_contractor'] = $object->getIsContractor(); - } - if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { - $data['is_active'] = $object->getIsActive(); - } - if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { - $data['weekly_capacity'] = $object->getWeeklyCapacity(); - } - if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { - $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' === $type; } - if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { - $data['cost_rate'] = $object->getCostRate(); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' === $data::class; } - if ($object->isInitialized('roles') && null !== $object->getRoles()) { - $values = []; - foreach ($object->getRoles() as $value) { - $values[] = $value; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); } - $data['roles'] = $values; - } - if ($object->isInitialized('accessRoles') && null !== $object->getAccessRoles()) { - $values_1 = []; - foreach ($object->getAccessRoles() as $value_1) { - $values_1[] = $value_1; + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } - $data['access_roles'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; + $object = new \JoliCode\Harvest\Api\Model\UsersUserIdPatchBody(); + if (\array_key_exists('default_hourly_rate', $data) && \is_int($data['default_hourly_rate'])) { + $data['default_hourly_rate'] = (float) $data['default_hourly_rate']; + } + if (\array_key_exists('cost_rate', $data) && \is_int($data['cost_rate'])) { + $data['cost_rate'] = (float) $data['cost_rate']; + } + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('first_name', $data) && null !== $data['first_name']) { + $object->setFirstName($data['first_name']); + unset($data['first_name']); + } elseif (\array_key_exists('first_name', $data) && null === $data['first_name']) { + $object->setFirstName(null); + } + if (\array_key_exists('last_name', $data) && null !== $data['last_name']) { + $object->setLastName($data['last_name']); + unset($data['last_name']); + } elseif (\array_key_exists('last_name', $data) && null === $data['last_name']) { + $object->setLastName(null); + } + if (\array_key_exists('email', $data) && null !== $data['email']) { + $object->setEmail($data['email']); + unset($data['email']); + } elseif (\array_key_exists('email', $data) && null === $data['email']) { + $object->setEmail(null); + } + if (\array_key_exists('timezone', $data) && null !== $data['timezone']) { + $object->setTimezone($data['timezone']); + unset($data['timezone']); + } elseif (\array_key_exists('timezone', $data) && null === $data['timezone']) { + $object->setTimezone(null); + } + if (\array_key_exists('has_access_to_all_future_projects', $data) && null !== $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects($data['has_access_to_all_future_projects']); + unset($data['has_access_to_all_future_projects']); + } elseif (\array_key_exists('has_access_to_all_future_projects', $data) && null === $data['has_access_to_all_future_projects']) { + $object->setHasAccessToAllFutureProjects(null); + } + if (\array_key_exists('is_contractor', $data) && null !== $data['is_contractor']) { + $object->setIsContractor($data['is_contractor']); + unset($data['is_contractor']); + } elseif (\array_key_exists('is_contractor', $data) && null === $data['is_contractor']) { + $object->setIsContractor(null); + } + if (\array_key_exists('is_active', $data) && null !== $data['is_active']) { + $object->setIsActive($data['is_active']); + unset($data['is_active']); + } elseif (\array_key_exists('is_active', $data) && null === $data['is_active']) { + $object->setIsActive(null); } + if (\array_key_exists('weekly_capacity', $data) && null !== $data['weekly_capacity']) { + $object->setWeeklyCapacity($data['weekly_capacity']); + unset($data['weekly_capacity']); + } elseif (\array_key_exists('weekly_capacity', $data) && null === $data['weekly_capacity']) { + $object->setWeeklyCapacity(null); + } + if (\array_key_exists('default_hourly_rate', $data) && null !== $data['default_hourly_rate']) { + $object->setDefaultHourlyRate($data['default_hourly_rate']); + unset($data['default_hourly_rate']); + } elseif (\array_key_exists('default_hourly_rate', $data) && null === $data['default_hourly_rate']) { + $object->setDefaultHourlyRate(null); + } + if (\array_key_exists('cost_rate', $data) && null !== $data['cost_rate']) { + $object->setCostRate($data['cost_rate']); + unset($data['cost_rate']); + } elseif (\array_key_exists('cost_rate', $data) && null === $data['cost_rate']) { + $object->setCostRate(null); + } + if (\array_key_exists('roles', $data) && null !== $data['roles']) { + $values = []; + foreach ($data['roles'] as $value) { + $values[] = $value; + } + $object->setRoles($values); + unset($data['roles']); + } elseif (\array_key_exists('roles', $data) && null === $data['roles']) { + $object->setRoles(null); + } + if (\array_key_exists('access_roles', $data) && null !== $data['access_roles']) { + $values_1 = []; + foreach ($data['access_roles'] as $value_1) { + $values_1[] = $value_1; + } + $object->setAccessRoles($values_1); + unset($data['access_roles']); + } elseif (\array_key_exists('access_roles', $data) && null === $data['access_roles']) { + $object->setAccessRoles(null); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('firstName') && null !== $object->getFirstName()) { + $data['first_name'] = $object->getFirstName(); + } + if ($object->isInitialized('lastName') && null !== $object->getLastName()) { + $data['last_name'] = $object->getLastName(); + } + if ($object->isInitialized('email') && null !== $object->getEmail()) { + $data['email'] = $object->getEmail(); + } + if ($object->isInitialized('timezone') && null !== $object->getTimezone()) { + $data['timezone'] = $object->getTimezone(); + } + if ($object->isInitialized('hasAccessToAllFutureProjects') && null !== $object->getHasAccessToAllFutureProjects()) { + $data['has_access_to_all_future_projects'] = $object->getHasAccessToAllFutureProjects(); + } + if ($object->isInitialized('isContractor') && null !== $object->getIsContractor()) { + $data['is_contractor'] = $object->getIsContractor(); + } + if ($object->isInitialized('isActive') && null !== $object->getIsActive()) { + $data['is_active'] = $object->getIsActive(); + } + if ($object->isInitialized('weeklyCapacity') && null !== $object->getWeeklyCapacity()) { + $data['weekly_capacity'] = $object->getWeeklyCapacity(); + } + if ($object->isInitialized('defaultHourlyRate') && null !== $object->getDefaultHourlyRate()) { + $data['default_hourly_rate'] = $object->getDefaultHourlyRate(); + } + if ($object->isInitialized('costRate') && null !== $object->getCostRate()) { + $data['cost_rate'] = $object->getCostRate(); + } + if ($object->isInitialized('roles') && null !== $object->getRoles()) { + $values = []; + foreach ($object->getRoles() as $value) { + $values[] = $value; + } + $data['roles'] = $values; + } + if ($object->isInitialized('accessRoles') && null !== $object->getAccessRoles()) { + $values_1 = []; + foreach ($object->getAccessRoles() as $value_1) { + $values_1[] = $value_1; + } + $data['access_roles'] = $values_1; + } + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdPatchBody' => false]; + } } } diff --git a/generated/Normalizer/UsersUserIdTeammatesPatchBodyNormalizer.php b/generated/Normalizer/UsersUserIdTeammatesPatchBodyNormalizer.php index fd1af34..fe7f525 100644 --- a/generated/Normalizer/UsersUserIdTeammatesPatchBodyNormalizer.php +++ b/generated/Normalizer/UsersUserIdTeammatesPatchBodyNormalizer.php @@ -14,6 +14,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use JoliCode\Harvest\Api\Runtime\Normalizer\CheckArray; use JoliCode\Harvest\Api\Runtime\Normalizer\ValidatorTrait; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; @@ -21,86 +22,154 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class UsersUserIdTeammatesPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface -{ - use CheckArray; - use DenormalizerAwareTrait; - use NormalizerAwareTrait; - use ValidatorTrait; - - public function supportsDenormalization($data, $type, $format = null, array $context = []): bool +if (!class_exists(Kernel::class) || (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4)) { + class UsersUserIdTeammatesPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' === $type; - } - - public function supportsNormalization($data, $format = null, array $context = []): bool - { - return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' === $data::class; - } + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; - /** - * @param mixed $data - * @param mixed $class - * @param mixed|null $format - * - * @return mixed - */ - public function denormalize($data, $class, $format = null, array $context = []) - { - if (isset($data['$ref'])) { - return new Reference($data['$ref'], $context['document-origin']); + public function supportsDenormalization(mixed $data, string $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' === $type; } - if (isset($data['$recursiveRef'])) { - return new Reference($data['$recursiveRef'], $context['document-origin']); + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' === $data::class; } - $object = new \JoliCode\Harvest\Api\Model\UsersUserIdTeammatesPatchBody(); - if (null === $data || false === \is_array($data)) { + + public function denormalize(mixed $data, string $type, ?string $format = null, array $context = []): mixed + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); + } + $object = new \JoliCode\Harvest\Api\Model\UsersUserIdTeammatesPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('teammate_ids', $data) && null !== $data['teammate_ids']) { + $values = []; + foreach ($data['teammate_ids'] as $value) { + $values[] = $value; + } + $object->setTeammateIds($values); + unset($data['teammate_ids']); + } elseif (\array_key_exists('teammate_ids', $data) && null === $data['teammate_ids']) { + $object->setTeammateIds(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; } - if (\array_key_exists('teammate_ids', $data) && null !== $data['teammate_ids']) { + + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $data = []; $values = []; - foreach ($data['teammate_ids'] as $value) { + foreach ($object->getTeammateIds() as $value) { $values[] = $value; } - $object->setTeammateIds($values); - unset($data['teammate_ids']); - } elseif (\array_key_exists('teammate_ids', $data) && null === $data['teammate_ids']) { - $object->setTeammateIds(null); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $data['teammate_ids'] = $values; + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } } + + return $data; } - return $object; + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' => false]; + } } - - /** - * @param mixed $object - * @param mixed|null $format - * - * @return array|string|int|float|bool|\ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) +} else { + class UsersUserIdTeammatesPatchBodyNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { - $data = []; - $values = []; - foreach ($object->getTeammateIds() as $value) { - $values[] = $value; + use CheckArray; + use DenormalizerAwareTrait; + use NormalizerAwareTrait; + use ValidatorTrait; + + public function supportsDenormalization($data, $type, ?string $format = null, array $context = []): bool + { + return 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' === $type; + } + + public function supportsNormalization(mixed $data, ?string $format = null, array $context = []): bool + { + return \is_object($data) && 'JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' === $data::class; } - $data['teammate_ids'] = $values; - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + + /** + * @param mixed|null $format + */ + public function denormalize($data, $type, $format = null, array $context = []) + { + if (isset($data['$ref'])) { + return new Reference($data['$ref'], $context['document-origin']); + } + if (isset($data['$recursiveRef'])) { + return new Reference($data['$recursiveRef'], $context['document-origin']); } + $object = new \JoliCode\Harvest\Api\Model\UsersUserIdTeammatesPatchBody(); + if (null === $data || false === \is_array($data)) { + return $object; + } + if (\array_key_exists('teammate_ids', $data) && null !== $data['teammate_ids']) { + $values = []; + foreach ($data['teammate_ids'] as $value) { + $values[] = $value; + } + $object->setTeammateIds($values); + unset($data['teammate_ids']); + } elseif (\array_key_exists('teammate_ids', $data) && null === $data['teammate_ids']) { + $object->setTeammateIds(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + + return $object; } - return $data; - } + /** + * @param mixed|null $format + * + * @return array|string|int|float|bool|\ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getTeammateIds() as $value) { + $values[] = $value; + } + $data['teammate_ids'] = $values; + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } - public function getSupportedTypes(string $format = null): array - { - return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' => false]; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return ['JoliCode\\Harvest\\Api\\Model\\UsersUserIdTeammatesPatchBody' => false]; + } } } diff --git a/generated/Runtime/Client/BaseEndpoint.php b/generated/Runtime/Client/BaseEndpoint.php index de5bac0..2076b21 100644 --- a/generated/Runtime/Client/BaseEndpoint.php +++ b/generated/Runtime/Client/BaseEndpoint.php @@ -18,6 +18,7 @@ abstract class BaseEndpoint implements Endpoint { + protected $formParameters = []; protected $queryParameters = []; protected $headerParameters = []; protected $body; @@ -45,7 +46,7 @@ public function getHeaders(array $baseHeaders = []): array return array_merge($this->getExtraHeaders(), $baseHeaders, $this->getHeadersOptionsResolver()->resolve($this->headerParameters)); } - abstract protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, string $contentType = null); + abstract protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null); protected function getExtraHeaders(): array { diff --git a/generated/Runtime/Client/Client.php b/generated/Runtime/Client/Client.php index 20c88fe..65df529 100644 --- a/generated/Runtime/Client/Client.php +++ b/generated/Runtime/Client/Client.php @@ -84,7 +84,7 @@ private function processEndpoint(Endpoint $endpoint): ResponseInterface } } foreach ($endpoint->getHeaders($bodyHeaders) as $name => $value) { - $request = $request->withHeader($name, $value); + $request = $request->withHeader($name, !\is_bool($value) ? $value : ($value ? 'true' : 'false')); } if (\count($endpoint->getAuthenticationScopes()) > 0) { $scopes = []; diff --git a/generated/Runtime/Client/EndpointTrait.php b/generated/Runtime/Client/EndpointTrait.php index e6f566d..bfec90e 100644 --- a/generated/Runtime/Client/EndpointTrait.php +++ b/generated/Runtime/Client/EndpointTrait.php @@ -23,5 +23,5 @@ public function parseResponse(ResponseInterface $response, SerializerInterface $ return $this->transformResponseBody($response, $serializer, $contentType); } - abstract protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, string $contentType = null); + abstract protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null); } diff --git a/generated/Runtime/Normalizer/ReferenceNormalizer.php b/generated/Runtime/Normalizer/ReferenceNormalizer.php index 0ef54aa..2061427 100644 --- a/generated/Runtime/Normalizer/ReferenceNormalizer.php +++ b/generated/Runtime/Normalizer/ReferenceNormalizer.php @@ -12,20 +12,39 @@ namespace JoliCode\Harvest\Api\Runtime\Normalizer; use Jane\Component\JsonSchemaRuntime\Reference; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ReferenceNormalizer implements NormalizerInterface -{ - public function normalize($object, $format = null, array $context = []) +if (Kernel::MAJOR_VERSION >= 7 || Kernel::MAJOR_VERSION === 6 && Kernel::MINOR_VERSION === 4) { + class ReferenceNormalizer implements NormalizerInterface { - $ref = []; - $ref['$ref'] = (string) $object->getReferenceUri(); + public function normalize(mixed $object, ?string $format = null, array $context = []): array|string|int|float|bool|\ArrayObject|null + { + $ref = []; + $ref['$ref'] = (string) $object->getReferenceUri(); - return $ref; - } + return $ref; + } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null): bool + { + return $data instanceof Reference; + } + } +} else { + class ReferenceNormalizer implements NormalizerInterface { - return $data instanceof Reference; + public function normalize($object, $format = null, array $context = []) + { + $ref = []; + $ref['$ref'] = (string) $object->getReferenceUri(); + + return $ref; + } + + public function supportsNormalization($data, $format = null): bool + { + return $data instanceof Reference; + } } } diff --git a/generated/Runtime/Normalizer/ValidatorTrait.php b/generated/Runtime/Normalizer/ValidatorTrait.php index c6913be..f3f8835 100644 --- a/generated/Runtime/Normalizer/ValidatorTrait.php +++ b/generated/Runtime/Normalizer/ValidatorTrait.php @@ -12,12 +12,13 @@ namespace JoliCode\Harvest\Api\Runtime\Normalizer; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Validation; trait ValidatorTrait { protected function validate(array $data, Constraint $constraint): void { - $validator = \Symfony\Component\Validator\Validation::createValidator(); + $validator = Validation::createValidator(); $violations = $validator->validate($data, $constraint); if ($violations->count() > 0) { throw new ValidationException($violations); diff --git a/src/ClientFactory.php b/src/ClientFactory.php index 921199b..cff615c 100644 --- a/src/ClientFactory.php +++ b/src/ClientFactory.php @@ -20,7 +20,7 @@ class ClientFactory { - public static function create(string $token, string $accountId, ClientInterface $httpClient = null): Client + public static function create(string $token, string $accountId, ?ClientInterface $httpClient = null): Client { return Client::create($httpClient, [ new HeaderAppendPlugin([ diff --git a/tools/php-cs-fixer/.gitignore b/tools/php-cs-fixer/.gitignore new file mode 100644 index 0000000..57872d0 --- /dev/null +++ b/tools/php-cs-fixer/.gitignore @@ -0,0 +1 @@ +/vendor/ diff --git a/tools/php-cs-fixer/castor.php b/tools/php-cs-fixer/castor.php new file mode 100644 index 0000000..0be75fc --- /dev/null +++ b/tools/php-cs-fixer/castor.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace qa; + +use Castor\Attribute\AsOption; +use Castor\Attribute\AsTask; + +use function Castor\run; + +#[AsTask(description: 'Fix CS', aliases: ['cs'])] +function cs( + #[AsOption(description: 'Only shows which files would have been modified.')] + bool $dryRun, +): int { + $command = [__DIR__.'/vendor/bin/php-cs-fixer', 'fix', '--config', \dirname(__DIR__, 2).'/.php-cs-fixer.php']; + + if ($dryRun) { + $command[] = '--dry-run'; + } + + return run($command, allowFailure: true)->getExitCode(); +} + +#[AsTask(description: 'Update php-cs-fixer')] +function update(): int +{ + $command = ['composer', 'update', '-o', '--working-dir', __DIR__]; + + return run($command)->getExitCode(); +} diff --git a/tools/php-cs-fixer/composer.json b/tools/php-cs-fixer/composer.json new file mode 100644 index 0000000..4588c00 --- /dev/null +++ b/tools/php-cs-fixer/composer.json @@ -0,0 +1,5 @@ +{ + "require": { + "friendsofphp/php-cs-fixer": "^3.52.1" + } +}