@@ 20-94 (lines=75) @@ | ||
17 | * @package Client |
|
18 | * @subpackage JsonApi |
|
19 | */ |
|
20 | class Factory |
|
21 | extends \Aimeos\Client\JsonApi\Common\Factory\Base |
|
22 | implements \Aimeos\Client\JsonApi\Common\Factory\Iface |
|
23 | { |
|
24 | /** |
|
25 | * Creates a attribute client object. |
|
26 | * |
|
27 | * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
28 | * @param array $templatePaths List of file system paths where the templates are stored |
|
29 | * @param string $path Name of the client separated by slashes, e.g "product" |
|
30 | * @param string|null $name Client name (default: "Standard") |
|
31 | * @return \Aimeos\Client\JsonApi\Iface JSON API client |
|
32 | * @throws \Aimeos\Client\JsonApi\Exception If requested client implementation couldn't be found or initialisation fails |
|
33 | */ |
|
34 | public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $path, $name = null ) |
|
35 | { |
|
36 | if( ctype_alnum( $path ) === false ) |
|
37 | { |
|
38 | $path = ( is_string( $path ) ? $path : '<not a string>' ); |
|
39 | throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid client "%1$s"', $path ), 400 ); |
|
40 | } |
|
41 | ||
42 | /** client/jsonapi/attribute/name |
|
43 | * Class name of the used attribute client implementation |
|
44 | * |
|
45 | * Each default JSON API client can be replace by an alternative imlementation. |
|
46 | * To use this implementation, you have to set the last part of the class |
|
47 | * name as configuration value so the client factory knows which class it |
|
48 | * has to instantiate. |
|
49 | * |
|
50 | * For example, if the name of the default class is |
|
51 | * |
|
52 | * \Aimeos\Client\JsonApi\Attribute\Standard |
|
53 | * |
|
54 | * and you want to replace it with your own version named |
|
55 | * |
|
56 | * \Aimeos\Client\JsonApi\Attribute\Myattribute |
|
57 | * |
|
58 | * then you have to set the this configuration option: |
|
59 | * |
|
60 | * client/jsonapi/attribute/name = Myattribute |
|
61 | * |
|
62 | * The value is the last part of your own class name and it's case sensitive, |
|
63 | * so take care that the configuration value is exactly named like the last |
|
64 | * part of the class name. |
|
65 | * |
|
66 | * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
67 | * characters are possible! You should always start the last part of the class |
|
68 | * name with an upper case character and continue only with lower case characters |
|
69 | * or numbers. Avoid chamel case names like "MyAttribute"! |
|
70 | * |
|
71 | * @param string Last part of the class name |
|
72 | * @since 2017.03 |
|
73 | * @category Developer |
|
74 | */ |
|
75 | if( $name === null ) { |
|
76 | $name = $context->getConfig()->get( 'client/jsonapi/attribute/name', 'Standard' ); |
|
77 | } |
|
78 | ||
79 | if( ctype_alnum( $name ) === false ) |
|
80 | { |
|
81 | $classname = is_string( $name ) ? '\\Aimeos\\Client\\JsonApi\\Attribute\\' . $name : '<not a string>'; |
|
82 | throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
83 | } |
|
84 | ||
85 | $view = $context->getView(); |
|
86 | $iface = '\\Aimeos\\Client\\JsonApi\\Iface'; |
|
87 | $classname = '\\Aimeos\\Client\\JsonApi\\Attribute\\' . $name; |
|
88 | ||
89 | $client = self::createClientBase( $classname, $iface, $context, $view, $templatePaths, $path ); |
|
90 | ||
91 | return self::addClientDecorators( $client, $context, $view, $templatePaths, $path ); |
|
92 | } |
|
93 | ||
94 | } |
|
95 | ||
96 |
@@ 20-94 (lines=75) @@ | ||
17 | * @package Client |
|
18 | * @subpackage JsonApi |
|
19 | */ |
|
20 | class Factory |
|
21 | extends \Aimeos\Client\JsonApi\Common\Factory\Base |
|
22 | implements \Aimeos\Client\JsonApi\Common\Factory\Iface |
|
23 | { |
|
24 | /** |
|
25 | * Creates a catalog client object. |
|
26 | * |
|
27 | * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
28 | * @param array $templatePaths List of file system paths where the templates are stored |
|
29 | * @param string $path Name of the client separated by slashes, e.g "product" |
|
30 | * @param string|null $name Client name (default: "Standard") |
|
31 | * @return \Aimeos\Client\JsonApi\Iface JSON API client |
|
32 | * @throws \Aimeos\Client\JsonApi\Exception If requested client implementation couldn't be found or initialisation fails |
|
33 | */ |
|
34 | public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $path, $name = null ) |
|
35 | { |
|
36 | if( ctype_alnum( $path ) === false ) |
|
37 | { |
|
38 | $path = ( is_string( $path ) ? $path : '<not a string>' ); |
|
39 | throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid client "%1$s"', $path ), 400 ); |
|
40 | } |
|
41 | ||
42 | /** client/jsonapi/catalog/name |
|
43 | * Class name of the used catalog client implementation |
|
44 | * |
|
45 | * Each default JSON API client can be replace by an alternative imlementation. |
|
46 | * To use this implementation, you have to set the last part of the class |
|
47 | * name as configuration value so the client factory knows which class it |
|
48 | * has to instantiate. |
|
49 | * |
|
50 | * For example, if the name of the default class is |
|
51 | * |
|
52 | * \Aimeos\Client\JsonApi\Catalog\Standard |
|
53 | * |
|
54 | * and you want to replace it with your own version named |
|
55 | * |
|
56 | * \Aimeos\Client\JsonApi\Catalog\Mycatalog |
|
57 | * |
|
58 | * then you have to set the this configuration option: |
|
59 | * |
|
60 | * client/jsonapi/catalog/name = Mycatalog |
|
61 | * |
|
62 | * The value is the last part of your own class name and it's case sensitive, |
|
63 | * so take care that the configuration value is exactly named like the last |
|
64 | * part of the class name. |
|
65 | * |
|
66 | * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
67 | * characters are possible! You should always start the last part of the class |
|
68 | * name with an upper case character and continue only with lower case characters |
|
69 | * or numbers. Avoid chamel case names like "MyCatalog"! |
|
70 | * |
|
71 | * @param string Last part of the class name |
|
72 | * @since 2017.03 |
|
73 | * @category Developer |
|
74 | */ |
|
75 | if( $name === null ) { |
|
76 | $name = $context->getConfig()->get( 'client/jsonapi/catalog/name', 'Standard' ); |
|
77 | } |
|
78 | ||
79 | if( ctype_alnum( $name ) === false ) |
|
80 | { |
|
81 | $classname = is_string( $name ) ? '\\Aimeos\\Client\\JsonApi\\Catalog\\' . $name : '<not a string>'; |
|
82 | throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
83 | } |
|
84 | ||
85 | $view = $context->getView(); |
|
86 | $iface = '\\Aimeos\\Client\\JsonApi\\Iface'; |
|
87 | $classname = '\\Aimeos\\Client\\JsonApi\\Catalog\\' . $name; |
|
88 | ||
89 | $client = self::createClientBase( $classname, $iface, $context, $view, $templatePaths, $path ); |
|
90 | ||
91 | return self::addClientDecorators( $client, $context, $view, $templatePaths, $path ); |
|
92 | } |
|
93 | ||
94 | } |
|
95 | ||
96 |
@@ 20-94 (lines=75) @@ | ||
17 | * @package Client |
|
18 | * @subpackage JsonApi |
|
19 | */ |
|
20 | class Factory |
|
21 | extends \Aimeos\Client\JsonApi\Common\Factory\Base |
|
22 | implements \Aimeos\Client\JsonApi\Common\Factory\Iface |
|
23 | { |
|
24 | /** |
|
25 | * Creates a product client object. |
|
26 | * |
|
27 | * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
28 | * @param array $templatePaths List of file system paths where the templates are stored |
|
29 | * @param string $path Name of the client separated by slashes, e.g "product" |
|
30 | * @param string|null $name Client name (default: "Standard") |
|
31 | * @return \Aimeos\Client\JsonApi\Iface JSON API client |
|
32 | * @throws \Aimeos\Client\JsonApi\Exception If requested client implementation couldn't be found or initialisation fails |
|
33 | */ |
|
34 | public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $path, $name = null ) |
|
35 | { |
|
36 | if( ctype_alnum( $path ) === false ) |
|
37 | { |
|
38 | $path = ( is_string( $path ) ? $path : '<not a string>' ); |
|
39 | throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid client "%1$s"', $path ), 400 ); |
|
40 | } |
|
41 | ||
42 | /** client/jsonapi/product/name |
|
43 | * Class name of the used product client implementation |
|
44 | * |
|
45 | * Each default JSON API client can be replace by an alternative imlementation. |
|
46 | * To use this implementation, you have to set the last part of the class |
|
47 | * name as configuration value so the client factory knows which class it |
|
48 | * has to instantiate. |
|
49 | * |
|
50 | * For example, if the name of the default class is |
|
51 | * |
|
52 | * \Aimeos\Client\JsonApi\Product\Standard |
|
53 | * |
|
54 | * and you want to replace it with your own version named |
|
55 | * |
|
56 | * \Aimeos\Client\JsonApi\Product\Myproduct |
|
57 | * |
|
58 | * then you have to set the this configuration option: |
|
59 | * |
|
60 | * client/jsonapi/product/name = Myproduct |
|
61 | * |
|
62 | * The value is the last part of your own class name and it's case sensitive, |
|
63 | * so take care that the configuration value is exactly named like the last |
|
64 | * part of the class name. |
|
65 | * |
|
66 | * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
67 | * characters are possible! You should always start the last part of the class |
|
68 | * name with an upper case character and continue only with lower case characters |
|
69 | * or numbers. Avoid chamel case names like "MyProduct"! |
|
70 | * |
|
71 | * @param string Last part of the class name |
|
72 | * @since 2017.03 |
|
73 | * @category Developer |
|
74 | */ |
|
75 | if( $name === null ) { |
|
76 | $name = $context->getConfig()->get( 'client/jsonapi/product/name', 'Standard' ); |
|
77 | } |
|
78 | ||
79 | if( ctype_alnum( $name ) === false ) |
|
80 | { |
|
81 | $classname = is_string( $name ) ? '\\Aimeos\\Client\\JsonApi\\Product\\' . $name : '<not a string>'; |
|
82 | throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
83 | } |
|
84 | ||
85 | $view = $context->getView(); |
|
86 | $iface = '\\Aimeos\\Client\\JsonApi\\Iface'; |
|
87 | $classname = '\\Aimeos\\Client\\JsonApi\\Product\\' . $name; |
|
88 | ||
89 | $client = self::createClientBase( $classname, $iface, $context, $view, $templatePaths, $path ); |
|
90 | ||
91 | return self::addClientDecorators( $client, $context, $view, $templatePaths, $path ); |
|
92 | } |
|
93 | ||
94 | } |
|
95 | ||
96 |
@@ 20-94 (lines=75) @@ | ||
17 | * @package Client |
|
18 | * @subpackage JsonApi |
|
19 | */ |
|
20 | class Factory |
|
21 | extends \Aimeos\Client\JsonApi\Common\Factory\Base |
|
22 | implements \Aimeos\Client\JsonApi\Common\Factory\Iface |
|
23 | { |
|
24 | /** |
|
25 | * Creates a stock client object. |
|
26 | * |
|
27 | * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
28 | * @param array $templatePaths List of file system paths where the templates are stored |
|
29 | * @param string $path Name of the client separated by slashes, e.g "product" |
|
30 | * @param string|null $name Client name (default: "Standard") |
|
31 | * @return \Aimeos\Client\JsonApi\Iface JSON API client |
|
32 | * @throws \Aimeos\Client\JsonApi\Exception If requested client implementation couldn't be found or initialisation fails |
|
33 | */ |
|
34 | public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $path, $name = null ) |
|
35 | { |
|
36 | if( ctype_alnum( $path ) === false ) |
|
37 | { |
|
38 | $path = ( is_string( $path ) ? $path : '<not a string>' ); |
|
39 | throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid client "%1$s"', $path ), 400 ); |
|
40 | } |
|
41 | ||
42 | /** client/jsonapi/stock/name |
|
43 | * Class name of the used stock client implementation |
|
44 | * |
|
45 | * Each default JSON API client can be replace by an alternative imlementation. |
|
46 | * To use this implementation, you have to set the last part of the class |
|
47 | * name as configuration value so the client factory knows which class it |
|
48 | * has to instantiate. |
|
49 | * |
|
50 | * For example, if the name of the default class is |
|
51 | * |
|
52 | * \Aimeos\Client\JsonApi\Stock\Standard |
|
53 | * |
|
54 | * and you want to replace it with your own version named |
|
55 | * |
|
56 | * \Aimeos\Client\JsonApi\Stock\Mystock |
|
57 | * |
|
58 | * then you have to set the this configuration option: |
|
59 | * |
|
60 | * client/jsonapi/stock/name = Mystock |
|
61 | * |
|
62 | * The value is the last part of your own class name and it's case sensitive, |
|
63 | * so take care that the configuration value is exactly named like the last |
|
64 | * part of the class name. |
|
65 | * |
|
66 | * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
67 | * characters are possible! You should always start the last part of the class |
|
68 | * name with an upper case character and continue only with lower case characters |
|
69 | * or numbers. Avoid chamel case names like "MyStock"! |
|
70 | * |
|
71 | * @param string Last part of the class name |
|
72 | * @since 2017.03 |
|
73 | * @category Developer |
|
74 | */ |
|
75 | if( $name === null ) { |
|
76 | $name = $context->getConfig()->get( 'client/jsonapi/stock/name', 'Standard' ); |
|
77 | } |
|
78 | ||
79 | if( ctype_alnum( $name ) === false ) |
|
80 | { |
|
81 | $classname = is_string( $name ) ? '\\Aimeos\\Client\\JsonApi\\Stock\\' . $name : '<not a string>'; |
|
82 | throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
83 | } |
|
84 | ||
85 | $view = $context->getView(); |
|
86 | $iface = '\\Aimeos\\Client\\JsonApi\\Iface'; |
|
87 | $classname = '\\Aimeos\\Client\\JsonApi\\Stock\\' . $name; |
|
88 | ||
89 | $client = self::createClientBase( $classname, $iface, $context, $view, $templatePaths, $path ); |
|
90 | ||
91 | return self::addClientDecorators( $client, $context, $view, $templatePaths, $path ); |
|
92 | } |
|
93 | ||
94 | } |
|
95 | ||
96 |
@@ 20-94 (lines=75) @@ | ||
17 | * @package Client |
|
18 | * @subpackage JsonApi |
|
19 | */ |
|
20 | class Factory |
|
21 | extends \Aimeos\Client\JsonApi\Common\Factory\Base |
|
22 | implements \Aimeos\Client\JsonApi\Common\Factory\Iface |
|
23 | { |
|
24 | /** |
|
25 | * Creates a locale client object. |
|
26 | * |
|
27 | * @param \Aimeos\MShop\Context\Item\Iface $context Shop context instance with necessary objects |
|
28 | * @param array $templatePaths List of file system paths where the templates are stored |
|
29 | * @param string $path Name of the client separated by slashes, e.g "product" |
|
30 | * @param string|null $name Client name (default: "Standard") |
|
31 | * @return \Aimeos\Client\JsonApi\Iface JSON API client |
|
32 | * @throws \Aimeos\Client\JsonApi\Exception If requested client implementation couldn't be found or initialisation fails |
|
33 | */ |
|
34 | public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $path, $name = null ) |
|
35 | { |
|
36 | if( ctype_alnum( $path ) === false ) |
|
37 | { |
|
38 | $path = ( is_string( $path ) ? $path : '<not a string>' ); |
|
39 | throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid client "%1$s"', $path ), 400 ); |
|
40 | } |
|
41 | ||
42 | /** client/jsonapi/locale/name |
|
43 | * Class name of the used locale client implementation |
|
44 | * |
|
45 | * Each default JSON API client can be replace by an alternative imlementation. |
|
46 | * To use this implementation, you have to set the last part of the class |
|
47 | * name as configuration value so the client factory knows which class it |
|
48 | * has to instantiate. |
|
49 | * |
|
50 | * For example, if the name of the default class is |
|
51 | * |
|
52 | * \Aimeos\Client\JsonApi\Locale\Standard |
|
53 | * |
|
54 | * and you want to replace it with your own version named |
|
55 | * |
|
56 | * \Aimeos\Client\JsonApi\Locale\Mylocale |
|
57 | * |
|
58 | * then you have to set the this configuration option: |
|
59 | * |
|
60 | * client/jsonapi/locale/name = Mylocale |
|
61 | * |
|
62 | * The value is the last part of your own class name and it's case sensitive, |
|
63 | * so take care that the configuration value is exactly named like the last |
|
64 | * part of the class name. |
|
65 | * |
|
66 | * The allowed characters of the class name are A-Z, a-z and 0-9. No other |
|
67 | * characters are possible! You should always start the last part of the class |
|
68 | * name with an upper case character and continue only with lower case characters |
|
69 | * or numbers. Avoid chamel case names like "MyLocale"! |
|
70 | * |
|
71 | * @param string Last part of the class name |
|
72 | * @since 2017.03 |
|
73 | * @category Developer |
|
74 | */ |
|
75 | if( $name === null ) { |
|
76 | $name = $context->getConfig()->get( 'client/jsonapi/locale/name', 'Standard' ); |
|
77 | } |
|
78 | ||
79 | if( ctype_alnum( $name ) === false ) |
|
80 | { |
|
81 | $classname = is_string( $name ) ? '\\Aimeos\\Client\\JsonApi\\Locale\\' . $name : '<not a string>'; |
|
82 | throw new \Aimeos\Client\JsonApi\Exception( sprintf( 'Invalid characters in class name "%1$s"', $classname ) ); |
|
83 | } |
|
84 | ||
85 | $view = $context->getView(); |
|
86 | $iface = '\\Aimeos\\Client\\JsonApi\\Iface'; |
|
87 | $classname = '\\Aimeos\\Client\\JsonApi\\Locale\\' . $name; |
|
88 | ||
89 | $client = self::createClientBase( $classname, $iface, $context, $view, $templatePaths, $path ); |
|
90 | ||
91 | return self::addClientDecorators( $client, $context, $view, $templatePaths, $path ); |
|
92 | } |
|
93 | ||
94 | } |
|
95 | ||
96 |