partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 46e53452aafe1ce77c8298ef1905d13b06e104e0
parent e8556ddae4656ed97d2006a4aed99bbe546ef0a7
Author: Felicia Hummel <felicia@partkeepr.com>
Date:   Mon, 30 Jan 2017 15:45:56 +0100

Make styleci happy

Diffstat:
Msrc/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108122512.php | 1-
Msrc/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108143802.php | 5++---
Msrc/PartKeepr/CoreBundle/DoctrineMigrations/Version20170113203042.php | 5++---
Msrc/PartKeepr/DoctrineReflectionBundle/Services/FilterService.php | 7++++---
Msrc/PartKeepr/PartBundle/Action/GetPartsAction.php | 8++++----
Msrc/PartKeepr/PartBundle/Controller/PartController.php | 2+-
Msrc/PartKeepr/PartBundle/DataFixtures/PartDataLoader.php | 2+-
Msrc/PartKeepr/PartBundle/Entity/MetaPartParameterCriteria.php | 2+-
Msrc/PartKeepr/PartBundle/Entity/Part.php | 8++++----
Msrc/PartKeepr/PartBundle/Entity/PartParameter.php | 9+++++----
Msrc/PartKeepr/PartBundle/Exceptions/NotAMetaPartException.php | 3++-
Msrc/PartKeepr/PartBundle/Services/PartService.php | 4++--
Msrc/PartKeepr/PartBundle/Tests/MetaPartTest.php | 7++++---
Msrc/PartKeepr/ProjectBundle/Controller/ProjectReportController.php | 5+----
Msrc/PartKeepr/ProjectBundle/Entity/ProjectPart.php | 9+++++----
Msrc/PartKeepr/ProjectBundle/Entity/ProjectRun.php | 15++++++++-------
Msrc/PartKeepr/ProjectBundle/Entity/ProjectRunPart.php | 10+++++-----
Msrc/PartKeepr/ProjectBundle/Tests/ProjectTest.php | 21+++++++++++----------
18 files changed, 62 insertions(+), 61 deletions(-)

