1 | <?php |
||
22 | class File extends \hidev\base\Component implements \yii\base\Arrayable, \ArrayAccess, \IteratorAggregate |
||
23 | { |
||
24 | use \hiqdev\yii2\collection\ObjectTrait; |
||
25 | |||
26 | /** |
||
27 | * @var bool Don't touch file if exists |
||
28 | */ |
||
29 | public $once; |
||
30 | |||
31 | /** |
||
32 | * @var string Username to change file owner to |
||
33 | */ |
||
34 | public $chown; |
||
35 | |||
36 | /** |
||
37 | * @var string Group to change file group to |
||
38 | */ |
||
39 | public $chgrp; |
||
40 | |||
41 | /** |
||
42 | * @var string|integer Permissions to change to |
||
43 | */ |
||
44 | public $chmod; |
||
45 | |||
46 | /** |
||
47 | * @var string specifies handler to be used |
||
48 | */ |
||
49 | public $fileType; |
||
50 | |||
51 | /** |
||
52 | * @var array|FileObj the file to be handled |
||
53 | */ |
||
54 | protected $_file; |
||
55 | |||
56 | /** |
||
57 | * @var string path to copy from |
||
58 | */ |
||
59 | protected $_copy; |
||
60 | |||
61 | /** |
||
62 | * @var string the path to the file |
||
63 | */ |
||
64 | protected $_path; |
||
65 | |||
66 | /** |
||
67 | * @var string the template name |
||
68 | */ |
||
69 | protected $_template; |
||
70 | |||
71 | public function init() |
||
75 | |||
76 | /** |
||
77 | * Template setter. |
||
78 | * @param string $template name |
||
79 | */ |
||
80 | public function setTemplate($template) |
||
84 | |||
85 | /** |
||
86 | * Template getter. |
||
87 | */ |
||
88 | public function getTemplate() |
||
92 | |||
93 | /** |
||
94 | * Returns the file object. |
||
95 | * Instantiates it if necessary. |
||
96 | * @return FileObj |
||
97 | */ |
||
98 | public function getFile() |
||
114 | |||
115 | /** |
||
116 | * Sets file with given info. |
||
117 | * @param mixed $info could be anything that is good for FileObj::create |
||
118 | */ |
||
119 | public function setFile($info) |
||
123 | |||
124 | /** |
||
125 | * Sets the path to the file, but file info has precendence. |
||
126 | * @param string $value |
||
127 | */ |
||
128 | public function setPath($value) |
||
132 | |||
133 | /** |
||
134 | * Copy setter. Turns this file type to `copy`. |
||
135 | */ |
||
136 | public function setCopy($value) |
||
141 | |||
142 | /** |
||
143 | * Copy getter. Processes aliases. |
||
144 | */ |
||
145 | public function getCopy() |
||
149 | |||
150 | /** |
||
151 | * Dirname getter. |
||
152 | */ |
||
153 | public function getDirname() |
||
157 | |||
158 | /** |
||
159 | * Path getter. |
||
160 | */ |
||
161 | public function getPath() |
||
165 | |||
166 | /** |
||
167 | * Checks if the file exists. |
||
168 | */ |
||
169 | public function exists() |
||
173 | |||
174 | /** |
||
175 | * Read the file. |
||
176 | */ |
||
177 | public function read() |
||
181 | |||
182 | /** |
||
183 | * Read the file into array. |
||
184 | * @return array |
||
185 | */ |
||
186 | public function readArray() |
||
190 | |||
191 | public function load() |
||
200 | |||
201 | /** |
||
202 | * General save: save and modify. |
||
203 | */ |
||
204 | public function save() |
||
211 | |||
212 | /** |
||
213 | * Save the file. |
||
214 | */ |
||
215 | protected function saveFile() |
||
220 | |||
221 | /** |
||
222 | * Applies modifications: chown, chgrp, chmod. |
||
223 | */ |
||
224 | public function modifyFile() |
||
233 | } |
||
234 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.