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.
979730
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;
    }
1146736
protected function onTimeZone(?string $timeZoneCode)
    {
        if (\is_null($timeZoneCode)) {
            $this->timezone = null;
        } elseif (\in_array($timeZoneCode, \timezone_identifiers_list())) {
            $this->timezone = $timeZoneCode;
        }

        return $this;
    }
935374
public function loadLanguage($code) {
        static $languages_seen = array(); // recursion guard

        // abort if we've already loaded it
        if (isset($this->cache[$code])) return;

        // generate filename
        $filename = $this->dir . '/Language/messages/' . $code . '.php';

        // default fallback : may be overwritten by the ensuing include
        $fallback = ($code != 'en') ? 'en' : false;

        // load primary localisation
        if (!file_exists($filename)) {
            // skip the include: will rely solely on fallback
            $filename = $this->dir . '/Language/messages/en.php';
            $cache = array();
        } else {
            include $filename;
            $cache = compact($this->keys);
        }

        // load fallback localisation
        if (!empty($fallback)) {

            // infinite recursion guard
            if (isset($languages_seen[$code])) {
                trigger_error('Circular fallback reference in language ' .
                    $code, E_USER_ERROR);
                $fallback = 'en';
            }
            $language_seen[$code] = true;

            // load the fallback recursively
            $this->loadLanguage($fallback);
            $fallback_cache = $this->cache[$fallback];

            // merge fallback with current language
            foreach ( $this->keys as $key ) {
                if (isset($cache[$key]) && isset($fallback_cache[$key])) {
                    if (isset($this->mergeable_keys_map[$key])) {
                        $cache[$key] = $cache[$key] + $fallback_cache[$key];
                    } elseif (isset($this->mergeable_keys_list[$key])) {
                        $cache[$key] = array_merge( $fallback_cache[$key], $cache[$key] );
                    }
                } else {
                    $cache[$key] = $fallback_cache[$key];
                }
            }

        }

        // save to cache for later retrieval
        $this->cache[$code] = $cache;

        return;
    }
869807
public function setup( $priority = 100 ) {

		if ( did_action( self::ACTION_SETUP ) ) {
			return $this;
		}

		// We use WONOLOG_DISABLE instead of WONOLOG_ENABLE so that not defined (default) means enabled.
		$disable_by_env = filter_var( getenv( 'WONOLOG_DISABLE' ), FILTER_VALIDATE_BOOLEAN );

		/**
		 * Filters whether to completely disable Wonolog.
		 *
		 * @param bool $disable
		 */
		if ( apply_filters( self::FILTER_DISABLE, $disable_by_env ) ) {
			return $this;
		}

		/**
		 * Fires right before Wonolog is set up.
		 */
		do_action( self::ACTION_SETUP );

		$processor_registry = new ProcessorsRegistry();
		$handlers_registry  = new HandlersRegistry( $processor_registry );
		$subscriber         = new LogActionSubscriber( new Channels( $handlers_registry, $processor_registry ) );
		$listener           = [ $subscriber, 'listen' ];

		add_action( LOG, $listener, $priority, PHP_INT_MAX );

		foreach ( Logger::getLevels() as $level => $level_code ) {
			// $level_code is from 100 (DEBUG) to 600 (EMERGENCY) this makes hook priority based on level priority
			add_action( LOG . '.' . strtolower( $level ), $listener, $priority + ( 601 - $level_code ), PHP_INT_MAX );
		}

		add_action( 'muplugins_loaded', [ HookListenersRegistry::class, 'initialize' ], PHP_INT_MAX );

		/**
		 * Fires right after Wonolog has been set up.
		 */
		do_action( self::ACTION_LOADED );

		return $this;
	}
647209
public function preOutputNoLevel($code)
    {
        $this->lastLine = $code;
        $this->code = $code.PHP_EOL.$this->code;
        ++$this->currentPrints;
    }
189878
private function setCountryCode(?string $countryCode): self
    {
        $this->updatePropertyValue(
            CountryCodeFieldInterface::PROP_COUNTRY_CODE,
            $countryCode
        );

        return $this;
    }
193926
public function setCode(int $code)
    {
        $allowed_codes = [
            0,
            1,
            2
        ];

        if (!in_array($code, $allowed_codes)) {
            $code = 1;
        }

        $this->code = $code;
    }
1339805
protected function mergeModuleTranslations($langcode = null)
    {
        $modules = $this->module->getEnabled();

        // Sort modules in descending order
        // More important modules go first so their translations will be added earlier
        gplcart_array_sort($modules, 'weight', false);

        foreach ($modules as $module) {
            $file = $this->getFile($langcode, $module['module_id']);
            if (is_file($file)) {
                $this->mergeTranslation($file, $langcode);
            }
        }
    }
535897
public function code ( $code = NULL ) {
      if ( $code === NULL )
        return $this->code;
      if ( ResponseCode::find( $code ) === NULL )
        throw new \InvalidArgumentException( "Response: no code $code" );
      $this->code = intval( $code );
      return $this;
    }
1360765
public function setStatusCode($statusCode)
    {
        $statusCode = intval($statusCode);
        $this->statusCode = ($statusCode > 0) ? $statusCode : self::RESPONSE_OK;
        return $this;
    }
316479
public function tokenize($code)
    {
        $this->tokens = array();
        $lines        = preg_split('/\r?\n/', $code);
        $number       = 0;

        foreach ($lines as $number => $fragment) {
            $this->processLine($number + 1, $fragment);
            $this->tokens[] = new Token(self::TOKEN_EOL, null, $number + 1);
        }
        $this->tokens[] = new Token(self::TOKEN_EOF, null, $number + 1);

        return new TokenStream($this->tokens);
    }
848689
public function setStatusCode(int $statusCode): self
    {
        if (!array_key_exists($statusCode, Response::$statusTexts)) {
            $this->internalServerError('Invalid status code in ' . __METHOD__, Response::$statusTexts);
        }

        $this->statusCode = $statusCode;

        return $this;
    }
277148
public function addGlobal($name, $value)
    {
        if (null === $this->globals) {
            $this->initGlobals();
        }

        $this->globals[$name] = $value;

        return $this;
    }
732260
public function create($languageCode) {
    $mappings = $this->getMappings();

    if (!isset($mappings[$languageCode])) {
      throw new \InvalidArgumentException('The language code is not part of the supported list. Please see GoogleSupportedLanguages\LanguageFactory::getMappings() for reference.');
    }

    return new $mappings[$languageCode]();
  }
819329
public static function buildGlobalCode($result, $code = null)
    {
        if ($result instanceof self) {
            $resultClass = get_class($result);
            $resultCode = $result->getCode();
        } else {
            $resultClass = (string) $result;
            $resultCode = (int) $code;
        }

        if (self::R_SUCCESS === $resultCode) {
            return self::R_SUCCESS;
        }

        $resultClassIndex = self::getClassIndex($resultClass);

        $resultCode = ($resultClassIndex * 1000) + $resultCode;

        return (int) $resultCode;
    }
680560
public function setHttpCode($code)
    {
        $this->addHeader(new Header\Header('HTTP/1.1 ' . (int) $code . ' ' . Header\HttpCode::getText($code), true, (int) $code));

        return $this;
    }
1284578
final public function onTimeZone(string $timeZoneCode): self
    {
        if (\in_array($timeZoneCode, \timezone_identifiers_list())) {
            $this->requestHeaderTimezoneCode = $timeZoneCode;
        }

        return $this;
    }