-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
/** | ||
* Automation tool mixed with code generator for easier continuous development | ||
* | ||
* @link https://github.com/hiqdev/hidev | ||
* @package hidev | ||
* @license BSD-3-Clause | ||
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/) | ||
*/ | ||
|
||
namespace hidev\base; | ||
|
||
use ReflectionClass; | ||
use Yii; | ||
|
||
/** | ||
* Getters trait. | ||
*/ | ||
trait GettersTrait | ||
{ | ||
protected $_view; | ||
|
||
public function getView() | ||
{ | ||
if ($this->_view === null) { | ||
$this->_view = $this->getApp()->getView(); | ||
} | ||
|
||
return $this->_view; | ||
} | ||
|
||
public function getViewPath() | ||
{ | ||
$ref = new ReflectionClass($this); | ||
|
||
return dirname(dirname($ref->getFileName())) . '/views'; | ||
} | ||
|
||
public function takeGoal($id) | ||
{ | ||
return $this->getApp()->get($id); | ||
} | ||
|
||
public function takeVendor() | ||
{ | ||
return $this->getApp()->get('vendor'); | ||
} | ||
|
||
public function takePackage() | ||
{ | ||
return $this->getApp()->get('package'); | ||
} | ||
|
||
public function takeVcs() | ||
{ | ||
return $this->getApp()->get('git'); | ||
} | ||
|
||
public function getApp() | ||
{ | ||
return Yii::$app; | ||
} | ||
} |