Completed
Push — master ( 340b46...4b7a1c )
by Aimeos
02:58
created
admin/jqadm/src/Admin/JQAdm/Common/Decorator/Index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@
 block discarded – undo
29 29
 		$result = $this->getClient()->save();
30 30
 		$item = $this->getView()->item;
31 31
 
32
-		if( $item->getId() !== null ) {
33
-			\Aimeos\MShop\Factory::createManager( $this->getContext(), 'index' )->saveItem( $item );
32
+		if ($item->getId() !== null) {
33
+			\Aimeos\MShop\Factory::createManager($this->getContext(), 'index')->saveItem($item);
34 34
 		}
35 35
 
36 36
 		return $result;
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Common/Decorator/Page.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,24 +25,24 @@
 block discarded – undo
25 25
 	 * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output
26 26
 	 * @return \Aimeos\Admin\JQAdm\Iface Reference to this object for fluent calls
27 27
 	 */
28
-	public function setView( \Aimeos\MW\View\Iface $view )
28
+	public function setView(\Aimeos\MW\View\Iface $view)
29 29
 	{
30 30
 		$sites = array();
31 31
 		$aimeos = new \Aimeos\Bootstrap();
32
-		$manager = \Aimeos\MShop\Factory::createManager( $this->getContext(), 'locale/site' );
32
+		$manager = \Aimeos\MShop\Factory::createManager($this->getContext(), 'locale/site');
33 33
 
34 34
 		$search = $manager->createSearch();
35
-		$search->setSortations( array( $search->sort( '+', 'locale.site.label' ) ) );
35
+		$search->setSortations(array($search->sort('+', 'locale.site.label')));
36 36
 
37
-		foreach( $manager->searchItems( $search ) as $siteItem ) {
37
+		foreach ($manager->searchItems($search) as $siteItem) {
38 38
 			$sites[$siteItem->getCode()] = $siteItem->getLabel();
39 39
 		}
40 40
 
41 41
 
42 42
 		$view->pageSites = $sites;
43
-		$view->pageLanguages = $aimeos->getI18nList( 'admin' );
43
+		$view->pageLanguages = $aimeos->getI18nList('admin');
44 44
 
45
-		$this->getClient()->setView( $view );
45
+		$this->getClient()->setView($view);
46 46
 		return $this;
47 47
 	}
48 48
 }
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Common/Decorator/Iface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,6 +28,6 @@
 block discarded – undo
28 28
 	 * @param array $templatePaths Associative list of the file system paths to the core or the extensions as key
29 29
 	 * 	and a list of relative paths inside the core or the extension as values
30 30
 	 */
31
-	public function __construct( \Aimeos\Admin\JQAdm\Iface $client,
32
-		\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths );
31
+	public function __construct(\Aimeos\Admin\JQAdm\Iface $client,
32
+		\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths);
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Iface.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 * @param string|null $name Name of the sub-client (Default if null)
27 27
 	 * @return \Aimeos\Admin\JQAdm\Iface Sub-client object
28 28
 	 */
29
-	public function getSubClient( $type, $name = null );
29
+	public function getSubClient($type, $name = null);
30 30
 
31 31
 	/**
32 32
 	 * Returns the view object that will generate the admin output.
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 * @param \Aimeos\MW\View\Iface $view The view object which generates the admin output
42 42
 	 * @return \Aimeos\Admin\Html\Iface Reference to this object for fluent calls
43 43
 	 */
44
-	public function setView( \Aimeos\MW\View\Iface $view );
44
+	public function setView(\Aimeos\MW\View\Iface $view);
45 45
 
46 46
 	/**
47 47
 	 * Copies a resource
Please login to merge, or discard this patch.
admin/jqadm/src/Admin/JQAdm/Factory.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -29,29 +29,29 @@
 block discarded – undo
29 29
 	 * @return \Aimeos\Admin\JQAdm\Iface admin client implementing \Aimeos\Admin\JQAdm\Iface
30 30
 	 * @throws \Aimeos\Admin\JQAdm\Exception If requested client implementation couldn't be found or initialisation fails
31 31
 	 */
32
-	public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $type, $name = null )
32
+	public static function createClient(\Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $type, $name = null)
33 33
 	{
34
-		if( empty( $type ) ) {
35
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Admin JQAdm type is empty' ) );
34
+		if (empty($type)) {
35
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Admin JQAdm type is empty'));
36 36
 		}
37 37
 
38
-		if( ctype_alnum( $type ) === false ) {
39
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid characters in client name "%1$s"', $type ) );
38
+		if (ctype_alnum($type) === false) {
39
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid characters in client name "%1$s"', $type));
40 40
 		}
41 41
 
42
-		$factory = '\\Aimeos\\Admin\\JQAdm\\' . ucwords( $type ) . '\\Factory';
42
+		$factory = '\\Aimeos\\Admin\\JQAdm\\' . ucwords($type) . '\\Factory';
43 43
 
44
-		if( class_exists( $factory ) === false ) {
45
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Class "%1$s" not available', $factory ) );
44
+		if (class_exists($factory) === false) {
45
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Class "%1$s" not available', $factory));
46 46
 		}
47 47
 
48
-		$client = @call_user_func_array( array( $factory, 'createClient' ), array( $context, $templatePaths, $name ) );
48
+		$client = @call_user_func_array(array($factory, 'createClient'), array($context, $templatePaths, $name));
49 49
 
50
-		if( $client === false ) {
51
-			throw new \Aimeos\Admin\JQAdm\Exception( sprintf( 'Invalid factory "%1$s"', $factory ) );
50
+		if ($client === false) {
51
+			throw new \Aimeos\Admin\JQAdm\Exception(sprintf('Invalid factory "%1$s"', $factory));
52 52
 		}
53 53
 
54
-		$client->setView( $context->getView() );
54
+		$client->setView($context->getView());
55 55
 
56 56
 		return $client;
57 57
 	}
Please login to merge, or discard this patch.
admin/jqadm/tests/Admin/JQAdm/Product/Text/StandardTest.php 1 patch
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -22,38 +22,38 @@  discard block
 block discarded – undo
22 22
 		$this->context = \TestHelperJqadm::getContext();
23 23
 		$templatePaths = \TestHelperJqadm::getTemplatePaths();
24 24
 
25
-		$this->object = new \Aimeos\Admin\JQAdm\Product\Text\Standard( $this->context, $templatePaths );
26
-		$this->object->setView( $this->view );
25
+		$this->object = new \Aimeos\Admin\JQAdm\Product\Text\Standard($this->context, $templatePaths);
26
+		$this->object->setView($this->view);
27 27
 	}
28 28
 
29 29
 
30 30
 	protected function tearDown()
31 31
 	{
32
-		unset( $this->object );
32
+		unset($this->object);
33 33
 	}
34 34
 
35 35
 
36 36
 	public function testCreate()
37 37
 	{
38
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
38
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
39 39
 
40 40
 		$this->view->item = $manager->createItem();
41 41
 		$result = $this->object->create();
42 42
 
43
-		$this->assertContains( 'Texts', $result );
44
-		$this->assertNull( $this->view->get( 'errors' ) );
43
+		$this->assertContains('Texts', $result);
44
+		$this->assertNull($this->view->get('errors'));
45 45
 	}
46 46
 
47 47
 
48 48
 	public function testCopy()
49 49
 	{
50
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
50
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
51 51
 
52
-		$this->view->item = $manager->findItem( 'ABCD', array( 'text' ) );
52
+		$this->view->item = $manager->findItem('ABCD', array('text'));
53 53
 		$result = $this->object->copy();
54 54
 
55
-		$this->assertNull( $this->view->get( 'errors' ) );
56
-		$this->assertContains( 'value="Unterproduct 1"', $result );
55
+		$this->assertNull($this->view->get('errors'));
56
+		$this->assertContains('value="Unterproduct 1"', $result);
57 57
 	}
58 58
 
59 59
 
@@ -61,72 +61,72 @@  discard block
 block discarded – undo
61 61
 	{
62 62
 		$result = $this->object->delete();
63 63
 
64
-		$this->assertNull( $this->view->get( 'errors' ) );
65
-		$this->assertNull( $result );
64
+		$this->assertNull($this->view->get('errors'));
65
+		$this->assertNull($result);
66 66
 	}
67 67
 
68 68
 
69 69
 	public function testGet()
70 70
 	{
71
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
71
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
72 72
 
73
-		$this->view->item = $manager->findItem( 'ABCD', array( 'text' ) );
73
+		$this->view->item = $manager->findItem('ABCD', array('text'));
74 74
 		$result = $this->object->get();
75 75
 
76
-		$this->assertNull( $this->view->get( 'errors' ) );
77
-		$this->assertContains( 'value="Unterproduct 1"', $result );
76
+		$this->assertNull($this->view->get('errors'));
77
+		$this->assertContains('value="Unterproduct 1"', $result);
78 78
 	}
79 79
 
80 80
 
81 81
 	public function testSave()
82 82
 	{
83
-		$manager = \Aimeos\MShop\Factory::createManager( $this->context, 'product' );
83
+		$manager = \Aimeos\MShop\Factory::createManager($this->context, 'product');
84 84
 
85
-		$item = $manager->findItem( 'CNC' );
86
-		$item->setCode( 'jqadm-test-save' );
87
-		$item->setId( null );
85
+		$item = $manager->findItem('CNC');
86
+		$item->setCode('jqadm-test-save');
87
+		$item->setId(null);
88 88
 
89
-		$manager->saveItem( $item );
89
+		$manager->saveItem($item);
90 90
 
91 91
 
92 92
 		$param = array(
93 93
 			'text' => array(
94
-				'langid' => array( 'de' ),
95
-				'name' => array( 'listid' => '', 'content' => 'test name' ),
96
-				'short' => array( 'listid' => '', 'content' => 'short desc' ),
97
-				'long' => array( 'listid' => '', 'content' => 'long desc' ),
98
-				'url' => array( 'listid' => '', 'content' => 'url segment' ),
99
-				'meta-keyword' => array( 'listid' => '', 'content' => 'meta keywords' ),
100
-				'meta-description' => array( 'listid' => '', 'content' => 'meta desc' ),
94
+				'langid' => array('de'),
95
+				'name' => array('listid' => '', 'content' => 'test name'),
96
+				'short' => array('listid' => '', 'content' => 'short desc'),
97
+				'long' => array('listid' => '', 'content' => 'long desc'),
98
+				'url' => array('listid' => '', 'content' => 'url segment'),
99
+				'meta-keyword' => array('listid' => '', 'content' => 'meta keywords'),
100
+				'meta-description' => array('listid' => '', 'content' => 'meta desc'),
101 101
 			),
102 102
 		);
103 103
 
104
-		$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
105
-		$this->view->addHelper( 'param', $helper );
104
+		$helper = new \Aimeos\MW\View\Helper\Param\Standard($this->view, $param);
105
+		$this->view->addHelper('param', $helper);
106 106
 		$this->view->item = $item;
107 107
 
108 108
 		$result = $this->object->save();
109 109
 
110
-		$item = $manager->getItem( $item->getId(), array( 'text' ) );
111
-		$manager->deleteItem( $item->getId() );
110
+		$item = $manager->getItem($item->getId(), array('text'));
111
+		$manager->deleteItem($item->getId());
112 112
 
113
-		$this->assertNull( $this->view->get( 'errors' ) );
114
-		$this->assertNull( $result );
115
-		$this->assertEquals( 6, count( $item->getListItems() ) );
113
+		$this->assertNull($this->view->get('errors'));
114
+		$this->assertNull($result);
115
+		$this->assertEquals(6, count($item->getListItems()));
116 116
 
117
-		foreach( $item->getListItems( 'text' ) as $listItem )
117
+		foreach ($item->getListItems('text') as $listItem)
118 118
 		{
119
-			$this->assertEquals( 'text', $listItem->getDomain() );
120
-			$this->assertEquals( 'default', $listItem->getType() );
119
+			$this->assertEquals('text', $listItem->getDomain());
120
+			$this->assertEquals('default', $listItem->getType());
121 121
 
122 122
 			$refItem = $listItem->getRefItem();
123
-			$this->assertEquals( 'de', $refItem->getLanguageId() );
123
+			$this->assertEquals('de', $refItem->getLanguageId());
124 124
 		}
125 125
 	}
126 126
 
127 127
 
128 128
 	public function testSearch()
129 129
 	{
130
-		$this->assertNull( $this->object->search() );
130
+		$this->assertNull($this->object->search());
131 131
 	}
132 132
 }
Please login to merge, or discard this patch.
admin/jqadm/tests/TestHelperJqadm.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -13,47 +13,47 @@  discard block
 block discarded – undo
13 13
 	public static function bootstrap()
14 14
 	{
15 15
 		self::getAimeos();
16
-		\Aimeos\MShop\Factory::setCache( false );
16
+		\Aimeos\MShop\Factory::setCache(false);
17 17
 	}
18 18
 
19 19
 
20
-	public static function getContext( $site = 'unittest' )
20
+	public static function getContext($site = 'unittest')
21 21
 	{
22
-		if( !isset( self::$context[$site] ) ) {
23
-			self::$context[$site] = self::createContext( $site );
22
+		if (!isset(self::$context[$site])) {
23
+			self::$context[$site] = self::createContext($site);
24 24
 		}
25 25
 
26 26
 		return clone self::$context[$site];
27 27
 	}
28 28
 
29 29
 
30
-	public static function getView( $site = 'unittest', \Aimeos\MW\Config\Iface $config = null )
30
+	public static function getView($site = 'unittest', \Aimeos\MW\Config\Iface $config = null)
31 31
 	{
32
-		if( $config === null ) {
33
-			$config = self::getContext( $site )->getConfig();
32
+		if ($config === null) {
33
+			$config = self::getContext($site)->getConfig();
34 34
 		}
35 35
 
36
-		$view = new \Aimeos\MW\View\Standard( self::getTemplatePaths() );
36
+		$view = new \Aimeos\MW\View\Standard(self::getTemplatePaths());
37 37
 
38
-		$trans = new \Aimeos\MW\Translation\None( 'de_DE' );
39
-		$helper = new \Aimeos\MW\View\Helper\Translate\Standard( $view, $trans );
40
-		$view->addHelper( 'translate', $helper );
38
+		$trans = new \Aimeos\MW\Translation\None('de_DE');
39
+		$helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $trans);
40
+		$view->addHelper('translate', $helper);
41 41
 
42
-		$helper = new \Aimeos\MW\View\Helper\Url\Standard( $view, 'http://baseurl' );
43
-		$view->addHelper( 'url', $helper );
42
+		$helper = new \Aimeos\MW\View\Helper\Url\Standard($view, 'http://baseurl');
43
+		$view->addHelper('url', $helper);
44 44
 
45
-		$helper = new \Aimeos\MW\View\Helper\Number\Standard( $view, '.', '' );
46
-		$view->addHelper( 'number', $helper );
45
+		$helper = new \Aimeos\MW\View\Helper\Number\Standard($view, '.', '');
46
+		$view->addHelper('number', $helper);
47 47
 
48
-		$helper = new \Aimeos\MW\View\Helper\Date\Standard( $view, 'Y-m-d' );
49
-		$view->addHelper( 'date', $helper );
48
+		$helper = new \Aimeos\MW\View\Helper\Date\Standard($view, 'Y-m-d');
49
+		$view->addHelper('date', $helper);
50 50
 
51
-		$config = new \Aimeos\MW\Config\Decorator\Protect( $config, array( 'admin', 'client/html', 'controller/jsonadm' ) );
52
-		$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $config );
53
-		$view->addHelper( 'config', $helper );
51
+		$config = new \Aimeos\MW\Config\Decorator\Protect($config, array('admin', 'client/html', 'controller/jsonadm'));
52
+		$helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
53
+		$view->addHelper('config', $helper);
54 54
 
55
-		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard( $view, '_csrf_token', '_csrf_value' );
56
-		$view->addHelper( 'csrf', $helper );
55
+		$helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_csrf_token', '_csrf_value');
56
+		$view->addHelper('csrf', $helper);
57 57
 
58 58
 		return $view;
59 59
 	}
@@ -61,19 +61,19 @@  discard block
 block discarded – undo
61 61
 
62 62
 	public static function getTemplatePaths()
63 63
 	{
64
-		return self::getAimeos()->getCustomPaths( 'admin/jqadm/templates' );
64
+		return self::getAimeos()->getCustomPaths('admin/jqadm/templates');
65 65
 	}
66 66
 
67 67
 
68 68
 	private static function getAimeos()
69 69
 	{
70
-		if( !isset( self::$aimeos ) )
70
+		if (!isset(self::$aimeos))
71 71
 		{
72 72
 			require_once 'Bootstrap.php';
73
-			spl_autoload_register( 'Aimeos\\Bootstrap::autoload' );
73
+			spl_autoload_register('Aimeos\\Bootstrap::autoload');
74 74
 
75
-			$extdir = dirname( dirname( dirname( dirname( __FILE__ ) ) ) );
76
-			self::$aimeos = new \Aimeos\Bootstrap( array( $extdir ), false );
75
+			$extdir = dirname(dirname(dirname(dirname(__FILE__))));
76
+			self::$aimeos = new \Aimeos\Bootstrap(array($extdir), false);
77 77
 		}
78 78
 
79 79
 		return self::$aimeos;
@@ -83,53 +83,53 @@  discard block
 block discarded – undo
83 83
 	/**
84 84
 	 * @param string $site
85 85
 	 */
86
-	private static function createContext( $site )
86
+	private static function createContext($site)
87 87
 	{
88 88
 		$ctx = new \Aimeos\MShop\Context\Item\Standard();
89 89
 		$aimeos = self::getAimeos();
90 90
 
91 91
 
92
-		$paths = $aimeos->getConfigPaths( 'mysql' );
92
+		$paths = $aimeos->getConfigPaths('mysql');
93 93
 		$paths[] = __DIR__ . DIRECTORY_SEPARATOR . 'config';
94 94
 		$file = __DIR__ . DIRECTORY_SEPARATOR . 'confdoc.ser';
95
-		$local = array( 'resource' => array( 'fs' => array( 'adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp' ) ) );
95
+		$local = array('resource' => array('fs' => array('adapter' => 'Standard', 'basedir' => __DIR__ . '/tmp')));
96 96
 
97
-		$conf = new \Aimeos\MW\Config\PHPArray( $local, $paths );
98
-		$conf = new \Aimeos\MW\Config\Decorator\Memory( $conf );
99
-		$conf = new \Aimeos\MW\Config\Decorator\Documentor( $conf, $file );
100
-		$ctx->setConfig( $conf );
97
+		$conf = new \Aimeos\MW\Config\PHPArray($local, $paths);
98
+		$conf = new \Aimeos\MW\Config\Decorator\Memory($conf);
99
+		$conf = new \Aimeos\MW\Config\Decorator\Documentor($conf, $file);
100
+		$ctx->setConfig($conf);
101 101
 
102 102
 
103
-		$dbm = new \Aimeos\MW\DB\Manager\PDO( $conf );
104
-		$ctx->setDatabaseManager( $dbm );
103
+		$dbm = new \Aimeos\MW\DB\Manager\PDO($conf);
104
+		$ctx->setDatabaseManager($dbm);
105 105
 
106 106
 
107
-		$fs = new \Aimeos\MW\Filesystem\Manager\Standard( $conf );
108
-		$ctx->setFilesystemManager( $fs );
107
+		$fs = new \Aimeos\MW\Filesystem\Manager\Standard($conf);
108
+		$ctx->setFilesystemManager($fs);
109 109
 
110 110
 
111
-		$logger = new \Aimeos\MW\Logger\File( $site . '.log', \Aimeos\MW\Logger\Base::DEBUG );
112
-		$ctx->setLogger( $logger );
111
+		$logger = new \Aimeos\MW\Logger\File($site . '.log', \Aimeos\MW\Logger\Base::DEBUG);
112
+		$ctx->setLogger($logger);
113 113
 
114 114
 
115 115
 		$cache = new \Aimeos\MW\Cache\None();
116
-		$ctx->setCache( $cache );
116
+		$ctx->setCache($cache);
117 117
 
118 118
 
119
-		$i18n = new \Aimeos\MW\Translation\None( 'de' );
120
-		$ctx->setI18n( array( 'de' => $i18n ) );
119
+		$i18n = new \Aimeos\MW\Translation\None('de');
120
+		$ctx->setI18n(array('de' => $i18n));
121 121
 
122 122
 
123 123
 		$session = new \Aimeos\MW\Session\None();
124
-		$ctx->setSession( $session );
124
+		$ctx->setSession($session);
125 125
 
126 126
 
127
-		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager( $ctx );
128
-		$locale = $localeManager->bootstrap( $site, '', '', false );
129
-		$ctx->setLocale( $locale );
127
+		$localeManager = \Aimeos\MShop\Locale\Manager\Factory::createManager($ctx);
128
+		$locale = $localeManager->bootstrap($site, '', '', false);
129
+		$ctx->setLocale($locale);
130 130
 
131 131
 
132
-		$ctx->setEditor( 'core:admin/jqadm' );
132
+		$ctx->setEditor('core:admin/jqadm');
133 133
 
134 134
 		return $ctx;
135 135
 	}
Please login to merge, or discard this patch.