Skip to content

Commit

Permalink
Apply php-cs-fixer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon authored and github-actions[bot] committed Apr 12, 2024
1 parent 388a8b9 commit f0d4db5
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 27 deletions.
7 changes: 3 additions & 4 deletions src/Controller/Api/Assets/CollectionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@

use OpenApi\Attributes\Get;
use OpenApi\Attributes\JsonContent;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\PathIncludeDescendantsParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\PathIncludeParentParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\PathParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\ExcludeFoldersParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\IdSearchTermParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\PageParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\PageSizeParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\ParentIdParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\PathIncludeDescendantsParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\PathIncludeParentParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Parameters\Query\PathParameter;
use Pimcore\Bundle\StudioApiBundle\Attributes\Response\SuccessResponse;
use Pimcore\Bundle\StudioApiBundle\Attributes\Response\UnauthorizedResponse;
use Pimcore\Bundle\StudioApiBundle\Controller\Api\AbstractApiController;
Expand Down Expand Up @@ -55,7 +55,6 @@ public function __construct(
parent::__construct($serializer);
}


#[Route('/assets', name: 'pimcore_studio_api_assets', methods: ['GET'])]
//#[IsGranted('STUDIO_API')]
#[GET(
Expand Down
3 changes: 1 addition & 2 deletions src/Exception/InvalidQueryTypeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@

final class InvalidQueryTypeException extends Exception
{

}
}
2 changes: 1 addition & 1 deletion src/Factory/QueryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@ public function create(string $type): QueryInterface
default => throw new InvalidQueryTypeException("Unknown query type: $type")
};
}
}
}
2 changes: 1 addition & 1 deletion src/Factory/QueryFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ interface QueryFactoryInterface
* @throws InvalidQueryTypeException
*/
public function create(string $type): QueryInterface;
}
}
1 change: 1 addition & 0 deletions src/Filter/ExcludeFolderFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function apply(Collection $collection, QueryInterface $query): mixed
if(!$excludeFolders) {
return $query;
}

/** @var AssetQuery $query */
return $query->excludeFolders();
}
Expand Down
15 changes: 14 additions & 1 deletion src/Filter/FilterInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<?php

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioApiBundle\Filter;

use Pimcore\Bundle\StudioApiBundle\Dto\Collection;
Expand All @@ -8,4 +21,4 @@
interface FilterInterface
{
public function apply(Collection $collection, QueryInterface $query): mixed;
}
}
3 changes: 1 addition & 2 deletions src/Filter/PageFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@

final class PageFilter implements FilterInterface
{

public function apply(Collection $collection, QueryInterface $query): mixed
{
return $query->setPage($collection->getPage());
}
}
}
3 changes: 1 addition & 2 deletions src/Filter/PageSizeFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@

final class PageSizeFilter implements FilterInterface
{

public function apply(Collection $collection, QueryInterface $query): mixed
{
return $query->setPageSize($collection->getPageSize());
}
}
}
7 changes: 5 additions & 2 deletions src/Service/Filter/FilterLoaderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@
/**
* Pimcore
*
* This source file is available under following license:
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license PCL
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioApiBundle\Service\Filter;
Expand Down
16 changes: 8 additions & 8 deletions src/Service/Filter/FilterService.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@
public function __construct(
private FilterLoaderInterface $filterLoader,
private QueryFactoryInterface $queryFactory
)
{
) {
}

/**
* @throws InvalidQueryTypeException
*/
public function applyCollectionFilter(Collection $collection, string $type): QueryInterface
{
$query = $this->queryFactory->create($type);
foreach ($this->filterLoader->loadFilters() as $filter) {
$query = $filter->apply($collection, $query);
}
return $query;
$query = $this->queryFactory->create($type);
foreach ($this->filterLoader->loadFilters() as $filter) {
$query = $filter->apply($collection, $query);
}

return $query;
}
}
}
2 changes: 1 addition & 1 deletion src/Service/Filter/FilterServiceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ interface FilterServiceInterface
* @throws InvalidQueryTypeException
*/
public function applyCollectionFilter(Collection $collection, string $type): QueryInterface;
}
}
15 changes: 14 additions & 1 deletion src/Service/GenericData/V1/QueryInterface.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<?php

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioApiBundle\Service\GenericData\V1;

use Pimcore\Bundle\GenericDataIndexBundle\Model\Search\Interfaces\SearchInterface;
Expand All @@ -19,4 +32,4 @@ public function setSearchTerm(?string $term): self;
public function excludeFolders(): self;

public function getSearch(): SearchInterface;
}
}
17 changes: 15 additions & 2 deletions tests/Unit/Service/Factory/QueryFactoryTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<?php

/**
* Pimcore
*
* This source file is available under two different licenses:
* - GNU General Public License version 3 (GPLv3)
* - Pimcore Commercial License (PCL)
* Full copyright and license information is available in
* LICENSE.md which is distributed with this source code.
*
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)
* @license http://www.pimcore.org/license GPLv3 and PCL
*/

namespace Pimcore\Bundle\StudioApiBundle\Tests\Unit\Service\Factory;

use Codeception\Test\Unit;
Expand Down Expand Up @@ -43,7 +56,7 @@ private function mockAssetAdapterInterface(): AssetQueryProviderInterface
return $this->makeEmpty(AssetQueryProviderInterface::class, [
'createAssetQuery' => function () {
return new AssetQuery($this->makeEmpty(SearchInterface::class));
}
},
]);
}
}
}

0 comments on commit f0d4db5

Please sign in to comment.