Pop\Mvc\View::get PHP Метод

get() публичный Метод

Get model data
public get ( string $key ) : mixed
$key string
Результат mixed
    public function get($key)
    {
        return isset($this->data[$key]) ? $this->data[$key] : null;
    }

Usage Example

Пример #1
0
 public function testSetAndGetModelData()
 {
     $v = new View('some template');
     $v->setData(array(123, 'something'));
     $v->set('new', 'thing');
     $d = $v->getData();
     $this->assertTrue(in_array(123, $d));
     $this->assertEquals('something', $v->get(1));
     $this->assertEquals('thing', $v->get('new'));
     $this->assertEquals('thing', $v->new);
     $v->new = 'somethingelse';
     $this->assertEquals('somethingelse', $v->new);
     $this->assertTrue(isset($v->new));
     $v->merge(array('newthing' => 456));
     $this->assertTrue(isset($v->newthing));
     $this->assertEquals(456, $v->newthing);
 }