| @@ 98-113 (lines=16) @@ | ||
| 95 | * Instantiates it if necessary. |
|
| 96 | * @return File |
|
| 97 | */ |
|
| 98 | public function getFile() |
|
| 99 | { |
|
| 100 | if (!is_object($this->_file)) { |
|
| 101 | $this->_file = Yii::createObject(array_merge([ |
|
| 102 | 'class' => File::class, |
|
| 103 | 'template' => $this->getTemplate(), |
|
| 104 | 'goal' => $this, |
|
| 105 | 'path' => $this->_path ?: $this->id, |
|
| 106 | ], is_string($this->_file) |
|
| 107 | ? ['path' => $this->_file] |
|
| 108 | : (array) $this->_file |
|
| 109 | )); |
|
| 110 | } |
|
| 111 | ||
| 112 | return $this->_file; |
|
| 113 | } |
|
| 114 | ||
| 115 | /** |
|
| 116 | * Sets file with given info. |
|
| @@ 97-112 (lines=16) @@ | ||
| 94 | * |
|
| 95 | * @return File |
|
| 96 | */ |
|
| 97 | public function getFile() |
|
| 98 | { |
|
| 99 | if (!is_object($this->_file)) { |
|
| 100 | $this->_file = Yii::createObject(array_merge([ |
|
| 101 | 'class' => File::class, |
|
| 102 | 'template' => $this->getTemplate(), |
|
| 103 | 'goal' => $this, |
|
| 104 | 'path' => $this->_path ?: $this->id, |
|
| 105 | ], is_string($this->_file) |
|
| 106 | ? ['path' => $this->_file] |
|
| 107 | : (array) $this->_file |
|
| 108 | )); |
|
| 109 | } |
|
| 110 | ||
| 111 | return $this->_file; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Sets file with given info. |
|