/** * Check whether __set, __get, __isset and __unset works */ public function testPropertyAccess() { $ns = new SessionNamespace(); $ns->key1 = 'val1'; $ns->key2 = 'val2'; $this->assertEquals($ns->key1, 'val1'); $this->assertEquals($ns->key2, 'val2'); $this->assertEquals($ns->get('key1'), 'val1'); $this->assertTrue(isset($ns->key1)); $this->assertFalse(isset($ns->key3)); unset($ns->key2); $this->assertFalse(isset($ns->key2)); $this->assertNull($ns->get('key2')); }
public static function construct(BusinessProcess $bp, Session $session) { $key = 'changes.' . $bp->getName(); $changes = new ProcessChanges(); $changes->sessionKey = $key; if ($actions = $session->get($key)) { foreach ($actions as $string) { $changes->push(NodeAction::unserialize($string)); } } $changes->session = $session; return $changes; }
/** * Return the base that should be used to calculate circle widths * * @param bool $create Whether to generate a new base if none is known yet * * @return float|null */ public function getCalculationBase($create) { if ($this->calculationBase === null) { $calculationBase = $this->session !== null ? $this->session->get('calculationBase') : null; if ($create) { $new = $this->generateCalculationBase(); if ($new > $calculationBase) { $this->calculationBase = $new; if ($this->session !== null) { $this->session->calculationBase = $new; } } else { $this->calculationBase = $calculationBase; } } else { return $calculationBase; } } return $this->calculationBase; }