diff --git a/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108122512.php b/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108122512.php @@ -2,7 +2,6 @@ namespace PartKeepr\CoreBundle\DoctrineMigrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; /** diff --git a/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108143802.php b/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170108143802.php @@ -2,15 +2,14 @@ namespace PartKeepr\CoreBundle\DoctrineMigrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; /** - * Updates the value type to "numeric" where no value type is set + * Updates the value type to "numeric" where no value type is set. */ class Version20170108143802 extends BaseMigration { -/** + /** * @param Schema $schema */ public function up(Schema $schema) diff --git a/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170113203042.php b/src/PartKeepr/CoreBundle/DoctrineMigrations/Version20170113203042.php @@ -2,15 +2,14 @@ namespace PartKeepr\CoreBundle\DoctrineMigrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; /** - * Auto-generated Migration: Please modify to your needs! + * Sets overageType to a sane default */ class Version20170113203042 extends BaseMigration { -/** + /** * @param Schema $schema */ public function up(Schema $schema) diff --git a/src/PartKeepr/DoctrineReflectionBundle/Services/FilterService.php b/src/PartKeepr/DoctrineReflectionBundle/Services/FilterService.php @@ -10,7 +10,7 @@ class FilterService /** * @var EntityManager */ - var $em; + private $em; public function __construct(Registry $registry) { @@ -18,14 +18,15 @@ class FilterService } /** - * Returns a DQL expression for the given filter and alias + * Returns a DQL expression for the given filter and alias. * * @param Filter $filter The filter to build the expression for * @param string $alias The field alias to search in * @param string $paramName The parameter name you use to bind the value to * - * @return \Doctrine\ORM\Query\Expr\Comparison * @throws \Exception + * + * @return \Doctrine\ORM\Query\Expr\Comparison */ public function getExpressionForFilter(Filter $filter, $alias, $paramName) { diff --git a/src/PartKeepr/PartBundle/Action/GetPartsAction.php b/src/PartKeepr/PartBundle/Action/GetPartsAction.php @@ -45,9 +45,9 @@ class GetPartsAction * * @param Request $request * - * @return array|\Dunglas\ApiBundle\Model\PaginatorInterface|\Traversable - * * @throws RuntimeException + * + * @return array|\Dunglas\ApiBundle\Model\PaginatorInterface|\Traversable */ public function __invoke(Request $request) { @@ -56,7 +56,7 @@ class GetPartsAction $items = $this->dataProvider->getCollection($resourceType); /** - * @var $part Part + * @var Part */ foreach ($items as $part) { if ($part->isMetaPart()) { @@ -66,7 +66,7 @@ class GetPartsAction foreach ($parts as $matchingPart) { /** - * @var $matchingPart Part + * @var Part */ $sum += $matchingPart->getStockLevel(); } diff --git a/src/PartKeepr/PartBundle/Controller/PartController.php b/src/PartKeepr/PartBundle/Controller/PartController.php @@ -42,7 +42,7 @@ class PartController extends FOSRestController } /** - * @var $projectRuns ProjectRun[] + * @var ProjectRun[] $projectRuns */ $projectRuns = []; diff --git a/src/PartKeepr/PartBundle/DataFixtures/PartDataLoader.php b/src/PartKeepr/PartBundle/DataFixtures/PartDataLoader.php @@ -27,7 +27,7 @@ class PartDataLoader extends AbstractFixture $part->setName('FOOBAR'); $part->setPartUnit($partUnit); /** - * @var $category PartCategory + * @var PartCategory $category */ $category = $this->getReference('partcategory.first'); $storageLocation = $this->getReference('storagelocation.first'); diff --git a/src/PartKeepr/PartBundle/Entity/MetaPartParameterCriteria.php b/src/PartKeepr/PartBundle/Entity/MetaPartParameterCriteria.php @@ -1,6 +1,6 @@ <?php -namespace PartKeepr\PartBundle\Entity; +namespace PartKeepr\PartBundle\Entity; use Doctrine\ORM\Mapping as ORM; use PartKeepr\CoreBundle\Entity\BaseEntity; diff --git a/src/PartKeepr/PartBundle/Entity/Part.php b/src/PartKeepr/PartBundle/Entity/Part.php @@ -227,7 +227,7 @@ class Part extends BaseEntity private $partCondition; /** - * Defines the production remarks for a part + * Defines the production remarks for a part. * * @ORM\Column(type="string",nullable=true) * @Groups({"default"}) @@ -280,7 +280,7 @@ class Part extends BaseEntity private $lowStock = false; /** - * Defines if the part is a meta-part + * Defines if the part is a meta-part. * * @ORM\Column(type="boolean") * @Groups({"default"}) @@ -290,7 +290,7 @@ class Part extends BaseEntity private $metaPart; /** - * An array of all matching meta parts + * An array of all matching meta parts. * @Groups({"default"}) * * @var array @@ -822,7 +822,7 @@ class Part extends BaseEntity } /** - * Adds a Meta Part Parameter Criteria + * Adds a Meta Part Parameter Criteria. * * @param MetaPartParameterCriteria $metaPartParameterCriteria A meta part parameter criteria to */ diff --git a/src/PartKeepr/PartBundle/Entity/PartParameter.php b/src/PartKeepr/PartBundle/Entity/PartParameter.php @@ -74,7 +74,7 @@ class PartParameter extends BaseEntity private $value; /** - * The normalized value (the product of si prefix + value) + * The normalized value (the product of si prefix + value). * * @ORM\Column(type="float",nullable=true) * @var @@ -92,7 +92,7 @@ class PartParameter extends BaseEntity private $maxValue; /** - * The normalized maximum value (the product of si prefix + value) + * The normalized maximum value (the product of si prefix + value). * * @ORM\Column(type="float",nullable=true) * @var @@ -110,10 +110,11 @@ class PartParameter extends BaseEntity private $minValue; /** - * The normalized minimum value (the product of si prefix + value) + * The normalized minimum value (the product of si prefix + value). * * @ORM\Column(type="float",nullable=true) - * @var + * + * @var int */ private $normalizedMinValue; diff --git a/src/PartKeepr/PartBundle/Exceptions/NotAMetaPartException.php b/src/PartKeepr/PartBundle/Exceptions/NotAMetaPartException.php @@ -6,7 +6,8 @@ namespace PartKeepr\PartBundle\Exceptions; class NotAMetaPartException extends \RuntimeException { - public function __construct () { + public function __construct () + { parent::__construct("Attempted to retrieve parts for a meta part, but the given part is not a meta part!"); } } diff --git a/src/PartKeepr/PartBundle/Services/PartService.php b/src/PartKeepr/PartBundle/Services/PartService.php @@ -114,7 +114,8 @@ class PartService } /** - * Returns the matching parts for a given meta part + * Returns the matching parts for a given meta part. + * * @param Part $metaPart * * @return Part[] @@ -129,7 +130,6 @@ class PartService throw new NotAMetaPartException(); } - foreach ($metaPart->getMetaPartParameterCriterias() as $metaPartParameterCriteria) { $qb = $this->entityManager->createQueryBuilder(); $qb->select("p.id AS id") diff --git a/src/PartKeepr/PartBundle/Tests/MetaPartTest.php b/src/PartKeepr/PartBundle/Tests/MetaPartTest.php @@ -27,9 +27,10 @@ class MetaPartTest extends WebTestCase )->getReferenceRepository(); } - public function testMetaPartMatching () { + public function testMetaPartMatching () + { /** - * @var $metaPart1 Part + * @var Part $metaPart1 */ $metaPart1 = $this->fixtures->getReference("metapart.1"); $metaSourcePart1 = $this->fixtures->getReference("metapart.source.1"); @@ -43,7 +44,7 @@ class MetaPartTest extends WebTestCase $this->assertNotContains($metaSourcePart3, $matches); /** - * @var $metaPart2 Part + * @var Part $metaPart2 */ $metaPart2 = $this->fixtures->getReference("metapart.2"); diff --git a/src/PartKeepr/ProjectBundle/Controller/ProjectReportController.php b/src/PartKeepr/ProjectBundle/Controller/ProjectReportController.php @@ -71,7 +71,7 @@ class ProjectReportController extends FOSRestController foreach ($query->getArrayResult() as $result) { $part = $partRepository->find($result['id']); /** - * @var $part Part + * @var Part $part */ if ($result["overageType"] === ProjectPart::OVERAGE_TYPE_PERCENT) { @@ -87,7 +87,6 @@ class ProjectReportController extends FOSRestController $aPartResults[$result['id']]['projectNames'][] = $result['projectname']; $aPartResults[$result['id']]['projects'][] = $projectIRI; - if ($result['remarks'] != '') { $aPartResults[$result['id']]['remarks'][] = $result['projectname'].': '.$result['remarks']; } @@ -106,7 +105,6 @@ class ProjectReportController extends FOSRestController $subParts = []; if ($part->isMetaPart()) { - $matchingParts = $this->container->get("partkeepr.part_service")->getMatchingMetaParts($part); foreach ($matchingParts as $matchingPart) { $subParts[] = $this->get('serializer')->normalize( @@ -116,7 +114,6 @@ class ProjectReportController extends FOSRestController } } - // Create a full resultset $aPartResults[$result['id']] = [ 'quantity' => ($result['quantity'] * $report['quantity']) + $overage, diff --git a/src/PartKeepr/ProjectBundle/Entity/ProjectPart.php b/src/PartKeepr/ProjectBundle/Entity/ProjectPart.php @@ -68,7 +68,7 @@ class ProjectPart extends BaseEntity private $remarks; /** - * The overage type + * The overage type. * * @ORM\Column(type="string") * @Groups({"default"}) @@ -78,16 +78,17 @@ class ProjectPart extends BaseEntity private $overageType; /** - * Specifies the overage, which can either be percent or an absolute value depending on overageType + * Specifies the overage, which can either be percent or an absolute value depending on overageType. * * @ORM\Column(type="integer") * @Groups({"default"}) * - * @var integer + * @var int */ private $overage; - public function __construct () { + public function __construct () + { $this->setOverageType(self::OVERAGE_TYPE_ABSOLUTE); $this->setOverage(0); } diff --git a/src/PartKeepr/ProjectBundle/Entity/ProjectRun.php b/src/PartKeepr/ProjectBundle/Entity/ProjectRun.php @@ -16,7 +16,7 @@ use Symfony\Component\Serializer\Annotation\Groups; class ProjectRun extends BaseEntity { /** - * Stores the date and time of a project run + * Stores the date and time of a project run. * * @ORM\Column(type="datetime") * @Groups({"default"}) @@ -26,7 +26,7 @@ class ProjectRun extends BaseEntity private $runDateTime; /** - * Stores the project used in a production run + * Stores the project used in a production run. * * @ORM\ManyToOne(targetEntity="PartKeepr\ProjectBundle\Entity\Project") * @Groups({"default"}) @@ -36,12 +36,12 @@ class ProjectRun extends BaseEntity private $project; /** - * Stores the quantity this project has been build + * Stores the quantity this project has been build. * * @ORM\Column(type="integer") * @Groups({"default"}) * - * @var integer + * @var int */ private $quantity; @@ -59,7 +59,8 @@ class ProjectRun extends BaseEntity */ private $parts; - public function __construct () { + public function __construct () + { $this->parts = new ArrayCollection(); } @@ -120,7 +121,7 @@ class ProjectRun extends BaseEntity } /** - * Adds a project run part + * Adds a project run part. * * @param ProjectRunPart */ @@ -133,7 +134,7 @@ class ProjectRun extends BaseEntity } /** - * Removes a project run part + * Removes a project run part. * * @param ProjectRunPart */ diff --git a/src/PartKeepr/ProjectBundle/Entity/ProjectRunPart.php b/src/PartKeepr/ProjectBundle/Entity/ProjectRunPart.php @@ -1,9 +1,9 @@ <?php namespace PartKeepr\ProjectBundle\Entity; -use PartKeepr\PartBundle\Entity\Part; use Doctrine\ORM\Mapping as ORM; use PartKeepr\CoreBundle\Entity\BaseEntity; +use PartKeepr\PartBundle\Entity\Part; use Symfony\Component\Serializer\Annotation\Groups; /** @@ -15,7 +15,7 @@ class ProjectRunPart extends BaseEntity { /** - * Stores the project run + * Stores the project run. * * @ORM\ManyToOne(targetEntity="PartKeepr\ProjectBundle\Entity\ProjectRun") * @Groups({"default"}) @@ -25,7 +25,7 @@ class ProjectRunPart extends BaseEntity private $projectRun; /** - * Stores the part used in a production run + * Stores the part used in a production run. * * @ORM\ManyToOne(targetEntity="PartKeepr\PartBundle\Entity\Part") * @Groups({"default"}) @@ -35,12 +35,12 @@ class ProjectRunPart extends BaseEntity private $part; /** - * Stores the quantity of a production run + * Stores the quantity of a production run. * * @ORM\Column(type="integer") * @Groups({"default"}) * - * @var integer + * @var int */ private $quantity; diff --git a/src/PartKeepr/ProjectBundle/Tests/ProjectTest.php b/src/PartKeepr/ProjectBundle/Tests/ProjectTest.php @@ -76,20 +76,20 @@ class ProjectTest extends WebTestCase 'attachments' => [ $uploadedFile->image, ], - 'parts' => [ + 'parts' => [ [ - 'quantity' => 1, - 'part' => $serializedPart1, - 'remarks' => 'testremark', + 'quantity' => 1, + 'part' => $serializedPart1, + 'remarks' => 'testremark', 'overageType' => ProjectPart::OVERAGE_TYPE_ABSOLUTE, - 'overage' => 0 + 'overage' => 0, ], [ - 'quantity' => 2, - 'part' => $serializedPart2, - 'remarks' => 'testremark2', + 'quantity' => 2, + 'part' => $serializedPart2, + 'remarks' => 'testremark2', 'overageType' => ProjectPart::OVERAGE_TYPE_ABSOLUTE, - 'overage' => 0 + 'overage' => 0, ], ], ]; @@ -216,7 +216,8 @@ class ProjectTest extends WebTestCase * frontend and serializing it back. * */ - public function testAbsentProjectReference () { + public function testAbsentProjectReference() + { $client = static::makeClient(true); $project = $this->fixtures->getReference('project');