1 <?php
2
3 namespace Docolight\Agno\Traits;
4
5 use Yii;
6 use Docolight\Support\ClassLoader;
7
8 trait HasAutoload
9 {
10 public $autoload = [];
11
12 public $psrPath = 'psr';
13
14 public $psrs = [];
15
16 protected function loadPsr()
17 {
18 foreach ($this->psrs as $psr) {
19 ClassLoader::addDirectories(realpath($this->getBasePath().DIRECTORY_SEPARATOR.$this->psrPath.DIRECTORY_SEPARATOR.$psr));
20 }
21 }
22
23 protected function loadAutoload()
24 {
25 foreach ($this->autoload as $autoloadFile) {
26 require_once Yii::getPathOfAlias($autoloadFile).'.php';
27 }
28 }
29 }
30