public static function __run(AppExecutionContext $context, MMapResponse $response) { $memoryManager = MemoryManager::getInstance(); Kernel::enterSystemMode(); $isExternLogin = $memoryManager->get('isExternLogin'); Kernel::exitSystemMode(); $list = new ArrayList(); $list->append($isExternLogin); if ($isExternLogin) { Kernel::enterSystemMode(); $username = $memoryManager->get('username'); $password = $memoryManager->get('password'); Kernel::exitSystemMode(); $list->append($username); $list->append($password); } $context->setArgs($list); $response->appendToBody('eyeos.isRegisterActive=' . self::isRegisterActive() . ';'); }
/** * Appends the $value to the collection. * * @param mixed $value * @param bool TRUE if the element has been appended successfully */ public function append($value) { if (!$this->contains($value, $this->strict)) { parent::append($value); return true; } return false; }
echo "My name is {$this->name}\n"; } public function __toString() { return $this->name; } } // ArrayList::__construct() $list = new ArrayList(NULL, 'Person'); $jack = new Person('Jack'); $mary = new Person('Mary'); $larry = new Person('Larry'); $foo = new ArrayObject(); // IList::append() echo "Adding Jack\n"; $list->append($jack); echo "Adding Mary\n"; $list->append($mary); try { echo "Adding foo\n"; $list->append($foo); } catch (Exception $e) { echo get_class($e), ': ', $e->getMessage(), "\n\n"; } // IList::offsetSet() echo "Adding Jack using []\n"; $list[] = $jack; try { echo "Adding foo using []\n"; $list[] = $foo; } catch (Exception $e) {