/** * Adds code to the global scope of the ManiaLink. * @param string $code The code. * @param int $priority The priority, 0 for most important, bigger for less important. * @return $this Implementing fluent interface. */ public function addGlobalCode($code, $priority = 5) { $globalCode = new Code(); $globalCode->setCode($code)->setPriority($priority); $this->builder->addGlobalCode($globalCode); return $this; }
/** * Adds global code to the builder. * @param string $globalCode The global code. * @param int $priority The priority of the code. Defaults to PHP_INT_MAX to add the code to the end of the script. * @return $this Implementing fluent interface. */ protected function addGlobalCode($globalCode, $priority = PHP_INT_MAX) { if (!empty($globalCode)) { $code = new Code(); $code->setCode($globalCode)->setPriority($priority); $this->builder->addGlobalCode($code); } return $this; }