Переделка для composer autoload
This commit is contained in:
parent
ad69746347
commit
b5641db607
100 changed files with 14 additions and 325 deletions
22
src/adapter.php
Normal file
22
src/adapter.php
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Интерфейс к массиву и обьекту как к коллекции
|
||||
*/
|
||||
class Adapter
|
||||
{
|
||||
protected $adaptee;
|
||||
public function __construct ($adaptee)
|
||||
{
|
||||
$this->adaptee = $adaptee;
|
||||
}
|
||||
|
||||
public function get($name)
|
||||
{
|
||||
if (is_array ($this->adaptee)) {
|
||||
return $this->adaptee[$name];
|
||||
} else {
|
||||
return $this->adaptee->$name;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue