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

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

Set model data
public set ( string $name, mixed $value ) : View
$name string
$value mixed
Результат View
    public function set($name, $value)
    {
        $this->data[$name] = $value;
        return $this;
    }

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);
 }