Completed
Push — feature/0.7.0 ( 91054f...38440f )
by Ryuichi
04:10
created

CoreController::__customAnnotation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
namespace WebStream\Core;
3
4
use WebStream\Delegate\Resolver;
5
use WebStream\DI\Injector;
6
use WebStream\Module\Container;
7
use WebStream\Annotation\Filter;
8
use WebStream\Annotation\Base\IAnnotatable;
9
10
/**
11
 * CoreControllerクラス
12
 * @author Ryuichi TANAKA.
13
 * @since 2011/09/11
14
 * @version 0.4.2
15
 */
16
class CoreController implements CoreInterface, IAnnotatable
17
{
18
    use Injector;
19
20
    /**
21
     * @var Session セッション
22
     */
23
    protected $session;
24
25
    /**
26
     * @var Request リクエスト
27
     */
28
    protected $request;
29
30
    /**
31
     * @var Response レスポンス
32
     */
33
    private $response;
0 ignored issues
show
Unused Code introduced by
The property $response is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
34
35
    /**
36
     * @var CoreDelegator コアデリゲータ
37
     */
38
    private $coreDelegator;
39
40
    /**
41
     * @var array<mixed> カスタムアノテーション
42
     */
43
    protected $annotation;
44
45
    /**
46
     * @var LoggerAdapter ロガー
47
     */
48
    protected $logger;
49
50
    /**
51
     * destructor
52
     */
53
    public function __destruct()
54
    {
55
        $this->logger->debug("Controller end.");
56
        $this->__clear();
57
    }
58
59
    /**
60
     * 静的ファイルを読み込む
61
     * @param string 静的ファイルパス
62
     */
63
    final public function __callStaticFile($filepath)
64
    {
65
        $this->coreDelegator->getView()->__file($filepath);
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     */
71
    public function __customAnnotation(array $annotation)
72
    {
73
        $this->annotation = $annotation;
74
    }
75
76
    /**
77
     * {@inheritdoc}
78
     * @Filter(type="initialize")
79
     */
80
    public function __initialize(Container $container)
81
    {
82
        $pageName = $this->coreDelegator->getPageName();
83
        $resolver = new Resolver($container);
84
        $this->{$pageName} = $resolver->runService() ?: $resolver->runModel();
85
    }
86
}
87