Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
HasUsesTrait.php
Go to the documentation of this file.
1<?php
3
5 protected $uses=[];
6 public function getUses(){
7 return \array_keys($this->uses);
8 }
9
10 public function addUse($classname){
11 $this->uses[$classname]=true;
12 }
13
14 public function addUses(...$classnames){
15 foreach ($classnames as $classname){
16 $this->uses[$classname]=true;
17 }
18 }
19
20 public function getUsesStr(){
21 $uses=$this->getUses();
22 $r=[];
23 foreach ($uses as $use){
24 $r[]='use '.\ltrim($use,'\\').';';
25 }
26 return \implode("\n",$r);
27 }
28}
29