1 | <?php |
||
18 | class Module |
||
19 | { |
||
20 | /** @var YF\Modules\Base\Model\Module[] Module model cache. */ |
||
21 | protected static $cache; |
||
22 | |||
23 | /** @var string Module name. */ |
||
24 | protected $moduleName; |
||
25 | |||
26 | /** @var array Fields. */ |
||
27 | protected $fields; |
||
28 | |||
29 | /** @var array Fields models. */ |
||
30 | protected $fieldsModels; |
||
31 | |||
32 | protected $defaultView = 'ListView'; |
||
33 | |||
34 | /** |
||
35 | * Get module model instance. |
||
36 | * |
||
37 | * @param string $moduleName |
||
38 | * |
||
39 | * @return self |
||
|
|||
40 | */ |
||
41 | public static function getInstance(string $moduleName): self |
||
49 | |||
50 | /** |
||
51 | * Constructor function. |
||
52 | * |
||
53 | * @param string $moduleName |
||
54 | */ |
||
55 | public function __construct(string $moduleName) |
||
59 | |||
60 | /** |
||
61 | * Function to check permission for a Module/Action. |
||
62 | * |
||
63 | * @param string $module |
||
64 | * @param string $action |
||
65 | * |
||
66 | * @return bool |
||
67 | */ |
||
68 | public static function isPermitted(string $module, string $action) |
||
83 | |||
84 | /** |
||
85 | * Get all fields in module. |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | public function getFields(): array |
||
101 | |||
102 | /** |
||
103 | * Get fields and blocks in module. |
||
104 | * |
||
105 | * @return array |
||
106 | */ |
||
107 | public function getFieldsFromApi(): array |
||
117 | |||
118 | /** |
||
119 | * Get field by name. |
||
120 | * |
||
121 | * @param string $name |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | public function getField(string $name): array |
||
135 | |||
136 | /** |
||
137 | * Get field by name. |
||
138 | * |
||
139 | * @param string $name |
||
140 | * |
||
141 | * @return \YF\Modules\Base\FieldTypes\BaseField |
||
142 | */ |
||
143 | public function getFieldModel(string $name): \YF\Modules\Base\FieldTypes\BaseField |
||
150 | |||
151 | /** |
||
152 | * Returns default view for module. |
||
153 | * |
||
154 | * @return string |
||
155 | */ |
||
156 | public function getDefaultView(): string |
||
160 | |||
161 | /** |
||
162 | * Returns default address url. |
||
163 | * |
||
164 | * @return string |
||
165 | */ |
||
166 | public function getDefaultUrl(): string |
||
170 | } |
||
171 |
This check compares the return type specified in the
@return
annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.