1 | <?php |
||
22 | class AccountCommand extends AbstractCommand |
||
23 | { |
||
24 | /** |
||
25 | * The name and signature of the console command. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $signature = 'aimeos:account |
||
30 | {email? : E-Mail adress of the (admin) user (will ask for if not given)} |
||
31 | {site=default : Site to create account for} |
||
32 | {--password= : Secret password for the account (will ask for if not given)} |
||
33 | {--super : If account should have super user privileges for all sites} |
||
34 | {--admin : If account should have site administrator privileges} |
||
35 | {--editor : If account should have limited editor privileges} |
||
36 | {--viewer : If account should only have view privileges only} |
||
37 | {--api : If account should be able to access the APIs} |
||
38 | '; |
||
39 | |||
40 | /** |
||
41 | * The console command description. |
||
42 | * |
||
43 | * @var string |
||
44 | */ |
||
45 | protected $description = 'Creates new (admin) accounts'; |
||
46 | |||
47 | |||
48 | /** |
||
49 | * Execute the console command. |
||
50 | * |
||
51 | * @return mixed |
||
52 | */ |
||
53 | public function handle() |
||
92 | |||
93 | |||
94 | /** |
||
95 | * Associates the user to the group by their given IDs |
||
96 | * |
||
97 | * @param \Aimeos\MShop\Context\Item\Iface $context Aimeos context object |
||
98 | * @param string $userid Unique user ID |
||
99 | * @param string $groupid Unique group ID |
||
100 | */ |
||
101 | protected function addListItem( \Aimeos\MShop\Context\Item\Iface $context, $userid, $groupid ) |
||
130 | |||
131 | |||
132 | /** |
||
133 | * Adds the group to the given user |
||
134 | * |
||
135 | * @param \Aimeos\MShop\Context\Item\Iface $context Aimeos context object |
||
136 | * @param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object |
||
137 | * @param string $group Unique customer group code |
||
138 | */ |
||
139 | protected function addGroup( \Aimeos\MShop\Context\Item\Iface $context, \Aimeos\MShop\Customer\Item\Iface $user, $group ) |
||
147 | |||
148 | |||
149 | /** |
||
150 | * Returns the customer item for the given e-mail and set its password |
||
151 | * |
||
152 | * If the customer doesn't exist yet, it will be created. |
||
153 | * |
||
154 | * @param \Aimeos\MShop\Context\Item\Iface $context Aimeos context object |
||
155 | * @param string $email Unique e-mail address |
||
156 | * @param string $password New user password |
||
157 | * @return \Aimeos\MShop\Customer\Item\Iface Aimeos customer item object |
||
158 | */ |
||
159 | protected function createCustomerItem( \Aimeos\MShop\Context\Item\Iface $context, $email, $password ) |
||
179 | |||
180 | |||
181 | /** |
||
182 | * Get the console command arguments. |
||
183 | * |
||
184 | * @return array |
||
185 | */ |
||
186 | protected function getArguments() |
||
193 | |||
194 | |||
195 | /** |
||
196 | * Returns the customer group item for the given code |
||
197 | * |
||
198 | * @param \Aimeos\MShop\Context\Item\Iface $context Aimeos context object |
||
199 | * @param string $code Unique customer group code |
||
200 | * @return \Aimeos\MShop\Customer\Item\Group\Iface Aimeos customer group item object |
||
201 | */ |
||
202 | protected function getGroupItem( \Aimeos\MShop\Context\Item\Iface $context, $code ) |
||
221 | |||
222 | |||
223 | /** |
||
224 | * Get the console command options. |
||
225 | * |
||
226 | * @return array |
||
227 | */ |
||
228 | protected function getOptions() |
||
238 | } |
||
239 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.