@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|null $name Name of the controller or "Standard" if null |
| 30 | 30 | * @return \Aimeos\Controller\Jobs\Iface New controller object |
| 31 | 31 | */ |
| 32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null ) |
|
| 32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, \Aimeos\Bootstrap $aimeos, $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | /** controller/jobs/media/scale/name |
| 35 | 35 | * Class name of the used media scale job controller implementation |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | * @since 2017.01 |
| 65 | 65 | * @category Developer |
| 66 | 66 | */ |
| 67 | - if( $name === null ) { |
|
| 68 | - $name = $context->getConfig()->get( 'controller/jobs/media/scale/name', 'Standard' ); |
|
| 67 | + if ($name === null) { |
|
| 68 | + $name = $context->getConfig()->get('controller/jobs/media/scale/name', 'Standard'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if( ctype_alnum( $name ) === false ) |
|
| 71 | + if (ctype_alnum($name) === false) |
|
| 72 | 72 | { |
| 73 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Jobs\\Media\\Scale\\' . $name : '<not a string>'; |
|
| 74 | - throw new \Aimeos\Controller\Jobs\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 73 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Jobs\\Media\\Scale\\' . $name : '<not a string>'; |
|
| 74 | + throw new \Aimeos\Controller\Jobs\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $iface = '\\Aimeos\\Controller\\Jobs\\Iface'; |
| 78 | 78 | $classname = '\\Aimeos\\Controller\\Jobs\\Media\\Scale\\' . $name; |
| 79 | 79 | |
| 80 | - $controller = self::createControllerBase( $context, $aimeos, $classname, $iface ); |
|
| 80 | + $controller = self::createControllerBase($context, $aimeos, $classname, $iface); |
|
| 81 | 81 | |
| 82 | 82 | /** controller/jobs/media/scale/decorators/excludes |
| 83 | 83 | * Excludes decorators added by the "common" option from the media scale controllers |
@@ -153,6 +153,6 @@ discard block |
||
| 153 | 153 | * @see controller/jobs/media/scale/decorators/excludes |
| 154 | 154 | * @see controller/jobs/media/scale/decorators/global |
| 155 | 155 | */ |
| 156 | - return self::addControllerDecorators( $context, $aimeos, $controller, 'media/scale' ); |
|
| 156 | + return self::addControllerDecorators($context, $aimeos, $controller, 'media/scale'); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | \ No newline at end of file |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function getName() |
| 30 | 30 | { |
| 31 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rescale images' ); |
|
| 31 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rescale images'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function getDescription() |
| 41 | 41 | { |
| 42 | - return $this->getContext()->getI18n()->dt( 'controller/jobs', 'Rescales images to the new sizes' ); |
|
| 42 | + return $this->getContext()->getI18n()->dt('controller/jobs', 'Rescales images to the new sizes'); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -50,29 +50,29 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function run() |
| 52 | 52 | { |
| 53 | - $cntl = \Aimeos\Controller\Common\Media\Factory::createController( $this->getContext() ); |
|
| 54 | - $manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'media' ); |
|
| 53 | + $cntl = \Aimeos\Controller\Common\Media\Factory::createController($this->getContext()); |
|
| 54 | + $manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'media'); |
|
| 55 | 55 | |
| 56 | 56 | $search = $manager->createSearch(); |
| 57 | - $search->setConditions( $search->compare( '=~', 'media.mimetype', 'image/' ) ); |
|
| 58 | - $search->setSortations( array( $search->sort( '+', 'media.id' ) ) ); |
|
| 57 | + $search->setConditions($search->compare('=~', 'media.mimetype', 'image/')); |
|
| 58 | + $search->setSortations(array($search->sort('+', 'media.id'))); |
|
| 59 | 59 | |
| 60 | 60 | $start = 0; |
| 61 | 61 | |
| 62 | 62 | do |
| 63 | 63 | { |
| 64 | - $search->setSlice( $start ); |
|
| 65 | - $items = $manager->searchItems( $search ); |
|
| 64 | + $search->setSlice($start); |
|
| 65 | + $items = $manager->searchItems($search); |
|
| 66 | 66 | |
| 67 | - foreach( $items as $item ) |
|
| 67 | + foreach ($items as $item) |
|
| 68 | 68 | { |
| 69 | - $cntl->scale( $item, 'fs-media' ); |
|
| 70 | - $manager->saveItem( $item ); |
|
| 69 | + $cntl->scale($item, 'fs-media'); |
|
| 70 | + $manager->saveItem($item); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - $count = count( $items ); |
|
| 73 | + $count = count($items); |
|
| 74 | 74 | $start += $count; |
| 75 | 75 | } |
| 76 | - while( $count === $search->getSliceSize() ); |
|
| 76 | + while ($count === $search->getSliceSize()); |
|
| 77 | 77 | } |
| 78 | 78 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | $context = \TestHelperJobs::getContext(); |
| 20 | 20 | $aimeos = \TestHelperJobs::getAimeos(); |
| 21 | 21 | |
| 22 | - $this->object = new \Aimeos\Controller\Jobs\Media\Scale\Standard( $context, $aimeos ); |
|
| 22 | + $this->object = new \Aimeos\Controller\Jobs\Media\Scale\Standard($context, $aimeos); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
@@ -31,14 +31,14 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | public function testGetName() |
| 33 | 33 | { |
| 34 | - $this->assertEquals( 'Rescale images', $this->object->getName() ); |
|
| 34 | + $this->assertEquals('Rescale images', $this->object->getName()); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | public function testGetDescription() |
| 39 | 39 | { |
| 40 | 40 | $text = 'Rescales images to the new sizes'; |
| 41 | - $this->assertEquals( $text, $this->object->getDescription() ); |
|
| 41 | + $this->assertEquals($text, $this->object->getDescription()); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
@@ -49,31 +49,31 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | $name = 'ControllerJobsMediaScaleStandardRun'; |
| 52 | - $context->getConfig()->set( 'mshop/media/manager/name', $name ); |
|
| 53 | - $context->getConfig()->set( 'controller/common/media/name', $name ); |
|
| 52 | + $context->getConfig()->set('mshop/media/manager/name', $name); |
|
| 53 | + $context->getConfig()->set('controller/common/media/name', $name); |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | - $managerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Media\\Manager\\Standard' ) |
|
| 57 | - ->setMethods( array( 'saveItem' ) ) |
|
| 58 | - ->setConstructorArgs( array( $context ) ) |
|
| 56 | + $managerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Media\\Manager\\Standard') |
|
| 57 | + ->setMethods(array('saveItem')) |
|
| 58 | + ->setConstructorArgs(array($context)) |
|
| 59 | 59 | ->getMock(); |
| 60 | 60 | |
| 61 | - \Aimeos\MShop\Media\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Media\\Manager\\' . $name, $managerStub ); |
|
| 61 | + \Aimeos\MShop\Media\Manager\Factory::injectManager('\\Aimeos\\MShop\\Media\\Manager\\' . $name, $managerStub); |
|
| 62 | 62 | |
| 63 | - $managerStub->expects( $this->atLeast( 1 ) )->method( 'saveItem' ); |
|
| 63 | + $managerStub->expects($this->atLeast(1))->method('saveItem'); |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | - $cntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Media\\Standard' ) |
|
| 67 | - ->setMethods( array( 'scale' ) ) |
|
| 68 | - ->setConstructorArgs( array( $context ) ) |
|
| 66 | + $cntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Media\\Standard') |
|
| 67 | + ->setMethods(array('scale')) |
|
| 68 | + ->setConstructorArgs(array($context)) |
|
| 69 | 69 | ->getMock(); |
| 70 | 70 | |
| 71 | - \Aimeos\Controller\Common\Media\Factory::injectController( '\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub ); |
|
| 71 | + \Aimeos\Controller\Common\Media\Factory::injectController('\\Aimeos\\Controller\\Common\\Media\\' . $name, $cntlStub); |
|
| 72 | 72 | |
| 73 | - $cntlStub->expects( $this->atLeast( 1 ) )->method( 'scale' ); |
|
| 73 | + $cntlStub->expects($this->atLeast(1))->method('scale'); |
|
| 74 | 74 | |
| 75 | 75 | |
| 76 | - $object = new \Aimeos\Controller\Jobs\Media\Scale\Standard( $context, $aimeos ); |
|
| 76 | + $object = new \Aimeos\Controller\Jobs\Media\Scale\Standard($context, $aimeos); |
|
| 77 | 77 | $object->run(); |
| 78 | 78 | } |
| 79 | 79 | } |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | $context = \TestHelperJobs::getContext(); |
| 17 | 17 | $aimeos = \TestHelperJobs::getAimeos(); |
| 18 | 18 | |
| 19 | - $obj = \Aimeos\Controller\Jobs\Media\Scale\Factory::createController( $context, $aimeos ); |
|
| 20 | - $this->assertInstanceOf( '\\Aimeos\\Controller\\Jobs\\Iface', $obj ); |
|
| 19 | + $obj = \Aimeos\Controller\Jobs\Media\Scale\Factory::createController($context, $aimeos); |
|
| 20 | + $this->assertInstanceOf('\\Aimeos\\Controller\\Jobs\\Iface', $obj); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -26,8 +26,8 @@ discard block |
||
| 26 | 26 | $context = \TestHelperJobs::getContext(); |
| 27 | 27 | $aimeos = \TestHelperJobs::getAimeos(); |
| 28 | 28 | |
| 29 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 30 | - \Aimeos\Controller\Jobs\Media\Scale\Factory::createController( $context, $aimeos, 'Wrong$$$Name' ); |
|
| 29 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 30 | + \Aimeos\Controller\Jobs\Media\Scale\Factory::createController($context, $aimeos, 'Wrong$$$Name'); |
|
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | $context = \TestHelperJobs::getContext(); |
| 37 | 37 | $aimeos = \TestHelperJobs::getAimeos(); |
| 38 | 38 | |
| 39 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 40 | - \Aimeos\Controller\Jobs\Media\Scale\Factory::createController( $context, $aimeos, 'WrongClass' ); |
|
| 39 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 40 | + \Aimeos\Controller\Jobs\Media\Scale\Factory::createController($context, $aimeos, 'WrongClass'); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -46,8 +46,8 @@ discard block |
||
| 46 | 46 | $context = \TestHelperJobs::getContext(); |
| 47 | 47 | $aimeos = \TestHelperJobs::getAimeos(); |
| 48 | 48 | |
| 49 | - $this->setExpectedException( '\\Aimeos\\Controller\\Jobs\\Exception' ); |
|
| 50 | - \Aimeos\Controller\Jobs\Media\Scale\Factory::createController( $context, $aimeos, 'Factory' ); |
|
| 49 | + $this->setExpectedException('\\Aimeos\\Controller\\Jobs\\Exception'); |
|
| 50 | + \Aimeos\Controller\Jobs\Media\Scale\Factory::createController($context, $aimeos, 'Factory'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | } |