@@ -14,31 +14,31 @@ |
||
| 14 | 14 | { |
| 15 | 15 | $target = '\\Aimeos\\Controller\\Frontend\\Order\\Iface'; |
| 16 | 16 | |
| 17 | - $controller = \Aimeos\Controller\Frontend\Order\Factory::createController( \TestHelperFrontend::getContext() ); |
|
| 18 | - $this->assertInstanceOf( $target, $controller ); |
|
| 17 | + $controller = \Aimeos\Controller\Frontend\Order\Factory::createController(\TestHelperFrontend::getContext()); |
|
| 18 | + $this->assertInstanceOf($target, $controller); |
|
| 19 | 19 | |
| 20 | - $controller = \Aimeos\Controller\Frontend\Order\Factory::createController( \TestHelperFrontend::getContext(), 'Standard' ); |
|
| 21 | - $this->assertInstanceOf( $target, $controller ); |
|
| 20 | + $controller = \Aimeos\Controller\Frontend\Order\Factory::createController(\TestHelperFrontend::getContext(), 'Standard'); |
|
| 21 | + $this->assertInstanceOf($target, $controller); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | public function testCreateControllerInvalidImplementation() |
| 26 | 26 | { |
| 27 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
| 28 | - \Aimeos\Controller\Frontend\Order\Factory::createController( \TestHelperFrontend::getContext(), 'Invalid' ); |
|
| 27 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
| 28 | + \Aimeos\Controller\Frontend\Order\Factory::createController(\TestHelperFrontend::getContext(), 'Invalid'); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | public function testCreateControllerInvalidName() |
| 33 | 33 | { |
| 34 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
| 35 | - \Aimeos\Controller\Frontend\Order\Factory::createController( \TestHelperFrontend::getContext(), '%^' ); |
|
| 34 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
| 35 | + \Aimeos\Controller\Frontend\Order\Factory::createController(\TestHelperFrontend::getContext(), '%^'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | public function testCreateControllerNotExisting() |
| 40 | 40 | { |
| 41 | - $this->setExpectedException( '\\Aimeos\\Controller\\Frontend\\Exception' ); |
|
| 42 | - \Aimeos\Controller\Frontend\Order\Factory::createController( \TestHelperFrontend::getContext(), 'notexist' ); |
|
| 41 | + $this->setExpectedException('\\Aimeos\\Controller\\Frontend\\Exception'); |
|
| 42 | + \Aimeos\Controller\Frontend\Order\Factory::createController(\TestHelperFrontend::getContext(), 'notexist'); |
|
| 43 | 43 | } |
| 44 | 44 | } |
@@ -14,36 +14,36 @@ discard block |
||
| 14 | 14 | { |
| 15 | 15 | $context = \TestHelperFrontend::getContext(); |
| 16 | 16 | $name = 'ControllerFrontendOrderStore'; |
| 17 | - $context->getConfig()->set( 'mshop/order/manager/name', $name ); |
|
| 17 | + $context->getConfig()->set('mshop/order/manager/name', $name); |
|
| 18 | 18 | |
| 19 | 19 | |
| 20 | - $orderManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Standard' ) |
|
| 21 | - ->setMethods( array( 'saveItem', 'getSubManager' ) ) |
|
| 22 | - ->setConstructorArgs( array( $context ) ) |
|
| 20 | + $orderManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Standard') |
|
| 21 | + ->setMethods(array('saveItem', 'getSubManager')) |
|
| 22 | + ->setConstructorArgs(array($context)) |
|
| 23 | 23 | ->getMock(); |
| 24 | 24 | |
| 25 | - $orderBaseManagerStub = $this->getMockBuilder( '\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard' ) |
|
| 26 | - ->setMethods( array( 'store' ) ) |
|
| 27 | - ->setConstructorArgs( array( $context ) ) |
|
| 25 | + $orderBaseManagerStub = $this->getMockBuilder('\\Aimeos\\MShop\\Order\\Manager\\Base\\Standard') |
|
| 26 | + ->setMethods(array('store')) |
|
| 27 | + ->setConstructorArgs(array($context)) |
|
| 28 | 28 | ->getMock(); |
| 29 | 29 | |
| 30 | - \Aimeos\MShop\Order\Manager\Factory::injectManager( '\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub ); |
|
| 30 | + \Aimeos\MShop\Order\Manager\Factory::injectManager('\\Aimeos\\MShop\\Order\\Manager\\' . $name, $orderManagerStub); |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | 33 | $orderBaseItem = $orderBaseManagerStub->createItem(); |
| 34 | - $orderBaseItem->setId( 1 ); |
|
| 34 | + $orderBaseItem->setId(1); |
|
| 35 | 35 | |
| 36 | 36 | |
| 37 | - $orderBaseManagerStub->expects( $this->once() )->method( 'store' ); |
|
| 37 | + $orderBaseManagerStub->expects($this->once())->method('store'); |
|
| 38 | 38 | |
| 39 | - $orderManagerStub->expects( $this->once() )->method( 'getSubManager' ) |
|
| 40 | - ->will( $this->returnValue( $orderBaseManagerStub ) ); |
|
| 39 | + $orderManagerStub->expects($this->once())->method('getSubManager') |
|
| 40 | + ->will($this->returnValue($orderBaseManagerStub)); |
|
| 41 | 41 | |
| 42 | - $orderManagerStub->expects( $this->once() )->method( 'saveItem' ); |
|
| 42 | + $orderManagerStub->expects($this->once())->method('saveItem'); |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | - $object = new \Aimeos\Controller\Frontend\Order\Standard( $context ); |
|
| 46 | - $object->store( $orderBaseItem ); |
|
| 45 | + $object = new \Aimeos\Controller\Frontend\Order\Standard($context); |
|
| 46 | + $object->store($orderBaseItem); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -51,21 +51,21 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $context = \TestHelperFrontend::getContext(); |
| 53 | 53 | $name = 'ControllerFrontendOrderBlock'; |
| 54 | - $context->getConfig()->set( 'controller/common/order/name', $name ); |
|
| 54 | + $context->getConfig()->set('controller/common/order/name', $name); |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
| 58 | - ->setMethods( array( 'block' ) ) |
|
| 59 | - ->setConstructorArgs( array( $context ) ) |
|
| 57 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
| 58 | + ->setMethods(array('block')) |
|
| 59 | + ->setConstructorArgs(array($context)) |
|
| 60 | 60 | ->getMock(); |
| 61 | 61 | |
| 62 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
| 62 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
| 63 | 63 | |
| 64 | - $orderCntlStub->expects( $this->once() )->method( 'block' ); |
|
| 64 | + $orderCntlStub->expects($this->once())->method('block'); |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | - $object = new \Aimeos\Controller\Frontend\Order\Standard( $context ); |
|
| 68 | - $object->block( \Aimeos\MShop\Factory::createManager( $context, 'order' )->createItem() ); |
|
| 67 | + $object = new \Aimeos\Controller\Frontend\Order\Standard($context); |
|
| 68 | + $object->block(\Aimeos\MShop\Factory::createManager($context, 'order')->createItem()); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
@@ -73,21 +73,21 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $context = \TestHelperFrontend::getContext(); |
| 75 | 75 | $name = 'ControllerFrontendOrderUnblock'; |
| 76 | - $context->getConfig()->set( 'controller/common/order/name', $name ); |
|
| 76 | + $context->getConfig()->set('controller/common/order/name', $name); |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
| 80 | - ->setMethods( array( 'unblock' ) ) |
|
| 81 | - ->setConstructorArgs( array( $context ) ) |
|
| 79 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
| 80 | + ->setMethods(array('unblock')) |
|
| 81 | + ->setConstructorArgs(array($context)) |
|
| 82 | 82 | ->getMock(); |
| 83 | 83 | |
| 84 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
| 84 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
| 85 | 85 | |
| 86 | - $orderCntlStub->expects( $this->once() )->method( 'unblock' ); |
|
| 86 | + $orderCntlStub->expects($this->once())->method('unblock'); |
|
| 87 | 87 | |
| 88 | 88 | |
| 89 | - $object = new \Aimeos\Controller\Frontend\Order\Standard( $context ); |
|
| 90 | - $object->unblock( \Aimeos\MShop\Factory::createManager( $context, 'order' )->createItem() ); |
|
| 89 | + $object = new \Aimeos\Controller\Frontend\Order\Standard($context); |
|
| 90 | + $object->unblock(\Aimeos\MShop\Factory::createManager($context, 'order')->createItem()); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
@@ -95,20 +95,20 @@ discard block |
||
| 95 | 95 | { |
| 96 | 96 | $context = \TestHelperFrontend::getContext(); |
| 97 | 97 | $name = 'ControllerFrontendOrderUpdate'; |
| 98 | - $context->getConfig()->set( 'controller/common/order/name', $name ); |
|
| 98 | + $context->getConfig()->set('controller/common/order/name', $name); |
|
| 99 | 99 | |
| 100 | 100 | |
| 101 | - $orderCntlStub = $this->getMockBuilder( '\\Aimeos\\Controller\\Common\\Order\\Standard' ) |
|
| 102 | - ->setMethods( array( 'update' ) ) |
|
| 103 | - ->setConstructorArgs( array( $context ) ) |
|
| 101 | + $orderCntlStub = $this->getMockBuilder('\\Aimeos\\Controller\\Common\\Order\\Standard') |
|
| 102 | + ->setMethods(array('update')) |
|
| 103 | + ->setConstructorArgs(array($context)) |
|
| 104 | 104 | ->getMock(); |
| 105 | 105 | |
| 106 | - \Aimeos\Controller\Common\Order\Factory::injectController( '\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub ); |
|
| 106 | + \Aimeos\Controller\Common\Order\Factory::injectController('\\Aimeos\\Controller\\Common\\Order\\' . $name, $orderCntlStub); |
|
| 107 | 107 | |
| 108 | - $orderCntlStub->expects( $this->once() )->method( 'update' ); |
|
| 108 | + $orderCntlStub->expects($this->once())->method('update'); |
|
| 109 | 109 | |
| 110 | 110 | |
| 111 | - $object = new \Aimeos\Controller\Frontend\Order\Standard( $context ); |
|
| 112 | - $object->update( \Aimeos\MShop\Factory::createManager( $context, 'order' )->createItem() ); |
|
| 111 | + $object = new \Aimeos\Controller\Frontend\Order\Standard($context); |
|
| 112 | + $object->update(\Aimeos\MShop\Factory::createManager($context, 'order')->createItem()); |
|
| 113 | 113 | } |
| 114 | 114 | } |
@@ -15,15 +15,15 @@ discard block |
||
| 15 | 15 | public static function bootstrap() |
| 16 | 16 | { |
| 17 | 17 | self::getAimeos(); |
| 18 | - \Aimeos\MShop\Factory::setCache( false ); |
|
| 19 | - \Aimeos\Controller\Frontend\Factory::setCache( false ); |
|
| 18 | + \Aimeos\MShop\Factory::setCache(false); |
|
| 19 | + \Aimeos\Controller\Frontend\Factory::setCache(false); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - public static function getContext( $site = 'unittest' ) |
|
| 23 | + public static function getContext($site = 'unittest') |
|
| 24 | 24 | { |
| 25 | - if( !isset( self::$context[$site] ) ) { |
|
| 26 | - self::$context[$site] = self::createContext( $site ); |
|
| 25 | + if (!isset(self::$context[$site])) { |
|
| 26 | + self::$context[$site] = self::createContext($site); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | return clone self::$context[$site]; |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | private static function getAimeos() |
| 34 | 34 | { |
| 35 | - if( !isset( self::$aimeos ) ) |
|
| 35 | + if (!isset(self::$aimeos)) |
|
| 36 | 36 | { |
| 37 | 37 | require_once 'Bootstrap.php'; |
| 38 | - spl_autoload_register( 'Aimeos\\Bootstrap::autoload' ); |
|
| 38 | + spl_autoload_register('Aimeos\\Bootstrap::autoload'); |
|
| 39 | 39 | |
| 40 | - $extdir = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); |
|
| 41 | - self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), true ); |
|
| 40 | + $extdir = dirname(dirname(dirname(dirname(dirname(__FILE__))))); |
|
| 41 | + self::$aimeos = new \Aimeos\Bootstrap(array($extdir), true); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | return self::$aimeos; |
@@ -48,44 +48,44 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * @param string $site |
| 50 | 50 | */ |
| 51 | - private static function createContext( $site ) |
|
| 51 | + private static function createContext($site) |
|
| 52 | 52 | { |
| 53 | 53 | $ctx = new \Aimeos\MShop\Context\Item\Standard(); |
| 54 | 54 | $aimeos = self::getAimeos(); |
| 55 | 55 | |
| 56 | 56 | |
| 57 | - $paths = $aimeos->getConfigPaths( 'mysql' ); |
|
| 57 | + $paths = $aimeos->getConfigPaths('mysql'); |
|
| 58 | 58 | $paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config'; |
| 59 | 59 | $file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser'; |
| 60 | 60 | |
| 61 | - $conf = new \Aimeos\MW\Config\PHPArray( array(), $paths ); |
|
| 62 | - $conf = new \Aimeos\MW\Config\Decorator\Memory( $conf ); |
|
| 63 | - $conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file ); |
|
| 64 | - $ctx->setConfig( $conf ); |
|
| 61 | + $conf = new \Aimeos\MW\Config\PHPArray(array(), $paths); |
|
| 62 | + $conf = new \Aimeos\MW\Config\Decorator\Memory($conf); |
|
| 63 | + $conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file); |
|
| 64 | + $ctx->setConfig($conf); |
|
| 65 | 65 | |
| 66 | 66 | |
| 67 | - $dbm = new \Aimeos\MW\DB\Manager\PDO( $conf ); |
|
| 68 | - $ctx->setDatabaseManager( $dbm ); |
|
| 67 | + $dbm = new \Aimeos\MW\DB\Manager\PDO($conf); |
|
| 68 | + $ctx->setDatabaseManager($dbm); |
|
| 69 | 69 | |
| 70 | 70 | |
| 71 | - $logger = new \Aimeos\MW\Logger\File( 'unittest.log', \Aimeos\MW\Logger\Base::DEBUG ); |
|
| 72 | - $ctx->setLogger( $logger ); |
|
| 71 | + $logger = new \Aimeos\MW\Logger\File('unittest.log', \Aimeos\MW\Logger\Base::DEBUG); |
|
| 72 | + $ctx->setLogger($logger); |
|
| 73 | 73 | |
| 74 | 74 | |
| 75 | - $i18n = new \Aimeos\MW\Translation\None( 'de' ); |
|
| 76 | - $ctx->setI18n( array( 'de' => $i18n ) ); |
|
| 75 | + $i18n = new \Aimeos\MW\Translation\None('de'); |
|
| 76 | + $ctx->setI18n(array('de' => $i18n)); |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | $session = new \Aimeos\MW\Session\None(); |
| 80 | - $ctx->setSession( $session ); |
|
| 80 | + $ctx->setSession($session); |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | - $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx ); |
|
| 84 | - $locale = $localeManager->bootstrap( $site, '', '', false ); |
|
| 85 | - $ctx->setLocale( $locale ); |
|
| 83 | + $localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx); |
|
| 84 | + $locale = $localeManager->bootstrap($site, '', '', false); |
|
| 85 | + $ctx->setLocale($locale); |
|
| 86 | 86 | |
| 87 | 87 | |
| 88 | - $ctx->setEditor( 'core:controller/frontend' ); |
|
| 88 | + $ctx->setEditor('core:controller/frontend'); |
|
| 89 | 89 | |
| 90 | 90 | return $ctx; |
| 91 | 91 | } |
@@ -11,22 +11,22 @@ |
||
| 11 | 11 | * Set error reporting to maximum |
| 12 | 12 | */ |
| 13 | 13 | error_reporting( -1 ); |
| 14 | -ini_set( 'display_errors', '1' ); |
|
| 14 | +ini_set('display_errors', '1'); |
|
| 15 | 15 | |
| 16 | -date_default_timezone_set( 'UTC' ); |
|
| 16 | +date_default_timezone_set('UTC'); |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Set locale settings to reasonable defaults |
| 20 | 20 | */ |
| 21 | -setlocale( LC_ALL, 'en_US.UTF-8' ); |
|
| 22 | -setlocale( LC_NUMERIC, 'POSIX' ); |
|
| 23 | -setlocale( LC_CTYPE, 'en_US.UTF-8' ); |
|
| 24 | -setlocale( LC_TIME, 'POSIX' ); |
|
| 21 | +setlocale(LC_ALL, 'en_US.UTF-8'); |
|
| 22 | +setlocale(LC_NUMERIC, 'POSIX'); |
|
| 23 | +setlocale(LC_CTYPE, 'en_US.UTF-8'); |
|
| 24 | +setlocale(LC_TIME, 'POSIX'); |
|
| 25 | 25 | |
| 26 | 26 | /* |
| 27 | 27 | * Set include path for tests |
| 28 | 28 | */ |
| 29 | -define( 'PATH_TESTS', __DIR__ ); |
|
| 29 | +define('PATH_TESTS', __DIR__); |
|
| 30 | 30 | |
| 31 | 31 | require_once 'TestHelperFrontend.php'; |
| 32 | 32 | \TestHelperFrontend::bootstrap(); |
@@ -35,43 +35,43 @@ discard block |
||
| 35 | 35 | * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items |
| 36 | 36 | * @throws \Exception If an error occurs |
| 37 | 37 | */ |
| 38 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
| 39 | - $ref = array( 'media', 'price', 'text' ) ) |
|
| 38 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
| 39 | + $ref = array('media', 'price', 'text')) |
|
| 40 | 40 | { |
| 41 | - if( isset( $this->items[$type] ) ) { |
|
| 41 | + if (isset($this->items[$type])) { |
|
| 42 | 42 | return $this->items[$type]; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 45 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 46 | 46 | |
| 47 | - $search = $serviceManager->createSearch( true ); |
|
| 47 | + $search = $serviceManager->createSearch(true); |
|
| 48 | 48 | $expr = array( |
| 49 | 49 | $search->getConditions(), |
| 50 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
| 51 | - $search->compare( '==', 'service.type.code', $type ), |
|
| 50 | + $search->compare('==', 'service.type.domain', 'service'), |
|
| 51 | + $search->compare('==', 'service.type.code', $type), |
|
| 52 | 52 | ); |
| 53 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 54 | - $search->setSortations( array( $search->sort( '+', 'service.position' ) ) ); |
|
| 53 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 54 | + $search->setSortations(array($search->sort('+', 'service.position'))); |
|
| 55 | 55 | |
| 56 | - $this->items[$type] = $serviceManager->searchItems( $search, $ref ); |
|
| 56 | + $this->items[$type] = $serviceManager->searchItems($search, $ref); |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - foreach( $this->items[$type] as $id => $service ) |
|
| 59 | + foreach ($this->items[$type] as $id => $service) |
|
| 60 | 60 | { |
| 61 | 61 | try |
| 62 | 62 | { |
| 63 | - $provider = $serviceManager->getProvider( $service ); |
|
| 63 | + $provider = $serviceManager->getProvider($service); |
|
| 64 | 64 | |
| 65 | - if( $provider->isAvailable( $basket ) ) { |
|
| 65 | + if ($provider->isAvailable($basket)) { |
|
| 66 | 66 | $this->providers[$type][$id] = $provider; |
| 67 | 67 | } else { |
| 68 | - unset( $this->items[$type][$id] ); |
|
| 68 | + unset($this->items[$type][$id]); |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | - catch( \Aimeos\MShop\Service\Exception $e ) |
|
| 71 | + catch (\Aimeos\MShop\Service\Exception $e) |
|
| 72 | 72 | { |
| 73 | - $msg = sprintf( 'Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id ); |
|
| 74 | - $this->getContext()->getLogger()->log( $msg, \Aimeos\MW\Logger\Base::WARN ); |
|
| 73 | + $msg = sprintf('Unable to create provider "%1$s" for service with ID "%2$s"', $service->getCode(), $id); |
|
| 74 | + $this->getContext()->getLogger()->log($msg, \Aimeos\MW\Logger\Base::WARN); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -91,16 +91,16 @@ discard block |
||
| 91 | 91 | * @throws \Aimeos\MShop\Exception If service provider isn't available |
| 92 | 92 | * @throws \Exception If an error occurs |
| 93 | 93 | */ |
| 94 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 94 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 95 | 95 | { |
| 96 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
| 97 | - return $this->providers[$type][$serviceId]->getConfigFE( $basket ); |
|
| 96 | + if (isset($this->providers[$type][$serviceId])) { |
|
| 97 | + return $this->providers[$type][$serviceId]->getConfigFE($basket); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $item = $this->getServiceItem( $type, $serviceId ); |
|
| 101 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 100 | + $item = $this->getServiceItem($type, $serviceId); |
|
| 101 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 102 | 102 | |
| 103 | - return $serviceManager->getProvider( $item )->getConfigFE( $basket ); |
|
| 103 | + return $serviceManager->getProvider($item)->getConfigFE($basket); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -115,16 +115,16 @@ discard block |
||
| 115 | 115 | * @throws \Aimeos\MShop\Exception If service provider isn't available |
| 116 | 116 | * @throws \Exception If an error occurs |
| 117 | 117 | */ |
| 118 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ) |
|
| 118 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket) |
|
| 119 | 119 | { |
| 120 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
| 121 | - return $this->providers[$type][$serviceId]->calcPrice( $basket ); |
|
| 120 | + if (isset($this->providers[$type][$serviceId])) { |
|
| 121 | + return $this->providers[$type][$serviceId]->calcPrice($basket); |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $item = $this->getServiceItem( $type, $serviceId ); |
|
| 125 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 124 | + $item = $this->getServiceItem($type, $serviceId); |
|
| 125 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 126 | 126 | |
| 127 | - return $serviceManager->getProvider( $item )->calcPrice( $basket ); |
|
| 127 | + return $serviceManager->getProvider($item)->calcPrice($basket); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
@@ -139,16 +139,16 @@ discard block |
||
| 139 | 139 | * known by the provider but aren't valid resp. null for attributes whose values are OK |
| 140 | 140 | * @throws \Aimeos\Controller\Frontend\Service\Exception If no active service provider for this ID is available |
| 141 | 141 | */ |
| 142 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ) |
|
| 142 | + public function checkServiceAttributes($type, $serviceId, array $attributes) |
|
| 143 | 143 | { |
| 144 | - if( isset( $this->providers[$type][$serviceId] ) ) { |
|
| 145 | - return $this->providers[$type][$serviceId]->checkConfigFE( $attributes ); |
|
| 144 | + if (isset($this->providers[$type][$serviceId])) { |
|
| 145 | + return $this->providers[$type][$serviceId]->checkConfigFE($attributes); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - $item = $this->getServiceItem( $type, $serviceId ); |
|
| 149 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 148 | + $item = $this->getServiceItem($type, $serviceId); |
|
| 149 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 150 | 150 | |
| 151 | - return $serviceManager->getProvider( $item )->checkConfigFE( $attributes ); |
|
| 151 | + return $serviceManager->getProvider($item)->checkConfigFE($attributes); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -159,25 +159,25 @@ discard block |
||
| 159 | 159 | * @param string $serviceId Identifier of the service option chosen by the customer |
| 160 | 160 | * @throws \Aimeos\Controller\Frontend\Service\Exception If no active service provider for this ID is available |
| 161 | 161 | */ |
| 162 | - protected function getServiceItem( $type, $serviceId ) |
|
| 162 | + protected function getServiceItem($type, $serviceId) |
|
| 163 | 163 | { |
| 164 | - $serviceManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'service' ); |
|
| 164 | + $serviceManager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'service'); |
|
| 165 | 165 | |
| 166 | - $search = $serviceManager->createSearch( true ); |
|
| 166 | + $search = $serviceManager->createSearch(true); |
|
| 167 | 167 | $expr = array( |
| 168 | 168 | $search->getConditions(), |
| 169 | - $search->compare( '==', 'service.id', $serviceId ), |
|
| 170 | - $search->compare( '==', 'service.type.domain', 'service' ), |
|
| 171 | - $search->compare( '==', 'service.type.code', $type ), |
|
| 169 | + $search->compare('==', 'service.id', $serviceId), |
|
| 170 | + $search->compare('==', 'service.type.domain', 'service'), |
|
| 171 | + $search->compare('==', 'service.type.code', $type), |
|
| 172 | 172 | ); |
| 173 | - $search->setConditions( $search->combine( '&&', $expr ) ); |
|
| 173 | + $search->setConditions($search->combine('&&', $expr)); |
|
| 174 | 174 | |
| 175 | - $items = $serviceManager->searchItems( $search, array( 'price' ) ); |
|
| 175 | + $items = $serviceManager->searchItems($search, array('price')); |
|
| 176 | 176 | |
| 177 | - if( ( $item = reset( $items ) ) === false ) |
|
| 177 | + if (($item = reset($items)) === false) |
|
| 178 | 178 | { |
| 179 | - $msg = sprintf( 'Service item for type "%1$s" and ID "%2$s" not found', $type, $serviceId ); |
|
| 180 | - throw new \Aimeos\Controller\Frontend\Service\Exception( $msg ); |
|
| 179 | + $msg = sprintf('Service item for type "%1$s" and ID "%2$s" not found', $type, $serviceId); |
|
| 180 | + throw new \Aimeos\Controller\Frontend\Service\Exception($msg); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | return $item; |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * @param array $ref List of domains for which the items referenced by the services should be fetched too |
| 30 | 30 | * @return array List of service items implementing \Aimeos\MShop\Service\Item\Iface with referenced items |
| 31 | 31 | */ |
| 32 | - public function getServices( $type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
| 33 | - $ref = array( 'media', 'price', 'text' ) ); |
|
| 32 | + public function getServices($type, \Aimeos\MShop\Order\Item\Base\Iface $basket, |
|
| 33 | + $ref = array('media', 'price', 'text')); |
|
| 34 | 34 | |
| 35 | 35 | /** |
| 36 | 36 | * Returns the list of attribute definitions which must be used to render the input form where the customer can |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object |
| 42 | 42 | * @return array List of attribute definitions implementing \Aimeos\MW\Criteria\Attribute\Iface |
| 43 | 43 | */ |
| 44 | - public function getServiceAttributes( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ); |
|
| 44 | + public function getServiceAttributes($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket); |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Returns the price of the service. |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @throws \Aimeos\MShop\Exception If service provider isn't available |
| 55 | 55 | * @throws \Exception If an error occurs |
| 56 | 56 | */ |
| 57 | - public function getServicePrice( $type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket ); |
|
| 57 | + public function getServicePrice($type, $serviceId, \Aimeos\MShop\Order\Item\Base\Iface $basket); |
|
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | 60 | * Returns a list of attributes that are invalid. |
@@ -66,5 +66,5 @@ discard block |
||
| 66 | 66 | * @return array List of key/value pairs of attributes keys and an error message for values that are invalid or |
| 67 | 67 | * missing |
| 68 | 68 | */ |
| 69 | - public function checkServiceAttributes( $type, $serviceId, array $attributes ); |
|
| 69 | + public function checkServiceAttributes($type, $serviceId, array $attributes); |
|
| 70 | 70 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | * @param string|null $name Name of the controller implementaton (default: "Standard") |
| 30 | 30 | * @return \Aimeos\Controller\Frontend\Common\Iface Controller object |
| 31 | 31 | */ |
| 32 | - public static function createController( \Aimeos\MShop\Context\Item\Iface $context, $name = null ) |
|
| 32 | + public static function createController(\Aimeos\MShop\Context\Item\Iface $context, $name = null) |
|
| 33 | 33 | { |
| 34 | 34 | /** controller/frontend/service/name |
| 35 | 35 | * Class name of the used service frontend controller implementation |
@@ -64,19 +64,19 @@ discard block |
||
| 64 | 64 | * @since 2014.03 |
| 65 | 65 | * @category Developer |
| 66 | 66 | */ |
| 67 | - if( $name === null ) { |
|
| 68 | - $name = $context->getConfig()->get( 'controller/frontend/service/name', 'Standard' ); |
|
| 67 | + if ($name === null) { |
|
| 68 | + $name = $context->getConfig()->get('controller/frontend/service/name', 'Standard'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if( ctype_alnum( $name ) === false ) { |
|
| 72 | - $classname = is_string( $name ) ? '\\Aimeos\\Controller\\Frontend\\Service\\' . $name : '<not a string>'; |
|
| 73 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
| 71 | + if (ctype_alnum($name) === false) { |
|
| 72 | + $classname = is_string($name) ? '\\Aimeos\\Controller\\Frontend\\Service\\' . $name : '<not a string>'; |
|
| 73 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in class name "%1$s"', $classname)); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | $iface = '\\Aimeos\\Controller\\Frontend\\Service\\Iface'; |
| 77 | 77 | $classname = '\\Aimeos\\Controller\\Frontend\\Service\\' . $name; |
| 78 | 78 | |
| 79 | - $manager = self::createControllerBase( $context, $classname, $iface ); |
|
| 79 | + $manager = self::createControllerBase($context, $classname, $iface); |
|
| 80 | 80 | |
| 81 | 81 | /** controller/frontend/service/decorators/excludes |
| 82 | 82 | * Excludes decorators added by the "common" option from the service frontend controllers |
@@ -152,6 +152,6 @@ discard block |
||
| 152 | 152 | * @see controller/frontend/service/decorators/excludes |
| 153 | 153 | * @see controller/frontend/service/decorators/global |
| 154 | 154 | */ |
| 155 | - return self::addControllerDecorators( $context, $manager, 'service' ); |
|
| 155 | + return self::addControllerDecorators($context, $manager, 'service'); |
|
| 156 | 156 | } |
| 157 | 157 | } |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | * @param integer $id Context ID the objects have been created with (string of \Aimeos\MShop\Context\Item\Iface) |
| 31 | 31 | * @param string $path Path describing the controller to clear, e.g. "basket" |
| 32 | 32 | */ |
| 33 | - static public function clear( $id = null, $path = null ) |
|
| 33 | + static public function clear($id = null, $path = null) |
|
| 34 | 34 | { |
| 35 | - if( $id !== null ) |
|
| 35 | + if ($id !== null) |
|
| 36 | 36 | { |
| 37 | - if( $path !== null ) { |
|
| 37 | + if ($path !== null) { |
|
| 38 | 38 | self::$controllers[$id][$path] = null; |
| 39 | 39 | } else { |
| 40 | 40 | self::$controllers[$id] = array(); |
@@ -61,37 +61,37 @@ discard block |
||
| 61 | 61 | * @param string $path Name of the domain (and sub-managers) separated by slashes, e.g "basket" |
| 62 | 62 | * @throws \Aimeos\Controller\Frontend\Exception If the given path is invalid or the manager wasn't found |
| 63 | 63 | */ |
| 64 | - static public function createController( \Aimeos\MShop\Context\Item\Iface $context, $path ) |
|
| 64 | + static public function createController(\Aimeos\MShop\Context\Item\Iface $context, $path) |
|
| 65 | 65 | { |
| 66 | - if( empty( $path ) ) { |
|
| 67 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Controller path is empty' ) ); |
|
| 66 | + if (empty($path)) { |
|
| 67 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Controller path is empty')); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | $id = (string) $context; |
| 71 | 71 | |
| 72 | - if( self::$cache === false || !isset( self::$controllers[$id][$path] ) ) |
|
| 72 | + if (self::$cache === false || !isset(self::$controllers[$id][$path])) |
|
| 73 | 73 | { |
| 74 | - $parts = explode( '/', $path ); |
|
| 74 | + $parts = explode('/', $path); |
|
| 75 | 75 | |
| 76 | - foreach( $parts as $key => $part ) |
|
| 76 | + foreach ($parts as $key => $part) |
|
| 77 | 77 | { |
| 78 | - if( ctype_alnum( $part ) === false ) { |
|
| 79 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid characters in controller name "%1$s" in "%2$s"', $part, $path ) ); |
|
| 78 | + if (ctype_alnum($part) === false) { |
|
| 79 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid characters in controller name "%1$s" in "%2$s"', $part, $path)); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $parts[$key] = ucwords( $part ); |
|
| 82 | + $parts[$key] = ucwords($part); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $factory = '\\Aimeos\\Controller\\Frontend\\' . join( '\\', $parts ) . '\\Factory'; |
|
| 85 | + $factory = '\\Aimeos\\Controller\\Frontend\\' . join('\\', $parts) . '\\Factory'; |
|
| 86 | 86 | |
| 87 | - if( class_exists( $factory ) === false ) { |
|
| 88 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Class "%1$s" not available', $factory ) ); |
|
| 87 | + if (class_exists($factory) === false) { |
|
| 88 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Class "%1$s" not available', $factory)); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - $manager = call_user_func_array( array( $factory, 'createController' ), array( $context ) ); |
|
| 91 | + $manager = call_user_func_array(array($factory, 'createController'), array($context)); |
|
| 92 | 92 | |
| 93 | - if( $manager === false ) { |
|
| 94 | - throw new \Aimeos\Controller\Frontend\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) ); |
|
| 93 | + if ($manager === false) { |
|
| 94 | + throw new \Aimeos\Controller\Frontend\Exception(sprintf('Invalid factory "%1$s"', $factory)); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | self::$controllers[$id][$path] = $manager; |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param boolean $value True to enable caching, false to disable it. |
| 108 | 108 | * @return boolean Previous cache setting |
| 109 | 109 | */ |
| 110 | - static public function setCache( $value ) |
|
| 110 | + static public function setCache($value) |
|
| 111 | 111 | { |
| 112 | 112 | $old = self::$cache; |
| 113 | 113 | self::$cache = (boolean) $value; |
@@ -27,6 +27,6 @@ |
||
| 27 | 27 | * @param \Aimeos\MShop\Context\Item\Iface $context MShop context object |
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | - public function __construct( \Aimeos\MShop\Context\Item\Iface $context ); |
|
| 30 | + public function __construct(\Aimeos\MShop\Context\Item\Iface $context); |
|
| 31 | 31 | |
| 32 | 32 | } |