Регистр файлов
This commit is contained in:
parent
4fd0187ea6
commit
c8958cbee0
83 changed files with 25 additions and 53 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