partkeepr

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

commit fd9ab4c2e95dafd14beb212e825037f8bc5b9f46
parent e2732ed70297579ed469376a4c46039851c2bcc6
Author: dromer <1185977+dromer@users.noreply.github.com>
Date:   Sun, 12 Apr 2020 07:13:33 +0200

Merge pull request #1115 from partkeepr/analysis-lKRr0w

Apply fixes from StyleCI
Diffstat:
Msrc/PartKeepr/AuthBundle/Action/SetPreferenceAction.php | 7+++++--
Msrc/PartKeepr/AuthBundle/Exceptions/UserPreferenceNotFoundException.php | 3++-
Msrc/PartKeepr/AuthBundle/Security/Authentication/AuthenticationProviderManager.php | 24++++++++++++++++--------
Msrc/PartKeepr/AuthBundle/Tests/LegacyAuthTest.php | 20++++++++++++--------
Msrc/PartKeepr/AuthBundle/Tests/Services/UserPreferenceServiceTest.php | 7+++++--
Msrc/PartKeepr/AuthBundle/Tests/UserTest.php | 23++++++++++++++---------
Msrc/PartKeepr/CoreBundle/Services/VersionService.php | 6++++--
Msrc/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php | 8++++----
Msrc/PartKeepr/DoctrineReflectionBundle/Tests/AdvancedSearchFilterTest.php | 12++++++++----
Msrc/PartKeepr/ImageBundle/Response/ImageResponse.php | 3++-
Msrc/PartKeepr/ImportBundle/Configuration/Configuration.php | 30++++++++++++++++++++++++------
Msrc/PartKeepr/ImportBundle/Configuration/EntityConfiguration.php | 6+++---
Msrc/PartKeepr/ImportBundle/Configuration/ManyToOneConfiguration.php | 6++++--
Msrc/PartKeepr/ImportBundle/Service/ImporterService.php | 18+++++++++++++-----
Msrc/PartKeepr/PartBundle/Services/PartMeasurementUnitService.php | 16++++++++--------
Msrc/PartKeepr/PartBundle/Services/PartService.php | 17++++++++++++-----
Msrc/PartKeepr/PartBundle/Tests/InternalPartNumberTest.php | 20++++++++++++++++----
Msrc/PartKeepr/PartBundle/Tests/StockTest.php | 6++++--
Msrc/PartKeepr/ProjectBundle/Entity/ProjectRunPart.php | 8+++++---
Msrc/PartKeepr/ProjectBundle/Entity/ReportPart.php | 7+++++--
Msrc/PartKeepr/ProjectBundle/Tests/ProjectTest.php | 14++++++++++----
Msrc/PartKeepr/SetupBundle/Command/ImportFootprintsCommand.php | 7+++++--
Msrc/PartKeepr/SetupBundle/Command/ImportManufacturersCommand.php | 7+++++--
Msrc/PartKeepr/SetupBundle/Command/ImportSiPrefixesCommand.php | 7+++++--
Msrc/PartKeepr/SetupBundle/Command/ImportUnitsCommand.php | 7+++++--
Msrc/PartKeepr/SetupBundle/Controller/AdminUserSetupController.php | 9+++++++--
Msrc/PartKeepr/SetupBundle/Services/ConfigSetupService.php | 6++++--
Msrc/PartKeepr/SetupBundle/Services/FootprintSetupService.php | 6++++--
Msrc/PartKeepr/SystemPreferenceBundle/Action/SetPreferenceAction.php | 6++++--
Msrc/PartKeepr/UploadedFileBundle/Controller/FileController.php | 8++++++--
Msrc/PartKeepr/UploadedFileBundle/Controller/TemporaryFileController.php | 6++++--
Msrc/PartKeepr/UploadedFileBundle/Services/UploadedFileService.php | 6++++--
32 files changed, 229 insertions(+), 107 deletions(-)

diff --git a/src/PartKeepr/AuthBundle/Action/SetPreferenceAction.php b/src/PartKeepr/AuthBundle/Action/SetPreferenceAction.php @@ -61,8 +61,11 @@ class SetPreferenceAction $data = json_decode($request->getContent()); if (property_exists($data, 'preferenceKey') && property_exists($data, 'preferenceValue')) { - $preference = $this->userPreferenceService->setPreference($user, $data->preferenceKey, - $data->preferenceValue); + $preference = $this->userPreferenceService->setPreference( + $user, + $data->preferenceKey, + $data->preferenceValue + ); } else { throw new \Exception('Invalid format'); } diff --git a/src/PartKeepr/AuthBundle/Exceptions/UserPreferenceNotFoundException.php b/src/PartKeepr/AuthBundle/Exceptions/UserPreferenceNotFoundException.php @@ -23,7 +23,8 @@ class UserPreferenceNotFoundException extends TranslatableException public function getMessageKey() { - return sprintf('The requested user preference %s was not found for user %s', + return sprintf( + 'The requested user preference %s was not found for user %s', $this->key, $this->user->getUsername() ); diff --git a/src/PartKeepr/AuthBundle/Security/Authentication/AuthenticationProviderManager.php b/src/PartKeepr/AuthBundle/Security/Authentication/AuthenticationProviderManager.php @@ -46,8 +46,10 @@ class AuthenticationProviderManager implements AuthenticationManagerInterface foreach ($providers as $provider) { if (!$provider instanceof AuthenticationProviderInterface) { - throw new \InvalidArgumentException(sprintf('UserProvider "%s" must implement the AuthenticationProviderInterface.', - get_class($provider))); + throw new \InvalidArgumentException(sprintf( + 'UserProvider "%s" must implement the AuthenticationProviderInterface.', + get_class($provider) + )); } } @@ -95,21 +97,27 @@ class AuthenticationProviderManager implements AuthenticationManagerInterface } if (null !== $this->eventDispatcher) { - $this->eventDispatcher->dispatch(AuthenticationEvents::AUTHENTICATION_SUCCESS, - new AuthenticationEvent($result)); + $this->eventDispatcher->dispatch( + AuthenticationEvents::AUTHENTICATION_SUCCESS, + new AuthenticationEvent($result) + ); } return $result; } if (null === $lastException) { - $lastException = new ProviderNotFoundException(sprintf('No Authentication UserProvider found for token of class "%s".', - get_class($token))); + $lastException = new ProviderNotFoundException(sprintf( + 'No Authentication UserProvider found for token of class "%s".', + get_class($token) + )); } if (null !== $this->eventDispatcher) { - $this->eventDispatcher->dispatch(AuthenticationEvents::AUTHENTICATION_FAILURE, - new AuthenticationFailureEvent($token, $lastException)); + $this->eventDispatcher->dispatch( + AuthenticationEvents::AUTHENTICATION_FAILURE, + new AuthenticationFailureEvent($token, $lastException) + ); } $lastException->setToken($token); diff --git a/src/PartKeepr/AuthBundle/Tests/LegacyAuthTest.php b/src/PartKeepr/AuthBundle/Tests/LegacyAuthTest.php @@ -21,20 +21,24 @@ class LegacyAuthTest extends WebTestCase $this->getContainer()->get('doctrine.orm.default_entity_manager')->persist($user); $this->getContainer()->get('doctrine.orm.default_entity_manager')->flush($user); - $client = static::makeClient(false, [ - 'PHP_AUTH_USER' => 'foobar', - 'PHP_AUTH_PW' => 'admin', - ] + $client = static::makeClient( + false, + [ + 'PHP_AUTH_USER' => 'foobar', + 'PHP_AUTH_PW' => 'admin', + ] ); $client->request('GET', '/api/system_status'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $client = static::makeClient(false, [ - 'PHP_AUTH_USER' => 'foobar', - 'PHP_AUTH_PW' => 'admin2', - ] + $client = static::makeClient( + false, + [ + 'PHP_AUTH_USER' => 'foobar', + 'PHP_AUTH_PW' => 'admin2', + ] ); $client->request('GET', '/api/system_status'); diff --git a/src/PartKeepr/AuthBundle/Tests/Services/UserPreferenceServiceTest.php b/src/PartKeepr/AuthBundle/Tests/Services/UserPreferenceServiceTest.php @@ -54,8 +54,11 @@ class UserPreferenceServiceTest extends WebTestCase /** * @var User */ - $user = $this->getContainer()->get('partkeepr.userservice')->getProxyUser('admin', - $userService->getBuiltinProvider(), true); + $user = $this->getContainer()->get('partkeepr.userservice')->getProxyUser( + 'admin', + $userService->getBuiltinProvider(), + true + ); $this->setExpectedException("PartKeepr\AuthBundle\Exceptions\UserPreferenceNotFoundException"); $service->getPreference($user, 'BLA'); diff --git a/src/PartKeepr/AuthBundle/Tests/UserTest.php b/src/PartKeepr/AuthBundle/Tests/UserTest.php @@ -24,7 +24,8 @@ class UserTest extends WebTestCase $ormExecutor = $this->loadFixtures( [ 'PartKeepr\AuthBundle\DataFixtures\LoadUserData', - ]); + ] + ); $this->fixtures = $ormExecutor->getReferenceRepository(); } @@ -94,10 +95,12 @@ class UserTest extends WebTestCase $this->getContainer()->get('doctrine.orm.default_entity_manager')->persist($user); $this->getContainer()->get('doctrine.orm.default_entity_manager')->flush($user); - $client = static::makeClient(false, [ - 'PHP_AUTH_USER' => 'bernd2', - 'PHP_AUTH_PW' => 'admin', - ] + $client = static::makeClient( + false, + [ + 'PHP_AUTH_USER' => 'bernd2', + 'PHP_AUTH_PW' => 'admin', + ] ); $iriConverter = $this->getContainer()->get('api.iri_converter'); @@ -117,10 +120,12 @@ class UserTest extends WebTestCase $this->assertEmpty($response->{'password'}); $this->assertEmpty($response->{'newPassword'}); - $client = static::makeClient(false, [ - 'PHP_AUTH_USER' => 'bernd2', - 'PHP_AUTH_PW' => 'foobar', - ] + $client = static::makeClient( + false, + [ + 'PHP_AUTH_USER' => 'bernd2', + 'PHP_AUTH_PW' => 'foobar', + ] ); $client->request('PUT', $iri, $parameters); diff --git a/src/PartKeepr/CoreBundle/Services/VersionService.php b/src/PartKeepr/CoreBundle/Services/VersionService.php @@ -124,8 +124,10 @@ class VersionService if (version_compare($this->getVersion(), $latestVersion['version'], '<')) { $this->systemNoticeService->createUniqueSystemNotice( 'PARTKEEPR_VERSION_'.$latestVersion['version'], - $this->translator->trans('New PartKeepr Version %version% available', - ['%version%' => $latestVersion['version']]), + $this->translator->trans( + 'New PartKeepr Version %version% available', + ['%version%' => $latestVersion['version']] + ), $this->translator->trans('PartKeepr Version %version% changelog:', [ '%version%' => $latestVersion['version']."\n\n". $latestVersion['changelog'], diff --git a/src/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php b/src/PartKeepr/DoctrineReflectionBundle/Services/ReflectionService.php @@ -155,10 +155,10 @@ class ReflectionService $getter = 'get'.ucfirst($association['fieldName']); $getterField = lcfirst($cm->getReflectionClass()->getShortName()).str_replace( - '.', - '', - $this->convertPHPToExtJSClassName($association['targetEntity']) - ); + '.', + '', + $this->convertPHPToExtJSClassName($association['targetEntity']) + ); if ($getterPlural) { $getterField .= 's'; diff --git a/src/PartKeepr/DoctrineReflectionBundle/Tests/AdvancedSearchFilterTest.php b/src/PartKeepr/DoctrineReflectionBundle/Tests/AdvancedSearchFilterTest.php @@ -58,8 +58,10 @@ class AdvancedSearchFilterTest extends WebTestCase */ $iriConverter = $this->getContainer()->get('api.iri_converter'); - $this->assertEquals($iriConverter->getIriFromItem($this->fixtures->getReference("part.1")), - $data["hydra:member"][0]["@id"]); + $this->assertEquals( + $iriConverter->getIriFromItem($this->fixtures->getReference("part.1")), + $data["hydra:member"][0]["@id"] + ); } public function testEqualFilterSame() @@ -93,8 +95,10 @@ class AdvancedSearchFilterTest extends WebTestCase */ $iriConverter = $this->getContainer()->get('api.iri_converter'); - $this->assertEquals($iriConverter->getIriFromItem($this->fixtures->getReference("part.1")), - $data["hydra:member"][0]["@id"]); + $this->assertEquals( + $iriConverter->getIriFromItem($this->fixtures->getReference("part.1")), + $data["hydra:member"][0]["@id"] + ); } public function testIDReference() diff --git a/src/PartKeepr/ImageBundle/Response/ImageResponse.php b/src/PartKeepr/ImageBundle/Response/ImageResponse.php @@ -34,7 +34,8 @@ class ImageResponse extends Response $black = $image->palette()->color('000'); - $path = realpath(__DIR__. + $path = realpath( + __DIR__. '/../Resources/public/fonts/OpenSans-Regular.ttf' ); diff --git a/src/PartKeepr/ImportBundle/Configuration/Configuration.php b/src/PartKeepr/ImportBundle/Configuration/Configuration.php @@ -26,8 +26,14 @@ class Configuration extends BaseConfiguration if (property_exists($importConfiguration, "fields")) { foreach ($importConfiguration->fields as $field => $configuration) { if ($this->classMetadata->hasField($field)) { - $fieldConfiguration = new FieldConfiguration($this->classMetadata, $this->baseEntity, - $this->reflectionService, $this->em, $this->advancedSearchFilter, $this->iriConverter); + $fieldConfiguration = new FieldConfiguration( + $this->classMetadata, + $this->baseEntity, + $this->reflectionService, + $this->em, + $this->advancedSearchFilter, + $this->iriConverter + ); $fieldConfiguration->setFieldName($field); $fieldConfiguration->setPath($this->getPath($field)); @@ -46,8 +52,14 @@ class Configuration extends BaseConfiguration $targetClass = $this->classMetadata->getAssociationTargetClass($manyToOne); $cm = $this->em->getClassMetadata($targetClass); - $manyToOneconfiguration = new ManyToOneConfiguration($cm, $targetClass, - $this->reflectionService, $this->em, $this->advancedSearchFilter, $this->iriConverter); + $manyToOneconfiguration = new ManyToOneConfiguration( + $cm, + $targetClass, + $this->reflectionService, + $this->em, + $this->advancedSearchFilter, + $this->iriConverter + ); $manyToOneconfiguration->setAssociationName($manyToOne); $manyToOneconfiguration->setPath($this->getPath($manyToOne)); @@ -65,8 +77,14 @@ class Configuration extends BaseConfiguration if ($this->classMetadata->hasAssociation($oneToMany)) { $targetClass = $this->classMetadata->getAssociationTargetClass($oneToMany); $cm = $this->em->getClassMetadata($targetClass); - $oneToManyConfiguration = new OneToManyConfiguration($cm, $targetClass, - $this->reflectionService, $this->em, $this->advancedSearchFilter, $this->iriConverter); + $oneToManyConfiguration = new OneToManyConfiguration( + $cm, + $targetClass, + $this->reflectionService, + $this->em, + $this->advancedSearchFilter, + $this->iriConverter + ); $oneToManyConfiguration->setAssociationName($oneToMany); $oneToManyConfiguration->setPath($this->getPath($oneToMany)); if ($oneToManyConfiguration->parseConfiguration($configuration) !== false) { diff --git a/src/PartKeepr/ImportBundle/Configuration/EntityConfiguration.php b/src/PartKeepr/ImportBundle/Configuration/EntityConfiguration.php @@ -49,9 +49,9 @@ class EntityConfiguration extends Configuration foreach ($importConfiguration->matchers as $matcher) { if (!property_exists($matcher, "matchField") || !property_exists( - $matcher, - "importField" - ) || $matcher->importField === "" + $matcher, + "importField" + ) || $matcher->importField === "" ) { throw new \Exception("matcher configuration error"); } diff --git a/src/PartKeepr/ImportBundle/Configuration/ManyToOneConfiguration.php b/src/PartKeepr/ImportBundle/Configuration/ManyToOneConfiguration.php @@ -78,8 +78,10 @@ class ManyToOneConfiguration extends Configuration } foreach ($importConfiguration->matchers as $matcher) { - if (!property_exists($matcher, "matchField") || !property_exists($matcher, - "importField") || $matcher->importField === "" + if (!property_exists($matcher, "matchField") || !property_exists( + $matcher, + "importField" + ) || $matcher->importField === "" ) { throw new \Exception("matcher configuration error"); } diff --git a/src/PartKeepr/ImportBundle/Service/ImporterService.php b/src/PartKeepr/ImportBundle/Service/ImporterService.php @@ -32,7 +32,7 @@ class ImporterService Registry $doctrine, ReflectionService $reflectionService, AdvancedSearchFilter $advancedSearchFilter, - IriConverter $iriConverter + IriConverter $iriConverter ) { $this->em = $doctrine->getManager(); $this->reflectionService = $reflectionService; @@ -77,8 +77,10 @@ class ImporterService if ($entity !== null) { $entities[] = $entity; } - $logs[] = implode("<br/>", - ["data" => implode(",", $row), '<p style="text-indent: 50px;">', "log" => " ".implode("<br/> ", $configuration->getLog()), '</p>']); + $logs[] = implode( + "<br/>", + ["data" => implode(",", $row), '<p style="text-indent: 50px;">', "log" => " ".implode("<br/> ", $configuration->getLog()), '</p>'] + ); $configuration->clearLog(); @@ -103,8 +105,14 @@ class ImporterService { $cm = $this->em->getClassMetadata($this->baseEntity); - $configuration = new EntityConfiguration($cm, $this->baseEntity, $this->reflectionService, $this->em, - $this->advancedSearchFilter, $this->iriConverter); + $configuration = new EntityConfiguration( + $cm, + $this->baseEntity, + $this->reflectionService, + $this->em, + $this->advancedSearchFilter, + $this->iriConverter + ); $configuration->parseConfiguration($this->importConfiguration); return $configuration; diff --git a/src/PartKeepr/PartBundle/Services/PartMeasurementUnitService.php b/src/PartKeepr/PartBundle/Services/PartMeasurementUnitService.php @@ -23,20 +23,20 @@ class PartMeasurementUnitService $this->entityManager->createQuery($dql) ->setParameter('id', $partMeasurementUnit->getId()) ->setParameter( - 'default', - true, - \PDO::PARAM_BOOL - )->execute(); + 'default', + true, + \PDO::PARAM_BOOL + )->execute(); $dql = 'UPDATE PartKeepr\PartBundle\Entity\PartMeasurementUnit pu SET pu.default = :default WHERE pu.id != :id'; $this->entityManager->createQuery($dql) ->setParameter('id', $partMeasurementUnit->getId()) ->setParameter( - 'default', - false, - \PDO::PARAM_BOOL - )->execute(); + 'default', + false, + \PDO::PARAM_BOOL + )->execute(); $this->entityManager->commit(); } diff --git a/src/PartKeepr/PartBundle/Services/PartService.php b/src/PartKeepr/PartBundle/Services/PartService.php @@ -143,15 +143,21 @@ class PartService switch ($metaPartParameterCriteria->getValueType()) { case PartParameter::VALUE_TYPE_NUMERIC: - $expr = $this->filterService->getExpressionForFilter($filter, "pp.normalizedValue", - $paramPrefix.$paramCount); + $expr = $this->filterService->getExpressionForFilter( + $filter, + "pp.normalizedValue", + $paramPrefix.$paramCount + ); $qb->setParameter($paramPrefix.$paramCount, $metaPartParameterCriteria->getNormalizedValue()); $paramCount++; break; case PartParameter::VALUE_TYPE_STRING: - $expr = $this->filterService->getExpressionForFilter($filter, "pp.stringValue", - $paramPrefix.$paramCount); + $expr = $this->filterService->getExpressionForFilter( + $filter, + "pp.stringValue", + $paramPrefix.$paramCount + ); $qb->setParameter($paramPrefix.$paramCount, $metaPartParameterCriteria->getStringValue()); $paramCount++; break; @@ -163,7 +169,8 @@ class PartService $qb->setParameter($paramPrefix.$paramCount, $metaPartParameterCriteria->getPartParameterName()); $qb->andWhere( - $qb->expr()->andX($expr, $expr2)); + $qb->expr()->andX($expr, $expr2) + ); $result = []; foreach ($qb->getQuery()->getScalarResult() as $partId) { diff --git a/src/PartKeepr/PartBundle/Tests/InternalPartNumberTest.php b/src/PartKeepr/PartBundle/Tests/InternalPartNumberTest.php @@ -44,10 +44,22 @@ class InternalPartNumberTest extends WebTestCase "internalPartNumber" => "foo123", ]; - $client->request('POST', '/api/parts', [], [], ['CONTENT_TYPE' => 'application/json'], - json_encode($part)); - $client->request('POST', '/api/parts', [], [], ['CONTENT_TYPE' => 'application/json'], - json_encode($part)); + $client->request( + 'POST', + '/api/parts', + [], + [], + ['CONTENT_TYPE' => 'application/json'], + json_encode($part) + ); + $client->request( + 'POST', + '/api/parts', + [], + [], + ['CONTENT_TYPE' => 'application/json'], + json_encode($part) + ); $this->assertEquals(500, $client->getResponse()->getStatusCode()); diff --git a/src/PartKeepr/PartBundle/Tests/StockTest.php b/src/PartKeepr/PartBundle/Tests/StockTest.php @@ -32,8 +32,10 @@ class StockTest extends WebTestCase /** * @var Query */ - $query = $this->getContainer()->get('doctrine')->getManager()->createQuery('SELECT p.stockLevel FROM PartKeeprPartBundle:Part p WHERE p.id = :id')->setParameter('id', - $part->getId()); + $query = $this->getContainer()->get('doctrine')->getManager()->createQuery('SELECT p.stockLevel FROM PartKeeprPartBundle:Part p WHERE p.id = :id')->setParameter( + 'id', + $part->getId() + ); return $query->getSingleScalarResult(); } diff --git a/src/PartKeepr/ProjectBundle/Entity/ProjectRunPart.php b/src/PartKeepr/ProjectBundle/Entity/ProjectRunPart.php @@ -121,8 +121,10 @@ class ProjectRunPart extends BaseEntity public function __toString() { // @todo i18n - return sprintf("Used in project run for project %s on %s", - $this->getProjectRun()->getProject()->getName(), - $this->getProjectRun()->getRunDateTime()->format("Y-m-d H:i:s"))." / ".parent::__toString(); + return sprintf( + "Used in project run for project %s on %s", + $this->getProjectRun()->getProject()->getName(), + $this->getProjectRun()->getRunDateTime()->format("Y-m-d H:i:s") + )." / ".parent::__toString(); } } diff --git a/src/PartKeepr/ProjectBundle/Entity/ReportPart.php b/src/PartKeepr/ProjectBundle/Entity/ReportPart.php @@ -340,7 +340,10 @@ class ReportPart extends BaseEntity public function __toString() { // @todo i18n - return sprintf("Used in project report %s %s", $this->getReport()->getName(), - $this->getReport()->getCreateDateTime()->format("Y-m-d H:i:s"))." / ".parent::__toString(); + return sprintf( + "Used in project report %s %s", + $this->getReport()->getName(), + $this->getReport()->getCreateDateTime()->format("Y-m-d H:i:s") + )." / ".parent::__toString(); } } diff --git a/src/PartKeepr/ProjectBundle/Tests/ProjectTest.php b/src/PartKeepr/ProjectBundle/Tests/ProjectTest.php @@ -160,8 +160,11 @@ class ProjectTest extends WebTestCase $response = json_decode($client->getResponse()->getContent()); $this->assertInternalType('array', $response->parts); - $this->assertArrayNotHasKey(1, $response->parts, - 'When removing an entry from the ArrayCollection, the array must be resorted!'); + $this->assertArrayNotHasKey( + 1, + $response->parts, + 'When removing an entry from the ArrayCollection, the array must be resorted!' + ); $this->assertEquals(1, count($response->parts)); } @@ -204,8 +207,11 @@ class ProjectTest extends WebTestCase $response = json_decode($client->getResponse()->getContent()); $this->assertInternalType('array', $response->attachments); - $this->assertArrayNotHasKey(1, $response->attachments, - 'When removing an entry from the ArrayCollection, the array must be resorted!'); + $this->assertArrayNotHasKey( + 1, + $response->attachments, + 'When removing an entry from the ArrayCollection, the array must be resorted!' + ); $this->assertEquals(0, count($response->attachments)); } diff --git a/src/PartKeepr/SetupBundle/Command/ImportFootprintsCommand.php b/src/PartKeepr/SetupBundle/Command/ImportFootprintsCommand.php @@ -19,7 +19,10 @@ class ImportFootprintsCommand extends ContainerAwareCommand { $return = $this->getContainer()->get('partkeepr.setup.footprint_service')->importFootprints(); - $output->writeln(sprintf('%d footprints imported, %d existing footprints skipped', $return['imported'], - $return['skipped'])); + $output->writeln(sprintf( + '%d footprints imported, %d existing footprints skipped', + $return['imported'], + $return['skipped'] + )); } } diff --git a/src/PartKeepr/SetupBundle/Command/ImportManufacturersCommand.php b/src/PartKeepr/SetupBundle/Command/ImportManufacturersCommand.php @@ -19,7 +19,10 @@ class ImportManufacturersCommand extends ContainerAwareCommand { $return = $this->getContainer()->get('partkeepr.setup.manufacturer_service')->importManufacturers(); - $output->writeln(sprintf('%d manufacturers imported, %d existing manufacturers skipped', $return['imported'], - $return['skipped'])); + $output->writeln(sprintf( + '%d manufacturers imported, %d existing manufacturers skipped', + $return['imported'], + $return['skipped'] + )); } } diff --git a/src/PartKeepr/SetupBundle/Command/ImportSiPrefixesCommand.php b/src/PartKeepr/SetupBundle/Command/ImportSiPrefixesCommand.php @@ -19,7 +19,10 @@ class ImportSiPrefixesCommand extends ContainerAwareCommand { $return = $this->getContainer()->get('partkeepr.setup.si_prefix_service')->importSiPrefixes(); - $output->writeln(sprintf('%d SI prefixes imported, %d existing SI Prefixes updated', $return['imported'], - $return['updated'])); + $output->writeln(sprintf( + '%d SI prefixes imported, %d existing SI Prefixes updated', + $return['imported'], + $return['updated'] + )); } } diff --git a/src/PartKeepr/SetupBundle/Command/ImportUnitsCommand.php b/src/PartKeepr/SetupBundle/Command/ImportUnitsCommand.php @@ -23,7 +23,10 @@ class ImportUnitsCommand extends ContainerAwareCommand $return = $this->getContainer()->get('partkeepr.setup.unit_service')->importUnits($update); - $output->writeln(sprintf('%d units imported, %d existing units skipped', $return['imported'], - $return['skipped'])); + $output->writeln(sprintf( + '%d units imported, %d existing units skipped', + $return['imported'], + $return['skipped'] + )); } } diff --git a/src/PartKeepr/SetupBundle/Controller/AdminUserSetupController.php b/src/PartKeepr/SetupBundle/Controller/AdminUserSetupController.php @@ -51,8 +51,13 @@ class AdminUserSetupController extends SetupBaseController if ($user === null) { $manipulator = $this->get('fos_user.util.user_manipulator'); - $manipulator->create($request->query->get('username'), $request->query->get('password'), - $request->query->get('email'), true, true); + $manipulator->create( + $request->query->get('username'), + $request->query->get('password'), + $request->query->get('email'), + true, + true + ); } } catch (\Exception $e) { $response['success'] = false; diff --git a/src/PartKeepr/SetupBundle/Services/ConfigSetupService.php b/src/PartKeepr/SetupBundle/Services/ConfigSetupService.php @@ -110,8 +110,10 @@ class ConfigSetupService ksort($parameters); - return $this->twig->render('PartKeeprSetupBundle::parameters.php.twig', - ['parameters' => $parameters]); + return $this->twig->render( + 'PartKeeprSetupBundle::parameters.php.twig', + ['parameters' => $parameters] + ); } public function legacyConfigParser() diff --git a/src/PartKeepr/SetupBundle/Services/FootprintSetupService.php b/src/PartKeepr/SetupBundle/Services/FootprintSetupService.php @@ -95,8 +95,10 @@ class FootprintSetupService } if (array_key_exists('category', $footprintData)) { - $footprintCategory = $this->addFootprintCategoryPath(explode('/', $footprintData['category']), - $footprintCategoryRootNode); + $footprintCategory = $this->addFootprintCategoryPath( + explode('/', $footprintData['category']), + $footprintCategoryRootNode + ); $footprint->setCategory($footprintCategory); } diff --git a/src/PartKeepr/SystemPreferenceBundle/Action/SetPreferenceAction.php b/src/PartKeepr/SystemPreferenceBundle/Action/SetPreferenceAction.php @@ -51,8 +51,10 @@ class SetPreferenceAction $data = json_decode($request->getContent()); if (property_exists($data, 'preferenceKey') && property_exists($data, 'preferenceValue')) { - $preference = $this->systemPreferenceService->setSystemPreference($data->preferenceKey, - $data->preferenceValue); + $preference = $this->systemPreferenceService->setSystemPreference( + $data->preferenceKey, + $data->preferenceValue + ); } else { throw new \Exception('Invalid format'); } diff --git a/src/PartKeepr/UploadedFileBundle/Controller/FileController.php b/src/PartKeepr/UploadedFileBundle/Controller/FileController.php @@ -63,8 +63,12 @@ abstract class FileController extends Controller ); } catch (FileNotFound $e) { $this->get('logger')->addError( - sprintf('File %s not found in storage %s', $file->getFullFilename(), - $file->getType())); + sprintf( + 'File %s not found in storage %s', + $file->getFullFilename(), + $file->getType() + ) + ); return new Response( '404 File not found', diff --git a/src/PartKeepr/UploadedFileBundle/Controller/TemporaryFileController.php b/src/PartKeepr/UploadedFileBundle/Controller/TemporaryFileController.php @@ -48,8 +48,10 @@ class TemporaryFileController extends FileController $error = $this->get('translator')->trans('The uploaded file is too large.'); break; default: - $error = $this->get('translator')->trans('Unknown error, error code %code', - ['code' => $file->getError()]); + $error = $this->get('translator')->trans( + 'Unknown error, error code %code', + ['code' => $file->getError()] + ); break; } diff --git a/src/PartKeepr/UploadedFileBundle/Services/UploadedFileService.php b/src/PartKeepr/UploadedFileBundle/Services/UploadedFileService.php @@ -75,8 +75,10 @@ class UploadedFileService extends ContainerAware try { $storage->delete($file->getFullFilename()); } catch (FileNotFound $e) { - $this->container->get('logger')->alert(sprintf('Unable to delete file %s', $file->getFullFilename()), - [$e, $file]); + $this->container->get('logger')->alert( + sprintf('Unable to delete file %s', $file->getFullFilename()), + [$e, $file] + ); } }