Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
84.00% |
21 / 25 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
LoginSelect | |
84.00% |
21 / 25 |
|
0.00% |
0 / 1 |
6.15 | |
0.00% |
0 / 1 |
__construct | |
84.00% |
21 / 25 |
|
0.00% |
0 / 1 |
6.15 |
1 | <?php |
2 | namespace Apie\HtmlBuilders\Components\Layout; |
3 | |
4 | use Apie\Core\ContextConstants; |
5 | use Apie\HtmlBuilders\Components\BaseComponent; |
6 | use Apie\HtmlBuilders\Components\Dashboard\RawContents; |
7 | use Apie\HtmlBuilders\Configuration\CurrentConfiguration; |
8 | use Apie\HtmlBuilders\Lists\ComponentHashmap; |
9 | |
10 | class LoginSelect extends BaseComponent |
11 | { |
12 | public function __construct( |
13 | CurrentConfiguration $currentConfiguration |
14 | ) { |
15 | $loginOptions = []; |
16 | $boundedContext = $currentConfiguration->getSelectedBoundedContext(); |
17 | if ($boundedContext) { |
18 | foreach ($boundedContext->actions->filterOnApieContext($currentConfiguration->getApieContext()) as $method) { |
19 | if ($method->name==='verifyAuthentication' || $method->name==='login') { |
20 | $loginOptions[] = [ |
21 | 'name' => $method->getDeclaringClass()->getShortName(), |
22 | 'value' => $currentConfiguration->getContextUrl( |
23 | '/action/' . $method->getDeclaringClass()->getShortName() . '/' . $method->name |
24 | ), |
25 | ]; |
26 | } |
27 | } |
28 | } |
29 | $profile = new RawContents(''); |
30 | if ($currentConfiguration->getApieContext()->hasContext(ContextConstants::AUTHENTICATED_USER)) { |
31 | $profile = new ShowProfile( |
32 | $currentConfiguration, |
33 | $currentConfiguration->getApieContext()->getContext(ContextConstants::AUTHENTICATED_USER) |
34 | ); |
35 | } |
36 | parent::__construct( |
37 | [ |
38 | 'loginOptions' => $loginOptions, |
39 | ], |
40 | new ComponentHashmap([ |
41 | 'profile' => $profile, |
42 | ]) |
43 | ); |
44 | } |
45 | } |