repository_name
				 
			stringlengths 5 
			67 
			 | func_path_in_repository
				 
			stringlengths 4 
			234 
			 | func_name
				 
			stringlengths 0 
			314 
			 | whole_func_string
				 
			stringlengths 52 
			3.87M 
			 | language
				 
			stringclasses 6
				values  | func_code_string
				 
			stringlengths 52 
			3.87M 
			 | func_code_tokens
				 
			listlengths 15 
			672k 
			 | func_documentation_string
				 
			stringlengths 1 
			47.2k 
			 | func_documentation_tokens
				 
			listlengths 1 
			3.92k 
			 | split_name
				 
			stringclasses 1
				value  | func_code_url
				 
			stringlengths 85 
			339 
			 | 
|---|---|---|---|---|---|---|---|---|---|---|
	luniki/trails 
 | 
	lib/trails.php 
 | 
	Trails_Flash.sweep 
 | 
	function sweep() {
    # remove used values
    foreach (array_keys($this->flash) as $k) {
      if ($this->used[$k]) {
        unset($this->flash[$k], $this->used[$k]);
      } else {
        $this->_use($k);
      }
    }
    # cleanup if someone meddled with flash or used
    $fkeys = array_keys($this->flash);
    $ukeys = array_keys($this->used);
    foreach (array_diff($fkeys, $ukeys) as $k => $v) {
      unset($this->used[$k]);
    }
  } 
 | 
	php 
 | 
	function sweep() {
    # remove used values
    foreach (array_keys($this->flash) as $k) {
      if ($this->used[$k]) {
        unset($this->flash[$k], $this->used[$k]);
      } else {
        $this->_use($k);
      }
    }
    # cleanup if someone meddled with flash or used
    $fkeys = array_keys($this->flash);
    $ukeys = array_keys($this->used);
    foreach (array_diff($fkeys, $ukeys) as $k => $v) {
      unset($this->used[$k]);
    }
  } 
 | 
	[
  "function",
  "sweep",
  "(",
  ")",
  "{",
  "# remove used values",
  "foreach",
  "(",
  "array_keys",
  "(",
  "$",
  "this",
  "->",
  "flash",
  ")",
  "as",
  "$",
  "k",
  ")",
  "{",
  "if",
  "(",
  "$",
  "this",
  "->",
  "used",
  "[",
  "$",
  "k",
  "]",
  ")",
  "{",
  "unset",
  "(",
  "$",
  "this",
  "->",
  "flash",
  "[",
  "$",
  "k",
  "]",
  ",",
  "$",
  "this",
  "->",
  "used",
  "[",
  "$",
  "k",
  "]",
  ")",
  ";",
  "}",
  "else",
  "{",
  "$",
  "this",
  "->",
  "_use",
  "(",
  "$",
  "k",
  ")",
  ";",
  "}",
  "}",
  "# cleanup if someone meddled with flash or used",
  "$",
  "fkeys",
  "=",
  "array_keys",
  "(",
  "$",
  "this",
  "->",
  "flash",
  ")",
  ";",
  "$",
  "ukeys",
  "=",
  "array_keys",
  "(",
  "$",
  "this",
  "->",
  "used",
  ")",
  ";",
  "foreach",
  "(",
  "array_diff",
  "(",
  "$",
  "fkeys",
  ",",
  "$",
  "ukeys",
  ")",
  "as",
  "$",
  "k",
  "=>",
  "$",
  "v",
  ")",
  "{",
  "unset",
  "(",
  "$",
  "this",
  "->",
  "used",
  "[",
  "$",
  "k",
  "]",
  ")",
  ";",
  "}",
  "}"
]  | 
	<MethodDescription>
@return type       <description> 
 | 
	[
  "<MethodDescription",
  ">"
]  | 
	train 
 | 
	https://github.com/luniki/trails/blob/ade6e3aa6bb543fb66e3295acc74f32121085c16/lib/trails.php#L1105-L1122 
 | 
					
	CHH/itertools 
 | 
	lib/itertools/FlipIterator.php 
 | 
	FlipIterator.key 
 | 
	function key()
    {
        $current = $this->getInnerIterator()->current();
        if (!is_scalar($current)) {
            return (string) $current;
        }
        return $current;
    } 
 | 
	php 
 | 
	function key()
    {
        $current = $this->getInnerIterator()->current();
        if (!is_scalar($current)) {
            return (string) $current;
        }
        return $current;
    } 
 | 
	[
  "function",
  "key",
  "(",
  ")",
  "{",
  "$",
  "current",
  "=",
  "$",
  "this",
  "->",
  "getInnerIterator",
  "(",
  ")",
  "->",
  "current",
  "(",
  ")",
  ";",
  "if",
  "(",
  "!",
  "is_scalar",
  "(",
  "$",
  "current",
  ")",
  ")",
  "{",
  "return",
  "(",
  "string",
  ")",
  "$",
  "current",
  ";",
  "}",
  "return",
  "$",
  "current",
  ";",
  "}"
]  | 
	# Returns the inner Iterator's return value of `current()`. 
 | 
	[
  "#",
  "Returns",
  "the",
  "inner",
  "Iterator",
  "s",
  "return",
  "value",
  "of",
  "current",
  "()",
  "."
]  | 
	train 
 | 
	https://github.com/CHH/itertools/blob/e70635d7f43e7de15de861d81e4e85f2ba5bd5aa/lib/itertools/FlipIterator.php#L21-L30 
 | 
					
	j-d/draggy 
 | 
	src/Draggy/Autocode/Templates/CPP/EntityHeader.php 
 | 
	EntityHeader.getSetterDeclarationLines 
 | 
	public function getSetterDeclarationLines(CPPAttribute $attribute)
    {
        $lines = [];
        if ('object' === $attribute->getType()) {
            $lines[] = $this->getEntity()->getProject()->getAutocodeProperty('base')
                ? $this->getEntity()->getNameBase() . ' ' . $attribute->getSetterName() . '(' . $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getName() . ');'
                : $this->getEntity()->getName() . ' ' . $attribute->getSetterName() . '(' . $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getName() . ');';
        } else {
            $lines[] = $this->getEntity()->getProject()->getAutocodeProperty('base')
                ? $this->getEntity()->getNameBase() . ' ' . $attribute->getSetterName() . '(' . $attribute->getType() . ');'
                : $this->getEntity()->getName() . ' ' . $attribute->getSetterName() . '(' . $attribute->getType() . ');';
        }
        return $lines;
    } 
 | 
	php 
 | 
	public function getSetterDeclarationLines(CPPAttribute $attribute)
    {
        $lines = [];
        if ('object' === $attribute->getType()) {
            $lines[] = $this->getEntity()->getProject()->getAutocodeProperty('base')
                ? $this->getEntity()->getNameBase() . ' ' . $attribute->getSetterName() . '(' . $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getName() . ');'
                : $this->getEntity()->getName() . ' ' . $attribute->getSetterName() . '(' . $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getName() . ');';
        } else {
            $lines[] = $this->getEntity()->getProject()->getAutocodeProperty('base')
                ? $this->getEntity()->getNameBase() . ' ' . $attribute->getSetterName() . '(' . $attribute->getType() . ');'
                : $this->getEntity()->getName() . ' ' . $attribute->getSetterName() . '(' . $attribute->getType() . ');';
        }
        return $lines;
    } 
 | 
	[
  "public",
  "function",
  "getSetterDeclarationLines",
  "(",
  "CPPAttribute",
  "$",
  "attribute",
  ")",
  "{",
  "$",
  "lines",
  "=",
  "[",
  "]",
  ";",
  "if",
  "(",
  "'object'",
  "===",
  "$",
  "attribute",
  "->",
  "getType",
  "(",
  ")",
  ")",
  "{",
  "$",
  "lines",
  "[",
  "]",
  "=",
  "$",
  "this",
  "->",
  "getEntity",
  "(",
  ")",
  "->",
  "getProject",
  "(",
  ")",
  "->",
  "getAutocodeProperty",
  "(",
  "'base'",
  ")",
  "?",
  "$",
  "this",
  "->",
  "getEntity",
  "(",
  ")",
  "->",
  "getNameBase",
  "(",
  ")",
  ".",
  "' '",
  ".",
  "$",
  "attribute",
  "->",
  "getSetterName",
  "(",
  ")",
  ".",
  "'('",
  ".",
  "$",
  "attribute",
  "->",
  "getEntitySubtype",
  "(",
  ")",
  "->",
  "getName",
  "(",
  ")",
  ".",
  "' '",
  ".",
  "$",
  "attribute",
  "->",
  "getName",
  "(",
  ")",
  ".",
  "');'",
  ":",
  "$",
  "this",
  "->",
  "getEntity",
  "(",
  ")",
  "->",
  "getName",
  "(",
  ")",
  ".",
  "' '",
  ".",
  "$",
  "attribute",
  "->",
  "getSetterName",
  "(",
  ")",
  ".",
  "'('",
  ".",
  "$",
  "attribute",
  "->",
  "getEntitySubtype",
  "(",
  ")",
  "->",
  "getName",
  "(",
  ")",
  ".",
  "' '",
  ".",
  "$",
  "attribute",
  "->",
  "getName",
  "(",
  ")",
  ".",
  "');'",
  ";",
  "}",
  "else",
  "{",
  "$",
  "lines",
  "[",
  "]",
  "=",
  "$",
  "this",
  "->",
  "getEntity",
  "(",
  ")",
  "->",
  "getProject",
  "(",
  ")",
  "->",
  "getAutocodeProperty",
  "(",
  "'base'",
  ")",
  "?",
  "$",
  "this",
  "->",
  "getEntity",
  "(",
  ")",
  "->",
  "getNameBase",
  "(",
  ")",
  ".",
  "' '",
  ".",
  "$",
  "attribute",
  "->",
  "getSetterName",
  "(",
  ")",
  ".",
  "'('",
  ".",
  "$",
  "attribute",
  "->",
  "getType",
  "(",
  ")",
  ".",
  "');'",
  ":",
  "$",
  "this",
  "->",
  "getEntity",
  "(",
  ")",
  "->",
  "getName",
  "(",
  ")",
  ".",
  "' '",
  ".",
  "$",
  "attribute",
  "->",
  "getSetterName",
  "(",
  ")",
  ".",
  "'('",
  ".",
  "$",
  "attribute",
  "->",
  "getType",
  "(",
  ")",
  ".",
  "');'",
  ";",
  "}",
  "return",
  "$",
  "lines",
  ";",
  "}"
]  | 
	<editor-fold desc="Setters"> 
 | 
	[
  "<editor",
  "-",
  "fold",
  "desc",
  "=",
  "Setters",
  ">"
]  | 
	train 
 | 
	https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Templates/CPP/EntityHeader.php#L104-L119 
 | 
					
	j-d/draggy 
 | 
	src/Draggy/Autocode/Templates/CPP/EntityHeader.php 
 | 
	EntityHeader.getGetterDeclarationLines 
 | 
	public function getGetterDeclarationLines(CPPAttribute $attribute)
    {
        $lines = [];
        if ('object' === $attribute->getType()) {
            $lines[] = $attribute->getStatic()
                ? $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getGetterName() . '();'
                : $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getGetterName() . '();';
        } else {
            $lines[] = $attribute->getStatic()
                ? $attribute->getType() . ' ' . $attribute->getGetterName() . '();'
                : $attribute->getType() . ' ' . $attribute->getGetterName() . '();';
        }
        return $lines;
    } 
 | 
	php 
 | 
	public function getGetterDeclarationLines(CPPAttribute $attribute)
    {
        $lines = [];
        if ('object' === $attribute->getType()) {
            $lines[] = $attribute->getStatic()
                ? $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getGetterName() . '();'
                : $attribute->getEntitySubtype()->getName() . ' ' . $attribute->getGetterName() . '();';
        } else {
            $lines[] = $attribute->getStatic()
                ? $attribute->getType() . ' ' . $attribute->getGetterName() . '();'
                : $attribute->getType() . ' ' . $attribute->getGetterName() . '();';
        }
        return $lines;
    } 
 | 
	[
  "public",
  "function",
  "getGetterDeclarationLines",
  "(",
  "CPPAttribute",
  "$",
  "attribute",
  ")",
  "{",
  "$",
  "lines",
  "=",
  "[",
  "]",
  ";",
  "if",
  "(",
  "'object'",
  "===",
  "$",
  "attribute",
  "->",
  "getType",
  "(",
  ")",
  ")",
  "{",
  "$",
  "lines",
  "[",
  "]",
  "=",
  "$",
  "attribute",
  "->",
  "getStatic",
  "(",
  ")",
  "?",
  "$",
  "attribute",
  "->",
  "getEntitySubtype",
  "(",
  ")",
  "->",
  "getName",
  "(",
  ")",
  ".",
  "' '",
  ".",
  "$",
  "attribute",
  "->",
  "getGetterName",
  "(",
  ")",
  ".",
  "'();'",
  ":",
  "$",
  "attribute",
  "->",
  "getEntitySubtype",
  "(",
  ")",
  "->",
  "getName",
  "(",
  ")",
  ".",
  "' '",
  ".",
  "$",
  "attribute",
  "->",
  "getGetterName",
  "(",
  ")",
  ".",
  "'();'",
  ";",
  "}",
  "else",
  "{",
  "$",
  "lines",
  "[",
  "]",
  "=",
  "$",
  "attribute",
  "->",
  "getStatic",
  "(",
  ")",
  "?",
  "$",
  "attribute",
  "->",
  "getType",
  "(",
  ")",
  ".",
  "' '",
  ".",
  "$",
  "attribute",
  "->",
  "getGetterName",
  "(",
  ")",
  ".",
  "'();'",
  ":",
  "$",
  "attribute",
  "->",
  "getType",
  "(",
  ")",
  ".",
  "' '",
  ".",
  "$",
  "attribute",
  "->",
  "getGetterName",
  "(",
  ")",
  ".",
  "'();'",
  ";",
  "}",
  "return",
  "$",
  "lines",
  ";",
  "}"
]  | 
	<editor-fold desc="Getters"> 
 | 
	[
  "<editor",
  "-",
  "fold",
  "desc",
  "=",
  "Getters",
  ">"
]  | 
	train 
 | 
	https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Templates/CPP/EntityHeader.php#L123-L138 
 | 
					
	inhere/php-librarys 
 | 
	src/Helpers/UrlHelper.php 
 | 
	UrlHelper.encode 
 | 
	public static function encode($url)
    {
        $url = trim($url);
        if (empty($url) || !\is_string($url)) {
            return $url;
        }
        // 若已被编码的url,将被解码,再继续重新编码
        $url = urldecode($url);
        $encodeUrl = urlencode($url);
        $encodeUrl = str_replace(self::$entities, self::$replacements, $encodeUrl);
        return $encodeUrl;
    } 
 | 
	php 
 | 
	public static function encode($url)
    {
        $url = trim($url);
        if (empty($url) || !\is_string($url)) {
            return $url;
        }
        // 若已被编码的url,将被解码,再继续重新编码
        $url = urldecode($url);
        $encodeUrl = urlencode($url);
        $encodeUrl = str_replace(self::$entities, self::$replacements, $encodeUrl);
        return $encodeUrl;
    } 
 | 
	[
  "public",
  "static",
  "function",
  "encode",
  "(",
  "$",
  "url",
  ")",
  "{",
  "$",
  "url",
  "=",
  "trim",
  "(",
  "$",
  "url",
  ")",
  ";",
  "if",
  "(",
  "empty",
  "(",
  "$",
  "url",
  ")",
  "||",
  "!",
  "\\",
  "is_string",
  "(",
  "$",
  "url",
  ")",
  ")",
  "{",
  "return",
  "$",
  "url",
  ";",
  "}",
  "// 若已被编码的url,将被解码,再继续重新编码",
  "$",
  "url",
  "=",
  "urldecode",
  "(",
  "$",
  "url",
  ")",
  ";",
  "$",
  "encodeUrl",
  "=",
  "urlencode",
  "(",
  "$",
  "url",
  ")",
  ";",
  "$",
  "encodeUrl",
  "=",
  "str_replace",
  "(",
  "self",
  "::",
  "$",
  "entities",
  ",",
  "self",
  "::",
  "$",
  "replacements",
  ",",
  "$",
  "encodeUrl",
  ")",
  ";",
  "return",
  "$",
  "encodeUrl",
  ";",
  "}"
]  | 
	url_encode form urlencode(),但是 : / ? & = ...... 几个符号不会被转码为 %3A %2F %3F %26 %3D ......
$url="ftp://ud03:[email protected]/中文/中文.rar";
$url1 =  url_encode1($url);
//ftp://ud03:[email protected]/%E4%B8%AD%E6%96%87/%E4%B8%AD%E6%96%87.rar
$url2 =  urldecode($url);
echo $url1.PHP_EOL.$url2.PHP_EOL;
@param $url
@return mixed|string [type] [description] 
 | 
	[
  "url_encode",
  "form",
  "urlencode",
  "()",
  "但是",
  ":",
  "/",
  "?",
  "&",
  "=",
  "......",
  "几个符号不会被转码为",
  "%3A",
  "%2F",
  "%3F",
  "%26",
  "%3D",
  "......",
  "$url",
  "=",
  "ftp",
  ":",
  "//",
  "ud03",
  ":",
  "password"
]  | 
	train 
 | 
	https://github.com/inhere/php-librarys/blob/e6ca598685469794f310e3ab0e2bc19519cd0ae6/src/Helpers/UrlHelper.php#L170-L184 
 | 
					
	zicht/z 
 | 
	src/Zicht/Tool/Container/ContainerCompiler.php 
 | 
	ContainerCompiler.getContainer 
 | 
	public function getContainer()
    {
        $mutex = new Mutex($this->file . '.lock', true);
        $ret = $mutex->run(
            function () {
                if ($this->needsRecompile()) {
                    file_put_contents($this->file, $this->compileContainerCode());
                }
                return include $this->file;
            }
        );
        if (!($ret instanceof Container)) {
            throw new \LogicException("The container must be returned by the compiler");
        }
        foreach ($this->plugins as $plugin) {
            $ret->addPlugin($plugin);
        }
        return $ret;
    } 
 | 
	php 
 | 
	public function getContainer()
    {
        $mutex = new Mutex($this->file . '.lock', true);
        $ret = $mutex->run(
            function () {
                if ($this->needsRecompile()) {
                    file_put_contents($this->file, $this->compileContainerCode());
                }
                return include $this->file;
            }
        );
        if (!($ret instanceof Container)) {
            throw new \LogicException("The container must be returned by the compiler");
        }
        foreach ($this->plugins as $plugin) {
            $ret->addPlugin($plugin);
        }
        return $ret;
    } 
 | 
	[
  "public",
  "function",
  "getContainer",
  "(",
  ")",
  "{",
  "$",
  "mutex",
  "=",
  "new",
  "Mutex",
  "(",
  "$",
  "this",
  "->",
  "file",
  ".",
  "'.lock'",
  ",",
  "true",
  ")",
  ";",
  "$",
  "ret",
  "=",
  "$",
  "mutex",
  "->",
  "run",
  "(",
  "function",
  "(",
  ")",
  "{",
  "if",
  "(",
  "$",
  "this",
  "->",
  "needsRecompile",
  "(",
  ")",
  ")",
  "{",
  "file_put_contents",
  "(",
  "$",
  "this",
  "->",
  "file",
  ",",
  "$",
  "this",
  "->",
  "compileContainerCode",
  "(",
  ")",
  ")",
  ";",
  "}",
  "return",
  "include",
  "$",
  "this",
  "->",
  "file",
  ";",
  "}",
  ")",
  ";",
  "if",
  "(",
  "!",
  "(",
  "$",
  "ret",
  "instanceof",
  "Container",
  ")",
  ")",
  "{",
  "throw",
  "new",
  "\\",
  "LogicException",
  "(",
  "\"The container must be returned by the compiler\"",
  ")",
  ";",
  "}",
  "foreach",
  "(",
  "$",
  "this",
  "->",
  "plugins",
  "as",
  "$",
  "plugin",
  ")",
  "{",
  "$",
  "ret",
  "->",
  "addPlugin",
  "(",
  "$",
  "plugin",
  ")",
  ";",
  "}",
  "return",
  "$",
  "ret",
  ";",
  "}"
]  | 
	Writes the code to a temporary file and returns the resulting Container object.
@return mixed
@throws \LogicException 
 | 
	[
  "Writes",
  "the",
  "code",
  "to",
  "a",
  "temporary",
  "file",
  "and",
  "returns",
  "the",
  "resulting",
  "Container",
  "object",
  "."
]  | 
	train 
 | 
	https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerCompiler.php#L48-L68 
 | 
					
	zicht/z 
 | 
	src/Zicht/Tool/Container/ContainerCompiler.php 
 | 
	ContainerCompiler.needsRecompile 
 | 
	protected function needsRecompile()
    {
        clearstatcache();
        return !is_file($this->file) || (
            (!empty($this->configTree['z']['sources'])
            && max(array_map('filemtime', $this->configTree['z']['sources'])) >= filemtime($this->file))
        );
    } 
 | 
	php 
 | 
	protected function needsRecompile()
    {
        clearstatcache();
        return !is_file($this->file) || (
            (!empty($this->configTree['z']['sources'])
            && max(array_map('filemtime', $this->configTree['z']['sources'])) >= filemtime($this->file))
        );
    } 
 | 
	[
  "protected",
  "function",
  "needsRecompile",
  "(",
  ")",
  "{",
  "clearstatcache",
  "(",
  ")",
  ";",
  "return",
  "!",
  "is_file",
  "(",
  "$",
  "this",
  "->",
  "file",
  ")",
  "||",
  "(",
  "(",
  "!",
  "empty",
  "(",
  "$",
  "this",
  "->",
  "configTree",
  "[",
  "'z'",
  "]",
  "[",
  "'sources'",
  "]",
  ")",
  "&&",
  "max",
  "(",
  "array_map",
  "(",
  "'filemtime'",
  ",",
  "$",
  "this",
  "->",
  "configTree",
  "[",
  "'z'",
  "]",
  "[",
  "'sources'",
  "]",
  ")",
  ")",
  ">=",
  "filemtime",
  "(",
  "$",
  "this",
  "->",
  "file",
  ")",
  ")",
  ")",
  ";",
  "}"
]  | 
	Crude check for whether a recompile is needed.
@return bool 
 | 
	[
  "Crude",
  "check",
  "for",
  "whether",
  "a",
  "recompile",
  "is",
  "needed",
  "."
]  | 
	train 
 | 
	https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerCompiler.php#L88-L95 
 | 
					
	zicht/z 
 | 
	src/Zicht/Tool/Container/ContainerCompiler.php 
 | 
	ContainerCompiler.compileContainerCode 
 | 
	public function compileContainerCode()
    {
        $builder = new ContainerBuilder($this->configTree);
        foreach ($this->plugins as $name => $plugin) {
            $plugin->setContainerBuilder($builder);
        }
        $containerNode = $builder->build();
        $buffer = new Buffer();
        $buffer->write('<?php')->eol();
        $containerNode->compile($buffer);
        $buffer->writeln('return $z;');
        $code = $buffer->getResult();
        return $code;
    } 
 | 
	php 
 | 
	public function compileContainerCode()
    {
        $builder = new ContainerBuilder($this->configTree);
        foreach ($this->plugins as $name => $plugin) {
            $plugin->setContainerBuilder($builder);
        }
        $containerNode = $builder->build();
        $buffer = new Buffer();
        $buffer->write('<?php')->eol();
        $containerNode->compile($buffer);
        $buffer->writeln('return $z;');
        $code = $buffer->getResult();
        return $code;
    } 
 | 
	[
  "public",
  "function",
  "compileContainerCode",
  "(",
  ")",
  "{",
  "$",
  "builder",
  "=",
  "new",
  "ContainerBuilder",
  "(",
  "$",
  "this",
  "->",
  "configTree",
  ")",
  ";",
  "foreach",
  "(",
  "$",
  "this",
  "->",
  "plugins",
  "as",
  "$",
  "name",
  "=>",
  "$",
  "plugin",
  ")",
  "{",
  "$",
  "plugin",
  "->",
  "setContainerBuilder",
  "(",
  "$",
  "builder",
  ")",
  ";",
  "}",
  "$",
  "containerNode",
  "=",
  "$",
  "builder",
  "->",
  "build",
  "(",
  ")",
  ";",
  "$",
  "buffer",
  "=",
  "new",
  "Buffer",
  "(",
  ")",
  ";",
  "$",
  "buffer",
  "->",
  "write",
  "(",
  "'<?php'",
  ")",
  "->",
  "eol",
  "(",
  ")",
  ";",
  "$",
  "containerNode",
  "->",
  "compile",
  "(",
  "$",
  "buffer",
  ")",
  ";",
  "$",
  "buffer",
  "->",
  "writeln",
  "(",
  "'return $z;'",
  ")",
  ";",
  "$",
  "code",
  "=",
  "$",
  "buffer",
  "->",
  "getResult",
  "(",
  ")",
  ";",
  "return",
  "$",
  "code",
  ";",
  "}"
]  | 
	Returns the code for initializing the container.
@return string 
 | 
	[
  "Returns",
  "the",
  "code",
  "for",
  "initializing",
  "the",
  "container",
  "."
]  | 
	train 
 | 
	https://github.com/zicht/z/blob/6a1731dad20b018555a96b726a61d4bf8ec8c886/src/Zicht/Tool/Container/ContainerCompiler.php#L103-L116 
 | 
					
	wenbinye/PhalconX 
 | 
	src/Enum/Enum.php 
 | 
	Enum.instances 
 | 
	public static function instances()
    {
        $all = [];
        foreach (static::getNames() as $name => $val) {
            $all[] = new static($name, $val);
        }
        return $all;
    } 
 | 
	php 
 | 
	public static function instances()
    {
        $all = [];
        foreach (static::getNames() as $name => $val) {
            $all[] = new static($name, $val);
        }
        return $all;
    } 
 | 
	[
  "public",
  "static",
  "function",
  "instances",
  "(",
  ")",
  "{",
  "$",
  "all",
  "=",
  "[",
  "]",
  ";",
  "foreach",
  "(",
  "static",
  "::",
  "getNames",
  "(",
  ")",
  "as",
  "$",
  "name",
  "=>",
  "$",
  "val",
  ")",
  "{",
  "$",
  "all",
  "[",
  "]",
  "=",
  "new",
  "static",
  "(",
  "$",
  "name",
  ",",
  "$",
  "val",
  ")",
  ";",
  "}",
  "return",
  "$",
  "all",
  ";",
  "}"
]  | 
	Gets all enums
@return Enum[] 
 | 
	[
  "Gets",
  "all",
  "enums"
]  | 
	train 
 | 
	https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Enum/Enum.php#L120-L127 
 | 
					
	wenbinye/PhalconX 
 | 
	src/Enum/Enum.php 
 | 
	Enum.nameOf 
 | 
	public static function nameOf($value)
    {
        $values = static::getValues();
        return isset($values[$value]) ? $values[$value] : null;
    } 
 | 
	php 
 | 
	public static function nameOf($value)
    {
        $values = static::getValues();
        return isset($values[$value]) ? $values[$value] : null;
    } 
 | 
	[
  "public",
  "static",
  "function",
  "nameOf",
  "(",
  "$",
  "value",
  ")",
  "{",
  "$",
  "values",
  "=",
  "static",
  "::",
  "getValues",
  "(",
  ")",
  ";",
  "return",
  "isset",
  "(",
  "$",
  "values",
  "[",
  "$",
  "value",
  "]",
  ")",
  "?",
  "$",
  "values",
  "[",
  "$",
  "value",
  "]",
  ":",
  "null",
  ";",
  "}"
]  | 
	Gets the name for the enum value
@return string 
 | 
	[
  "Gets",
  "the",
  "name",
  "for",
  "the",
  "enum",
  "value"
]  | 
	train 
 | 
	https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Enum/Enum.php#L142-L146 
 | 
					
	wenbinye/PhalconX 
 | 
	src/Enum/Enum.php 
 | 
	Enum.valueOf 
 | 
	public static function valueOf($name)
    {
        $names = static::getNames();
        return isset($names[$name]) ? $names[$name] : null;
    } 
 | 
	php 
 | 
	public static function valueOf($name)
    {
        $names = static::getNames();
        return isset($names[$name]) ? $names[$name] : null;
    } 
 | 
	[
  "public",
  "static",
  "function",
  "valueOf",
  "(",
  "$",
  "name",
  ")",
  "{",
  "$",
  "names",
  "=",
  "static",
  "::",
  "getNames",
  "(",
  ")",
  ";",
  "return",
  "isset",
  "(",
  "$",
  "names",
  "[",
  "$",
  "name",
  "]",
  ")",
  "?",
  "$",
  "names",
  "[",
  "$",
  "name",
  "]",
  ":",
  "null",
  ";",
  "}"
]  | 
	Gets the enum value for the name
@return mixed value of 
 | 
	[
  "Gets",
  "the",
  "enum",
  "value",
  "for",
  "the",
  "name"
]  | 
	train 
 | 
	https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Enum/Enum.php#L162-L166 
 | 
					
	wenbinye/PhalconX 
 | 
	src/Enum/Enum.php 
 | 
	Enum.fromName 
 | 
	public static function fromName($name)
    {
        $names = static::getNames();
        if (array_key_exists($name, $names)) {
            return new static($name, $names[$name]);
        }
        throw new \InvalidArgumentException("No enum constant '$name' in class " . get_called_class());
    } 
 | 
	php 
 | 
	public static function fromName($name)
    {
        $names = static::getNames();
        if (array_key_exists($name, $names)) {
            return new static($name, $names[$name]);
        }
        throw new \InvalidArgumentException("No enum constant '$name' in class " . get_called_class());
    } 
 | 
	[
  "public",
  "static",
  "function",
  "fromName",
  "(",
  "$",
  "name",
  ")",
  "{",
  "$",
  "names",
  "=",
  "static",
  "::",
  "getNames",
  "(",
  ")",
  ";",
  "if",
  "(",
  "array_key_exists",
  "(",
  "$",
  "name",
  ",",
  "$",
  "names",
  ")",
  ")",
  "{",
  "return",
  "new",
  "static",
  "(",
  "$",
  "name",
  ",",
  "$",
  "names",
  "[",
  "$",
  "name",
  "]",
  ")",
  ";",
  "}",
  "throw",
  "new",
  "\\",
  "InvalidArgumentException",
  "(",
  "\"No enum constant '$name' in class \"",
  ".",
  "get_called_class",
  "(",
  ")",
  ")",
  ";",
  "}"
]  | 
	Gets the enum instance for the name
@return Enum 
 | 
	[
  "Gets",
  "the",
  "enum",
  "instance",
  "for",
  "the",
  "name"
]  | 
	train 
 | 
	https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Enum/Enum.php#L173-L180 
 | 
					
	wenbinye/PhalconX 
 | 
	src/Enum/Enum.php 
 | 
	Enum.fromValue 
 | 
	public static function fromValue($value)
    {
        $values = static::getValues();
        if (array_key_exists($value, $values)) {
            return new static($values[$value], $value);
        }
        throw new \InvalidArgumentException("No enum constant value '$value' class " . get_called_class());
    } 
 | 
	php 
 | 
	public static function fromValue($value)
    {
        $values = static::getValues();
        if (array_key_exists($value, $values)) {
            return new static($values[$value], $value);
        }
        throw new \InvalidArgumentException("No enum constant value '$value' class " . get_called_class());
    } 
 | 
	[
  "public",
  "static",
  "function",
  "fromValue",
  "(",
  "$",
  "value",
  ")",
  "{",
  "$",
  "values",
  "=",
  "static",
  "::",
  "getValues",
  "(",
  ")",
  ";",
  "if",
  "(",
  "array_key_exists",
  "(",
  "$",
  "value",
  ",",
  "$",
  "values",
  ")",
  ")",
  "{",
  "return",
  "new",
  "static",
  "(",
  "$",
  "values",
  "[",
  "$",
  "value",
  "]",
  ",",
  "$",
  "value",
  ")",
  ";",
  "}",
  "throw",
  "new",
  "\\",
  "InvalidArgumentException",
  "(",
  "\"No enum constant value '$value' class \"",
  ".",
  "get_called_class",
  "(",
  ")",
  ")",
  ";",
  "}"
]  | 
	Gets the enum instance for the value
@return Enum 
 | 
	[
  "Gets",
  "the",
  "enum",
  "instance",
  "for",
  "the",
  "value"
]  | 
	train 
 | 
	https://github.com/wenbinye/PhalconX/blob/0d2e1480e722dde56ccd23b2e8a5c8ac6ac2f8e1/src/Enum/Enum.php#L187-L194 
 | 
					
	nguyenanhung/security 
 | 
	src/HtmlSecurity.php 
 | 
	HtmlSecurity.escape 
 | 
	public function escape($str = '')
    {
        $config = \HTMLPurifier_Config::createDefault();
        $config->set('Cache.SerializerPath', $this->cachePath);
        if (!empty($this->config) && is_array($this->config) && count($this->config) > 0) {
            foreach ($this->config as $key => $value) {
                $config->set($key, $value);
            }
        }
        $purifier = new \HTMLPurifier($config);
        $clean    = $purifier->purify($str);
        return $clean;
    } 
 | 
	php 
 | 
	public function escape($str = '')
    {
        $config = \HTMLPurifier_Config::createDefault();
        $config->set('Cache.SerializerPath', $this->cachePath);
        if (!empty($this->config) && is_array($this->config) && count($this->config) > 0) {
            foreach ($this->config as $key => $value) {
                $config->set($key, $value);
            }
        }
        $purifier = new \HTMLPurifier($config);
        $clean    = $purifier->purify($str);
        return $clean;
    } 
 | 
	[
  "public",
  "function",
  "escape",
  "(",
  "$",
  "str",
  "=",
  "''",
  ")",
  "{",
  "$",
  "config",
  "=",
  "\\",
  "HTMLPurifier_Config",
  "::",
  "createDefault",
  "(",
  ")",
  ";",
  "$",
  "config",
  "->",
  "set",
  "(",
  "'Cache.SerializerPath'",
  ",",
  "$",
  "this",
  "->",
  "cachePath",
  ")",
  ";",
  "if",
  "(",
  "!",
  "empty",
  "(",
  "$",
  "this",
  "->",
  "config",
  ")",
  "&&",
  "is_array",
  "(",
  "$",
  "this",
  "->",
  "config",
  ")",
  "&&",
  "count",
  "(",
  "$",
  "this",
  "->",
  "config",
  ")",
  ">",
  "0",
  ")",
  "{",
  "foreach",
  "(",
  "$",
  "this",
  "->",
  "config",
  "as",
  "$",
  "key",
  "=>",
  "$",
  "value",
  ")",
  "{",
  "$",
  "config",
  "->",
  "set",
  "(",
  "$",
  "key",
  ",",
  "$",
  "value",
  ")",
  ";",
  "}",
  "}",
  "$",
  "purifier",
  "=",
  "new",
  "\\",
  "HTMLPurifier",
  "(",
  "$",
  "config",
  ")",
  ";",
  "$",
  "clean",
  "=",
  "$",
  "purifier",
  "->",
  "purify",
  "(",
  "$",
  "str",
  ")",
  ";",
  "return",
  "$",
  "clean",
  ";",
  "}"
]  | 
	HTML Escape
Hàm clean mã html, loại bỏ mã độc, mã bẩn sử dụng HTML Purifier
@author: 713uk13m <[email protected]>
@time  : 10/18/18 09:45
@param string $str Chuỗi đầu vào
@return string Nội dung đầu ra sau khi đã lọc 
 | 
	[
  "HTML",
  "Escape"
]  | 
	train 
 | 
	https://github.com/nguyenanhung/security/blob/a2c9bac66d3c2dad6d668ba6c2bd82ed04bffbd6/src/HtmlSecurity.php#L111-L124 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/traits/readonly.php 
 | 
	Readonly.__isset 
 | 
	public function __isset( $name ) {
		return $this->is_readonly_property( $name ) && property_exists( $this, $name ) && ! is_null( $this->$name );
	} 
 | 
	php 
 | 
	public function __isset( $name ) {
		return $this->is_readonly_property( $name ) && property_exists( $this, $name ) && ! is_null( $this->$name );
	} 
 | 
	[
  "public",
  "function",
  "__isset",
  "(",
  "$",
  "name",
  ")",
  "{",
  "return",
  "$",
  "this",
  "->",
  "is_readonly_property",
  "(",
  "$",
  "name",
  ")",
  "&&",
  "property_exists",
  "(",
  "$",
  "this",
  ",",
  "$",
  "name",
  ")",
  "&&",
  "!",
  "is_null",
  "(",
  "$",
  "this",
  "->",
  "$",
  "name",
  ")",
  ";",
  "}"
]  | 
	@param string $name
@return bool 
 | 
	[
  "@param",
  "string",
  "$name"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/readonly.php#L92-L94 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/traits/readonly.php 
 | 
	Readonly.is_readonly_property 
 | 
	private function is_readonly_property( $name ) {
		return is_string( $name ) && property_exists( $this, 'readonly_properties' ) && in_array( $name, $this->readonly_properties );
	} 
 | 
	php 
 | 
	private function is_readonly_property( $name ) {
		return is_string( $name ) && property_exists( $this, 'readonly_properties' ) && in_array( $name, $this->readonly_properties );
	} 
 | 
	[
  "private",
  "function",
  "is_readonly_property",
  "(",
  "$",
  "name",
  ")",
  "{",
  "return",
  "is_string",
  "(",
  "$",
  "name",
  ")",
  "&&",
  "property_exists",
  "(",
  "$",
  "this",
  ",",
  "'readonly_properties'",
  ")",
  "&&",
  "in_array",
  "(",
  "$",
  "name",
  ",",
  "$",
  "this",
  "->",
  "readonly_properties",
  ")",
  ";",
  "}"
]  | 
	@param string $name
@return bool 
 | 
	[
  "@param",
  "string",
  "$name"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/traits/readonly.php#L101-L103 
 | 
					
	surebert/surebert-framework 
 | 
	src/sb/PDO.php 
 | 
	PDO.s2o 
 | 
	public function s2o($sql, $params=null, $class_name='')
    {
        //if it has parameters then prepare the statement and execute with the parameters
        //stmts that have already been prepared will reuse the prepared statement
        if(is_array($params) || is_object($params)){
            //convert object parameters
            $param = is_array($params) ? $params : self::paramify($params);
            $stmt = $this->prepare($sql);
            $result = $stmt->execute($params);
            if(!$result){
                return Array();
            }
        //if there
        } else {
            $result = $this->query($sql);
            if(!is_object($result)){
                return Array();
            } else {
                $stmt = $result;
            }
        }
        //if the class_name is set return instances
        if(!preg_match("~^SELECT|EXEC|CALL~i", trim($sql))){
            return $stmt;
        } elseif(!empty($class_name)){
            if(class_exists($class_name)){
                return $stmt->fetchAll(\PDO::FETCH_CLASS, $class_name);
            }
        } else {
            //otherwise return standard objects
            return $stmt->fetchAll(\PDO::FETCH_OBJ);
        }
    } 
 | 
	php 
 | 
	public function s2o($sql, $params=null, $class_name='')
    {
        //if it has parameters then prepare the statement and execute with the parameters
        //stmts that have already been prepared will reuse the prepared statement
        if(is_array($params) || is_object($params)){
            //convert object parameters
            $param = is_array($params) ? $params : self::paramify($params);
            $stmt = $this->prepare($sql);
            $result = $stmt->execute($params);
            if(!$result){
                return Array();
            }
        //if there
        } else {
            $result = $this->query($sql);
            if(!is_object($result)){
                return Array();
            } else {
                $stmt = $result;
            }
        }
        //if the class_name is set return instances
        if(!preg_match("~^SELECT|EXEC|CALL~i", trim($sql))){
            return $stmt;
        } elseif(!empty($class_name)){
            if(class_exists($class_name)){
                return $stmt->fetchAll(\PDO::FETCH_CLASS, $class_name);
            }
        } else {
            //otherwise return standard objects
            return $stmt->fetchAll(\PDO::FETCH_OBJ);
        }
    } 
 | 
	[
  "public",
  "function",
  "s2o",
  "(",
  "$",
  "sql",
  ",",
  "$",
  "params",
  "=",
  "null",
  ",",
  "$",
  "class_name",
  "=",
  "''",
  ")",
  "{",
  "//if it has parameters then prepare the statement and execute with the parameters",
  "//stmts that have already been prepared will reuse the prepared statement",
  "if",
  "(",
  "is_array",
  "(",
  "$",
  "params",
  ")",
  "||",
  "is_object",
  "(",
  "$",
  "params",
  ")",
  ")",
  "{",
  "//convert object parameters",
  "$",
  "param",
  "=",
  "is_array",
  "(",
  "$",
  "params",
  ")",
  "?",
  "$",
  "params",
  ":",
  "self",
  "::",
  "paramify",
  "(",
  "$",
  "params",
  ")",
  ";",
  "$",
  "stmt",
  "=",
  "$",
  "this",
  "->",
  "prepare",
  "(",
  "$",
  "sql",
  ")",
  ";",
  "$",
  "result",
  "=",
  "$",
  "stmt",
  "->",
  "execute",
  "(",
  "$",
  "params",
  ")",
  ";",
  "if",
  "(",
  "!",
  "$",
  "result",
  ")",
  "{",
  "return",
  "Array",
  "(",
  ")",
  ";",
  "}",
  "//if there",
  "}",
  "else",
  "{",
  "$",
  "result",
  "=",
  "$",
  "this",
  "->",
  "query",
  "(",
  "$",
  "sql",
  ")",
  ";",
  "if",
  "(",
  "!",
  "is_object",
  "(",
  "$",
  "result",
  ")",
  ")",
  "{",
  "return",
  "Array",
  "(",
  ")",
  ";",
  "}",
  "else",
  "{",
  "$",
  "stmt",
  "=",
  "$",
  "result",
  ";",
  "}",
  "}",
  "//if the class_name is set return instances",
  "if",
  "(",
  "!",
  "preg_match",
  "(",
  "\"~^SELECT|EXEC|CALL~i\"",
  ",",
  "trim",
  "(",
  "$",
  "sql",
  ")",
  ")",
  ")",
  "{",
  "return",
  "$",
  "stmt",
  ";",
  "}",
  "elseif",
  "(",
  "!",
  "empty",
  "(",
  "$",
  "class_name",
  ")",
  ")",
  "{",
  "if",
  "(",
  "class_exists",
  "(",
  "$",
  "class_name",
  ")",
  ")",
  "{",
  "return",
  "$",
  "stmt",
  "->",
  "fetchAll",
  "(",
  "\\",
  "PDO",
  "::",
  "FETCH_CLASS",
  ",",
  "$",
  "class_name",
  ")",
  ";",
  "}",
  "}",
  "else",
  "{",
  "//otherwise return standard objects",
  "return",
  "$",
  "stmt",
  "->",
  "fetchAll",
  "(",
  "\\",
  "PDO",
  "::",
  "FETCH_OBJ",
  ")",
  ";",
  "}",
  "}"
]  | 
	Turn a sql query into an array of objects representing each row returned
@param string $sql A sql string, can be used with :prop to create a prepared statement
@param Array params An array hash of values to match with properties inside prepared statement
@param Object params An object whose properties match with properties inside prepared statement.
@param Array class_name Here you can specify a class_name, so that rows returned are instances of that class_name instead of standard objects
@return array An array of objects representing rows returned
<code>
//without prepared statements
$results = App::$db->s2o("SELECT * FROM pages WHERE pid =1");
//with prepared statement and params array
$results = App::$db->s2o("SELECT * FROM pages WHERE pid =:pid", Array(":pid"=>1));
//with prepared statement and params object
$params = new stdClass();
$params->pid = 1;
$results = App::$db->s2o("SELECT * FROM pages WHERE pid =:pid", $params);
//with prepared statement and params array plus class_name
$results = App::$db->s2o("SELECT * FROM pages WHERE pid =:pid", Array(":pid" => 1), 'Page');
* //without prepared statement and plus class_name, fetches rows from the pages table into Page instances
$results = App::$db->s2o("SELECT * FROM pages", null, 'Page');
</code> 
 | 
	[
  "Turn",
  "a",
  "sql",
  "query",
  "into",
  "an",
  "array",
  "of",
  "objects",
  "representing",
  "each",
  "row",
  "returned"
]  | 
	train 
 | 
	https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO.php#L74-L116 
 | 
					
	surebert/surebert-framework 
 | 
	src/sb/PDO.php 
 | 
	PDO.paramify 
 | 
	public static function paramify($data, $omit=Array())
    {
        $params = Array();
        if(is_object($data)){
            $data = get_object_vars($data);
        }
        if(is_array($data)){
            foreach($data as $key=>$val){
                if(!in_array($key, $omit)){
                    $params[':'.$key] = $val;
                }
            }
        }
        return $params;
    } 
 | 
	php 
 | 
	public static function paramify($data, $omit=Array())
    {
        $params = Array();
        if(is_object($data)){
            $data = get_object_vars($data);
        }
        if(is_array($data)){
            foreach($data as $key=>$val){
                if(!in_array($key, $omit)){
                    $params[':'.$key] = $val;
                }
            }
        }
        return $params;
    } 
 | 
	[
  "public",
  "static",
  "function",
  "paramify",
  "(",
  "$",
  "data",
  ",",
  "$",
  "omit",
  "=",
  "Array",
  "(",
  ")",
  ")",
  "{",
  "$",
  "params",
  "=",
  "Array",
  "(",
  ")",
  ";",
  "if",
  "(",
  "is_object",
  "(",
  "$",
  "data",
  ")",
  ")",
  "{",
  "$",
  "data",
  "=",
  "get_object_vars",
  "(",
  "$",
  "data",
  ")",
  ";",
  "}",
  "if",
  "(",
  "is_array",
  "(",
  "$",
  "data",
  ")",
  ")",
  "{",
  "foreach",
  "(",
  "$",
  "data",
  "as",
  "$",
  "key",
  "=>",
  "$",
  "val",
  ")",
  "{",
  "if",
  "(",
  "!",
  "in_array",
  "(",
  "$",
  "key",
  ",",
  "$",
  "omit",
  ")",
  ")",
  "{",
  "$",
  "params",
  "[",
  "':'",
  ".",
  "$",
  "key",
  "]",
  "=",
  "$",
  "val",
  ";",
  "}",
  "}",
  "}",
  "return",
  "$",
  "params",
  ";",
  "}"
]  | 
	Converts an array into a bound params hash
@param array/object $data The object/hash to convert to a bindParams compatible hash with the colon in front of each key so that it can be used as a bid param array
@param array $omit An simple array of key names to omit from the array
@return array The input data as an array designed for passing to pdo's execute or bindParams
@author [email protected]
@version 1.0
<code>
$question = new Question();
$question->qid = 1;
$question->answer = 'grape';
$params = \sb\PDO::paramify($question);
//returns $params as Array ( [:qid] => 1 [:answer] => 'grape' )
$params = \sb\PDO::paramify(Array('qid' => 1, 'answer' => 'grape'));
//returns $params as Array ( [:qid] => 1 [:answer] => 'grape' )
</code> 
 | 
	[
  "Converts",
  "an",
  "array",
  "into",
  "a",
  "bound",
  "params",
  "hash"
]  | 
	train 
 | 
	https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO.php#L139-L157 
 | 
					
	surebert/surebert-framework 
 | 
	src/sb/PDO.php 
 | 
	PDO.prepare 
 | 
	public function prepare($sql, $driver_options=array())
    {
        $md5 = md5($sql);
        if(isset($this->prepared_sql[$md5])){
            return $this->prepared_sql[$md5];
        }
        $stmt = parent::prepare($sql, $driver_options);
        $this->prepared_sql[$md5] = $stmt;
        return $stmt;
    } 
 | 
	php 
 | 
	public function prepare($sql, $driver_options=array())
    {
        $md5 = md5($sql);
        if(isset($this->prepared_sql[$md5])){
            return $this->prepared_sql[$md5];
        }
        $stmt = parent::prepare($sql, $driver_options);
        $this->prepared_sql[$md5] = $stmt;
        return $stmt;
    } 
 | 
	[
  "public",
  "function",
  "prepare",
  "(",
  "$",
  "sql",
  ",",
  "$",
  "driver_options",
  "=",
  "array",
  "(",
  ")",
  ")",
  "{",
  "$",
  "md5",
  "=",
  "md5",
  "(",
  "$",
  "sql",
  ")",
  ";",
  "if",
  "(",
  "isset",
  "(",
  "$",
  "this",
  "->",
  "prepared_sql",
  "[",
  "$",
  "md5",
  "]",
  ")",
  ")",
  "{",
  "return",
  "$",
  "this",
  "->",
  "prepared_sql",
  "[",
  "$",
  "md5",
  "]",
  ";",
  "}",
  "$",
  "stmt",
  "=",
  "parent",
  "::",
  "prepare",
  "(",
  "$",
  "sql",
  ",",
  "$",
  "driver_options",
  ")",
  ";",
  "$",
  "this",
  "->",
  "prepared_sql",
  "[",
  "$",
  "md5",
  "]",
  "=",
  "$",
  "stmt",
  ";",
  "return",
  "$",
  "stmt",
  ";",
  "}"
]  | 
	Used to prepare and store sql statements for value binding
@param string $sql
@return PDOStatement A PDO_statment instance 
 | 
	[
  "Used",
  "to",
  "prepare",
  "and",
  "store",
  "sql",
  "statements",
  "for",
  "value",
  "binding"
]  | 
	train 
 | 
	https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/PDO.php#L165-L177 
 | 
					
	BOOKEEN/opds-parser 
 | 
	src/Utils/XmlLoaderUtils.php 
 | 
	XmlLoaderUtils.loadXmlByFile 
 | 
	public static function loadXmlByFile($file)
    {
        $handle = fopen($file, 'r');
        if (!$handle) {
            throw new OpdsParserNotFoundException();
        }
        while (!feof($handle)) {
            $content .= fread($handle, 8192); // 8192 : nombre d'octets équivalent à la taille d'un bloc
        }
        fclose($handle);
        return new \SimpleXMLElement($content);
    } 
 | 
	php 
 | 
	public static function loadXmlByFile($file)
    {
        $handle = fopen($file, 'r');
        if (!$handle) {
            throw new OpdsParserNotFoundException();
        }
        while (!feof($handle)) {
            $content .= fread($handle, 8192); // 8192 : nombre d'octets équivalent à la taille d'un bloc
        }
        fclose($handle);
        return new \SimpleXMLElement($content);
    } 
 | 
	[
  "public",
  "static",
  "function",
  "loadXmlByFile",
  "(",
  "$",
  "file",
  ")",
  "{",
  "$",
  "handle",
  "=",
  "fopen",
  "(",
  "$",
  "file",
  ",",
  "'r'",
  ")",
  ";",
  "if",
  "(",
  "!",
  "$",
  "handle",
  ")",
  "{",
  "throw",
  "new",
  "OpdsParserNotFoundException",
  "(",
  ")",
  ";",
  "}",
  "while",
  "(",
  "!",
  "feof",
  "(",
  "$",
  "handle",
  ")",
  ")",
  "{",
  "$",
  "content",
  ".=",
  "fread",
  "(",
  "$",
  "handle",
  ",",
  "8192",
  ")",
  ";",
  "// 8192 : nombre d'octets équivalent à la taille d'un bloc",
  "}",
  "fclose",
  "(",
  "$",
  "handle",
  ")",
  ";",
  "return",
  "new",
  "\\",
  "SimpleXMLElement",
  "(",
  "$",
  "content",
  ")",
  ";",
  "}"
]  | 
	Récupère un flux XML par dans un fichier
@param string $file file path
@return \SimpleXMLElement
@throws OpdsParserNotFoundException 
 | 
	[
  "Récupère",
  "un",
  "flux",
  "XML",
  "par",
  "dans",
  "un",
  "fichier"
]  | 
	train 
 | 
	https://github.com/BOOKEEN/opds-parser/blob/b9ef065210e81ee63b029e37c6943c6fa8c74cef/src/Utils/XmlLoaderUtils.php#L19-L33 
 | 
					
	BOOKEEN/opds-parser 
 | 
	src/Utils/XmlLoaderUtils.php 
 | 
	XmlLoaderUtils.loadXmlByUrl 
 | 
	public static function loadXmlByUrl($url, $headerList = null)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        if ($headerList) {
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headerList);
        }
        $content = curl_exec($ch);
        if (!$content) {
            throw new OpdsParserLoaderException('Fail to load ' . $url);
        }
        return new \SimpleXMLElement($content);
    } 
 | 
	php 
 | 
	public static function loadXmlByUrl($url, $headerList = null)
    {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        if ($headerList) {
            curl_setopt($ch, CURLOPT_HTTPHEADER, $headerList);
        }
        $content = curl_exec($ch);
        if (!$content) {
            throw new OpdsParserLoaderException('Fail to load ' . $url);
        }
        return new \SimpleXMLElement($content);
    } 
 | 
	[
  "public",
  "static",
  "function",
  "loadXmlByUrl",
  "(",
  "$",
  "url",
  ",",
  "$",
  "headerList",
  "=",
  "null",
  ")",
  "{",
  "$",
  "ch",
  "=",
  "curl_init",
  "(",
  ")",
  ";",
  "curl_setopt",
  "(",
  "$",
  "ch",
  ",",
  "CURLOPT_URL",
  ",",
  "$",
  "url",
  ")",
  ";",
  "curl_setopt",
  "(",
  "$",
  "ch",
  ",",
  "CURLOPT_HEADER",
  ",",
  "0",
  ")",
  ";",
  "curl_setopt",
  "(",
  "$",
  "ch",
  ",",
  "CURLOPT_RETURNTRANSFER",
  ",",
  "1",
  ")",
  ";",
  "if",
  "(",
  "$",
  "headerList",
  ")",
  "{",
  "curl_setopt",
  "(",
  "$",
  "ch",
  ",",
  "CURLOPT_HTTPHEADER",
  ",",
  "$",
  "headerList",
  ")",
  ";",
  "}",
  "$",
  "content",
  "=",
  "curl_exec",
  "(",
  "$",
  "ch",
  ")",
  ";",
  "if",
  "(",
  "!",
  "$",
  "content",
  ")",
  "{",
  "throw",
  "new",
  "OpdsParserLoaderException",
  "(",
  "'Fail to load '",
  ".",
  "$",
  "url",
  ")",
  ";",
  "}",
  "return",
  "new",
  "\\",
  "SimpleXMLElement",
  "(",
  "$",
  "content",
  ")",
  ";",
  "}"
]  | 
	Récupère un flux XML par une url
@param string $url
@param array $headerList
@return \SimpleXMLElement
@throws OpdsParserLoaderException 
 | 
	[
  "Récupère",
  "un",
  "flux",
  "XML",
  "par",
  "une",
  "url"
]  | 
	train 
 | 
	https://github.com/BOOKEEN/opds-parser/blob/b9ef065210e81ee63b029e37c6943c6fa8c74cef/src/Utils/XmlLoaderUtils.php#L44-L62 
 | 
					
	mothership-ec/composer 
 | 
	src/Composer/Command/ShowCommand.php 
 | 
	ShowCommand.printMeta 
 | 
	protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
    {
        $this->getIO()->write('<info>name</info>     : ' . $package->getPrettyName());
        $this->getIO()->write('<info>descrip.</info> : ' . $package->getDescription());
        $this->getIO()->write('<info>keywords</info> : ' . join(', ', $package->getKeywords() ?: array()));
        $this->printVersions($package, $versions, $installedRepo);
        $this->getIO()->write('<info>type</info>     : ' . $package->getType());
        $this->printLicenses($package);
        $this->getIO()->write('<info>source</info>   : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
        $this->getIO()->write('<info>dist</info>     : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
        $this->getIO()->write('<info>names</info>    : ' . implode(', ', $package->getNames()));
        if ($package->isAbandoned()) {
            $replacement = ($package->getReplacementPackage() !== null)
                ? ' The author suggests using the ' . $package->getReplacementPackage(). ' package instead.'
                : null;
            $this->getIO()->writeError(
                sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
            );
        }
        if ($package->getSupport()) {
            $this->getIO()->write("\n<info>support</info>");
            foreach ($package->getSupport() as $type => $value) {
                $this->getIO()->write('<comment>' . $type . '</comment> : '.$value);
            }
        }
        if ($package->getAutoload()) {
            $this->getIO()->write("\n<info>autoload</info>");
            foreach ($package->getAutoload() as $type => $autoloads) {
                $this->getIO()->write('<comment>' . $type . '</comment>');
                if ($type === 'psr-0') {
                    foreach ($autoloads as $name => $path) {
                        $this->getIO()->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
                    }
                } elseif ($type === 'psr-4') {
                    foreach ($autoloads as $name => $path) {
                        $this->getIO()->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
                    }
                } elseif ($type === 'classmap') {
                    $this->getIO()->write(implode(', ', $autoloads));
                }
            }
            if ($package->getIncludePaths()) {
                $this->getIO()->write('<comment>include-path</comment>');
                $this->getIO()->write(implode(', ', $package->getIncludePaths()));
            }
        }
    } 
 | 
	php 
 | 
	protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
    {
        $this->getIO()->write('<info>name</info>     : ' . $package->getPrettyName());
        $this->getIO()->write('<info>descrip.</info> : ' . $package->getDescription());
        $this->getIO()->write('<info>keywords</info> : ' . join(', ', $package->getKeywords() ?: array()));
        $this->printVersions($package, $versions, $installedRepo);
        $this->getIO()->write('<info>type</info>     : ' . $package->getType());
        $this->printLicenses($package);
        $this->getIO()->write('<info>source</info>   : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
        $this->getIO()->write('<info>dist</info>     : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
        $this->getIO()->write('<info>names</info>    : ' . implode(', ', $package->getNames()));
        if ($package->isAbandoned()) {
            $replacement = ($package->getReplacementPackage() !== null)
                ? ' The author suggests using the ' . $package->getReplacementPackage(). ' package instead.'
                : null;
            $this->getIO()->writeError(
                sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
            );
        }
        if ($package->getSupport()) {
            $this->getIO()->write("\n<info>support</info>");
            foreach ($package->getSupport() as $type => $value) {
                $this->getIO()->write('<comment>' . $type . '</comment> : '.$value);
            }
        }
        if ($package->getAutoload()) {
            $this->getIO()->write("\n<info>autoload</info>");
            foreach ($package->getAutoload() as $type => $autoloads) {
                $this->getIO()->write('<comment>' . $type . '</comment>');
                if ($type === 'psr-0') {
                    foreach ($autoloads as $name => $path) {
                        $this->getIO()->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
                    }
                } elseif ($type === 'psr-4') {
                    foreach ($autoloads as $name => $path) {
                        $this->getIO()->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
                    }
                } elseif ($type === 'classmap') {
                    $this->getIO()->write(implode(', ', $autoloads));
                }
            }
            if ($package->getIncludePaths()) {
                $this->getIO()->write('<comment>include-path</comment>');
                $this->getIO()->write(implode(', ', $package->getIncludePaths()));
            }
        }
    } 
 | 
	[
  "protected",
  "function",
  "printMeta",
  "(",
  "CompletePackageInterface",
  "$",
  "package",
  ",",
  "array",
  "$",
  "versions",
  ",",
  "RepositoryInterface",
  "$",
  "installedRepo",
  ")",
  "{",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<info>name</info>     : '",
  ".",
  "$",
  "package",
  "->",
  "getPrettyName",
  "(",
  ")",
  ")",
  ";",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<info>descrip.</info> : '",
  ".",
  "$",
  "package",
  "->",
  "getDescription",
  "(",
  ")",
  ")",
  ";",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<info>keywords</info> : '",
  ".",
  "join",
  "(",
  "', '",
  ",",
  "$",
  "package",
  "->",
  "getKeywords",
  "(",
  ")",
  "?",
  ":",
  "array",
  "(",
  ")",
  ")",
  ")",
  ";",
  "$",
  "this",
  "->",
  "printVersions",
  "(",
  "$",
  "package",
  ",",
  "$",
  "versions",
  ",",
  "$",
  "installedRepo",
  ")",
  ";",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<info>type</info>     : '",
  ".",
  "$",
  "package",
  "->",
  "getType",
  "(",
  ")",
  ")",
  ";",
  "$",
  "this",
  "->",
  "printLicenses",
  "(",
  "$",
  "package",
  ")",
  ";",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<info>source</info>   : '",
  ".",
  "sprintf",
  "(",
  "'[%s] <comment>%s</comment> %s'",
  ",",
  "$",
  "package",
  "->",
  "getSourceType",
  "(",
  ")",
  ",",
  "$",
  "package",
  "->",
  "getSourceUrl",
  "(",
  ")",
  ",",
  "$",
  "package",
  "->",
  "getSourceReference",
  "(",
  ")",
  ")",
  ")",
  ";",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<info>dist</info>     : '",
  ".",
  "sprintf",
  "(",
  "'[%s] <comment>%s</comment> %s'",
  ",",
  "$",
  "package",
  "->",
  "getDistType",
  "(",
  ")",
  ",",
  "$",
  "package",
  "->",
  "getDistUrl",
  "(",
  ")",
  ",",
  "$",
  "package",
  "->",
  "getDistReference",
  "(",
  ")",
  ")",
  ")",
  ";",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<info>names</info>    : '",
  ".",
  "implode",
  "(",
  "', '",
  ",",
  "$",
  "package",
  "->",
  "getNames",
  "(",
  ")",
  ")",
  ")",
  ";",
  "if",
  "(",
  "$",
  "package",
  "->",
  "isAbandoned",
  "(",
  ")",
  ")",
  "{",
  "$",
  "replacement",
  "=",
  "(",
  "$",
  "package",
  "->",
  "getReplacementPackage",
  "(",
  ")",
  "!==",
  "null",
  ")",
  "?",
  "' The author suggests using the '",
  ".",
  "$",
  "package",
  "->",
  "getReplacementPackage",
  "(",
  ")",
  ".",
  "' package instead.'",
  ":",
  "null",
  ";",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "writeError",
  "(",
  "sprintf",
  "(",
  "'<warning>Attention: This package is abandoned and no longer maintained.%s</warning>'",
  ",",
  "$",
  "replacement",
  ")",
  ")",
  ";",
  "}",
  "if",
  "(",
  "$",
  "package",
  "->",
  "getSupport",
  "(",
  ")",
  ")",
  "{",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "\"\\n<info>support</info>\"",
  ")",
  ";",
  "foreach",
  "(",
  "$",
  "package",
  "->",
  "getSupport",
  "(",
  ")",
  "as",
  "$",
  "type",
  "=>",
  "$",
  "value",
  ")",
  "{",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<comment>'",
  ".",
  "$",
  "type",
  ".",
  "'</comment> : '",
  ".",
  "$",
  "value",
  ")",
  ";",
  "}",
  "}",
  "if",
  "(",
  "$",
  "package",
  "->",
  "getAutoload",
  "(",
  ")",
  ")",
  "{",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "\"\\n<info>autoload</info>\"",
  ")",
  ";",
  "foreach",
  "(",
  "$",
  "package",
  "->",
  "getAutoload",
  "(",
  ")",
  "as",
  "$",
  "type",
  "=>",
  "$",
  "autoloads",
  ")",
  "{",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<comment>'",
  ".",
  "$",
  "type",
  ".",
  "'</comment>'",
  ")",
  ";",
  "if",
  "(",
  "$",
  "type",
  "===",
  "'psr-0'",
  ")",
  "{",
  "foreach",
  "(",
  "$",
  "autoloads",
  "as",
  "$",
  "name",
  "=>",
  "$",
  "path",
  ")",
  "{",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "(",
  "$",
  "name",
  "?",
  ":",
  "'*'",
  ")",
  ".",
  "' => '",
  ".",
  "(",
  "is_array",
  "(",
  "$",
  "path",
  ")",
  "?",
  "implode",
  "(",
  "', '",
  ",",
  "$",
  "path",
  ")",
  ":",
  "(",
  "$",
  "path",
  "?",
  ":",
  "'.'",
  ")",
  ")",
  ")",
  ";",
  "}",
  "}",
  "elseif",
  "(",
  "$",
  "type",
  "===",
  "'psr-4'",
  ")",
  "{",
  "foreach",
  "(",
  "$",
  "autoloads",
  "as",
  "$",
  "name",
  "=>",
  "$",
  "path",
  ")",
  "{",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "(",
  "$",
  "name",
  "?",
  ":",
  "'*'",
  ")",
  ".",
  "' => '",
  ".",
  "(",
  "is_array",
  "(",
  "$",
  "path",
  ")",
  "?",
  "implode",
  "(",
  "', '",
  ",",
  "$",
  "path",
  ")",
  ":",
  "(",
  "$",
  "path",
  "?",
  ":",
  "'.'",
  ")",
  ")",
  ")",
  ";",
  "}",
  "}",
  "elseif",
  "(",
  "$",
  "type",
  "===",
  "'classmap'",
  ")",
  "{",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "implode",
  "(",
  "', '",
  ",",
  "$",
  "autoloads",
  ")",
  ")",
  ";",
  "}",
  "}",
  "if",
  "(",
  "$",
  "package",
  "->",
  "getIncludePaths",
  "(",
  ")",
  ")",
  "{",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<comment>include-path</comment>'",
  ")",
  ";",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "implode",
  "(",
  "', '",
  ",",
  "$",
  "package",
  "->",
  "getIncludePaths",
  "(",
  ")",
  ")",
  ")",
  ";",
  "}",
  "}",
  "}"
]  | 
	prints package meta data 
 | 
	[
  "prints",
  "package",
  "meta",
  "data"
]  | 
	train 
 | 
	https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Command/ShowCommand.php#L292-L343 
 | 
					
	mothership-ec/composer 
 | 
	src/Composer/Command/ShowCommand.php 
 | 
	ShowCommand.printLicenses 
 | 
	protected function printLicenses(CompletePackageInterface $package)
    {
        $spdxLicense = new SpdxLicense;
        $licenses = $package->getLicense();
        foreach ($licenses as $licenseId) {
            $license = $spdxLicense->getLicenseByIdentifier($licenseId); // keys: 0 fullname, 1 osi, 2 url
            if (!$license) {
                $out = $licenseId;
            } else {
                // is license OSI approved?
                if ($license[1] === true) {
                    $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
                } else {
                    $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
                }
            }
            $this->getIO()->write('<info>license</info>  : ' . $out);
        }
    } 
 | 
	php 
 | 
	protected function printLicenses(CompletePackageInterface $package)
    {
        $spdxLicense = new SpdxLicense;
        $licenses = $package->getLicense();
        foreach ($licenses as $licenseId) {
            $license = $spdxLicense->getLicenseByIdentifier($licenseId); // keys: 0 fullname, 1 osi, 2 url
            if (!$license) {
                $out = $licenseId;
            } else {
                // is license OSI approved?
                if ($license[1] === true) {
                    $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
                } else {
                    $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
                }
            }
            $this->getIO()->write('<info>license</info>  : ' . $out);
        }
    } 
 | 
	[
  "protected",
  "function",
  "printLicenses",
  "(",
  "CompletePackageInterface",
  "$",
  "package",
  ")",
  "{",
  "$",
  "spdxLicense",
  "=",
  "new",
  "SpdxLicense",
  ";",
  "$",
  "licenses",
  "=",
  "$",
  "package",
  "->",
  "getLicense",
  "(",
  ")",
  ";",
  "foreach",
  "(",
  "$",
  "licenses",
  "as",
  "$",
  "licenseId",
  ")",
  "{",
  "$",
  "license",
  "=",
  "$",
  "spdxLicense",
  "->",
  "getLicenseByIdentifier",
  "(",
  "$",
  "licenseId",
  ")",
  ";",
  "// keys: 0 fullname, 1 osi, 2 url",
  "if",
  "(",
  "!",
  "$",
  "license",
  ")",
  "{",
  "$",
  "out",
  "=",
  "$",
  "licenseId",
  ";",
  "}",
  "else",
  "{",
  "// is license OSI approved?",
  "if",
  "(",
  "$",
  "license",
  "[",
  "1",
  "]",
  "===",
  "true",
  ")",
  "{",
  "$",
  "out",
  "=",
  "sprintf",
  "(",
  "'%s (%s) (OSI approved) %s'",
  ",",
  "$",
  "license",
  "[",
  "0",
  "]",
  ",",
  "$",
  "licenseId",
  ",",
  "$",
  "license",
  "[",
  "2",
  "]",
  ")",
  ";",
  "}",
  "else",
  "{",
  "$",
  "out",
  "=",
  "sprintf",
  "(",
  "'%s (%s) %s'",
  ",",
  "$",
  "license",
  "[",
  "0",
  "]",
  ",",
  "$",
  "licenseId",
  ",",
  "$",
  "license",
  "[",
  "2",
  "]",
  ")",
  ";",
  "}",
  "}",
  "$",
  "this",
  "->",
  "getIO",
  "(",
  ")",
  "->",
  "write",
  "(",
  "'<info>license</info>  : '",
  ".",
  "$",
  "out",
  ")",
  ";",
  "}",
  "}"
]  | 
	Prints the licenses of a package with metadata
@param CompletePackageInterface $package 
 | 
	[
  "Prints",
  "the",
  "licenses",
  "of",
  "a",
  "package",
  "with",
  "metadata"
]  | 
	train 
 | 
	https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Command/ShowCommand.php#L391-L413 
 | 
					
	blast-project/BaseEntitiesBundle 
 | 
	src/EventListener/NormalizeListener.php 
 | 
	NormalizeListener.normalizeField 
 | 
	private function normalizeField($field, $actions)
    {
        $getter = 'get' . ucfirst($field);
        if (!method_exists($this->object, $getter)) {
            $this->logger->warn(
                "[NormalizeListener] Method « $getter » does not exist for Entity",
                ['class' => get_class($this->object)]
            );
            return;
        }
        $data = $this->object->$getter();
        $normalized = false;
        foreach ($actions as $action) {
            switch ($action) {
                case 'uppercase':
                case 'upper':
                    $data = mb_strtoupper($data);
                    $normalized = true;
                    break;
                case 'titlecase':
                case 'title':
                    $data = mb_convert_case($data, MB_CASE_TITLE);
                    $normalized = true;
                    break;
                default:
                    $this->logger->warn(
                        "[NormalizeListener] Action « $action » is not in defined normalizers list",
                        ['class' => get_class($this->object)]
                    );
            }
        }
        if (!$normalized) {
            return;
        }
        $setter = 'set' . ucfirst($field);
        if (!method_exists($this->object, $setter)) {
            $this->logger->warn(
                "[NormalizeListener] Method « $setter » does not exist for Entity",
                ['class' => get_class($this->object)]
            );
            return;
        }
        $this->object->$setter($data);
        $this->logger->debug(
            "[NormalizeListener] Normalized field « $field » for Entity",
            ['class' => get_class($this->object), 'field' => $field, 'actions' => implode(', ', $actions)]
        );
        return $data;
    } 
 | 
	php 
 | 
	private function normalizeField($field, $actions)
    {
        $getter = 'get' . ucfirst($field);
        if (!method_exists($this->object, $getter)) {
            $this->logger->warn(
                "[NormalizeListener] Method « $getter » does not exist for Entity",
                ['class' => get_class($this->object)]
            );
            return;
        }
        $data = $this->object->$getter();
        $normalized = false;
        foreach ($actions as $action) {
            switch ($action) {
                case 'uppercase':
                case 'upper':
                    $data = mb_strtoupper($data);
                    $normalized = true;
                    break;
                case 'titlecase':
                case 'title':
                    $data = mb_convert_case($data, MB_CASE_TITLE);
                    $normalized = true;
                    break;
                default:
                    $this->logger->warn(
                        "[NormalizeListener] Action « $action » is not in defined normalizers list",
                        ['class' => get_class($this->object)]
                    );
            }
        }
        if (!$normalized) {
            return;
        }
        $setter = 'set' . ucfirst($field);
        if (!method_exists($this->object, $setter)) {
            $this->logger->warn(
                "[NormalizeListener] Method « $setter » does not exist for Entity",
                ['class' => get_class($this->object)]
            );
            return;
        }
        $this->object->$setter($data);
        $this->logger->debug(
            "[NormalizeListener] Normalized field « $field » for Entity",
            ['class' => get_class($this->object), 'field' => $field, 'actions' => implode(', ', $actions)]
        );
        return $data;
    } 
 | 
	[
  "private",
  "function",
  "normalizeField",
  "(",
  "$",
  "field",
  ",",
  "$",
  "actions",
  ")",
  "{",
  "$",
  "getter",
  "=",
  "'get'",
  ".",
  "ucfirst",
  "(",
  "$",
  "field",
  ")",
  ";",
  "if",
  "(",
  "!",
  "method_exists",
  "(",
  "$",
  "this",
  "->",
  "object",
  ",",
  "$",
  "getter",
  ")",
  ")",
  "{",
  "$",
  "this",
  "->",
  "logger",
  "->",
  "warn",
  "(",
  "\"[NormalizeListener] Method « $getter » does not exist for Entity\",",
  "",
  "[",
  "'class'",
  "=>",
  "get_class",
  "(",
  "$",
  "this",
  "->",
  "object",
  ")",
  "]",
  ")",
  ";",
  "return",
  ";",
  "}",
  "$",
  "data",
  "=",
  "$",
  "this",
  "->",
  "object",
  "->",
  "$",
  "getter",
  "(",
  ")",
  ";",
  "$",
  "normalized",
  "=",
  "false",
  ";",
  "foreach",
  "(",
  "$",
  "actions",
  "as",
  "$",
  "action",
  ")",
  "{",
  "switch",
  "(",
  "$",
  "action",
  ")",
  "{",
  "case",
  "'uppercase'",
  ":",
  "case",
  "'upper'",
  ":",
  "$",
  "data",
  "=",
  "mb_strtoupper",
  "(",
  "$",
  "data",
  ")",
  ";",
  "$",
  "normalized",
  "=",
  "true",
  ";",
  "break",
  ";",
  "case",
  "'titlecase'",
  ":",
  "case",
  "'title'",
  ":",
  "$",
  "data",
  "=",
  "mb_convert_case",
  "(",
  "$",
  "data",
  ",",
  "MB_CASE_TITLE",
  ")",
  ";",
  "$",
  "normalized",
  "=",
  "true",
  ";",
  "break",
  ";",
  "default",
  ":",
  "$",
  "this",
  "->",
  "logger",
  "->",
  "warn",
  "(",
  "\"[NormalizeListener] Action « $action » is not in defined normalizers list\",",
  "",
  "[",
  "'class'",
  "=>",
  "get_class",
  "(",
  "$",
  "this",
  "->",
  "object",
  ")",
  "]",
  ")",
  ";",
  "}",
  "}",
  "if",
  "(",
  "!",
  "$",
  "normalized",
  ")",
  "{",
  "return",
  ";",
  "}",
  "$",
  "setter",
  "=",
  "'set'",
  ".",
  "ucfirst",
  "(",
  "$",
  "field",
  ")",
  ";",
  "if",
  "(",
  "!",
  "method_exists",
  "(",
  "$",
  "this",
  "->",
  "object",
  ",",
  "$",
  "setter",
  ")",
  ")",
  "{",
  "$",
  "this",
  "->",
  "logger",
  "->",
  "warn",
  "(",
  "\"[NormalizeListener] Method « $setter » does not exist for Entity\",",
  "",
  "[",
  "'class'",
  "=>",
  "get_class",
  "(",
  "$",
  "this",
  "->",
  "object",
  ")",
  "]",
  ")",
  ";",
  "return",
  ";",
  "}",
  "$",
  "this",
  "->",
  "object",
  "->",
  "$",
  "setter",
  "(",
  "$",
  "data",
  ")",
  ";",
  "$",
  "this",
  "->",
  "logger",
  "->",
  "debug",
  "(",
  "\"[NormalizeListener] Normalized field « $field » for Entity\",",
  "",
  "[",
  "'class'",
  "=>",
  "get_class",
  "(",
  "$",
  "this",
  "->",
  "object",
  ")",
  ",",
  "'field'",
  "=>",
  "$",
  "field",
  ",",
  "'actions'",
  "=>",
  "implode",
  "(",
  "', '",
  ",",
  "$",
  "actions",
  ")",
  "]",
  ")",
  ";",
  "return",
  "$",
  "data",
  ";",
  "}"
]  | 
	@param string $field
@param array  $actions (uppercase, titlecase...)
@return string|null 
 | 
	[
  "@param",
  "string",
  "$field",
  "@param",
  "array",
  "$actions",
  "(",
  "uppercase",
  "titlecase",
  "...",
  ")"
]  | 
	train 
 | 
	https://github.com/blast-project/BaseEntitiesBundle/blob/abd06891fc38922225ab7e4fcb437a286ba2c0c4/src/EventListener/NormalizeListener.php#L105-L159 
 | 
					
	vaibhavpandeyvpz/sandesh 
 | 
	src/ResponseSender.php 
 | 
	ResponseSender.send 
 | 
	public function send(ResponseInterface $response, $obl = null)
    {
        if (headers_sent()) {
            throw new \RuntimeException('Not sending response as headers already sent');
        }
        if (is_null($obl)) {
            $obl = ob_get_level();
        }
        while (ob_get_level() > $obl) {
            ob_end_flush();
        }
        if (!$response->hasHeader('Content-Length') && is_int($size = $response->getBody()->getSize())) {
            $response = $response->withHeader('Content-Length', (string)$size);
        }
        $this->sendStatusLine($response);
        $this->sendHeaders($response);
        $this->sendBody($response);
    } 
 | 
	php 
 | 
	public function send(ResponseInterface $response, $obl = null)
    {
        if (headers_sent()) {
            throw new \RuntimeException('Not sending response as headers already sent');
        }
        if (is_null($obl)) {
            $obl = ob_get_level();
        }
        while (ob_get_level() > $obl) {
            ob_end_flush();
        }
        if (!$response->hasHeader('Content-Length') && is_int($size = $response->getBody()->getSize())) {
            $response = $response->withHeader('Content-Length', (string)$size);
        }
        $this->sendStatusLine($response);
        $this->sendHeaders($response);
        $this->sendBody($response);
    } 
 | 
	[
  "public",
  "function",
  "send",
  "(",
  "ResponseInterface",
  "$",
  "response",
  ",",
  "$",
  "obl",
  "=",
  "null",
  ")",
  "{",
  "if",
  "(",
  "headers_sent",
  "(",
  ")",
  ")",
  "{",
  "throw",
  "new",
  "\\",
  "RuntimeException",
  "(",
  "'Not sending response as headers already sent'",
  ")",
  ";",
  "}",
  "if",
  "(",
  "is_null",
  "(",
  "$",
  "obl",
  ")",
  ")",
  "{",
  "$",
  "obl",
  "=",
  "ob_get_level",
  "(",
  ")",
  ";",
  "}",
  "while",
  "(",
  "ob_get_level",
  "(",
  ")",
  ">",
  "$",
  "obl",
  ")",
  "{",
  "ob_end_flush",
  "(",
  ")",
  ";",
  "}",
  "if",
  "(",
  "!",
  "$",
  "response",
  "->",
  "hasHeader",
  "(",
  "'Content-Length'",
  ")",
  "&&",
  "is_int",
  "(",
  "$",
  "size",
  "=",
  "$",
  "response",
  "->",
  "getBody",
  "(",
  ")",
  "->",
  "getSize",
  "(",
  ")",
  ")",
  ")",
  "{",
  "$",
  "response",
  "=",
  "$",
  "response",
  "->",
  "withHeader",
  "(",
  "'Content-Length'",
  ",",
  "(",
  "string",
  ")",
  "$",
  "size",
  ")",
  ";",
  "}",
  "$",
  "this",
  "->",
  "sendStatusLine",
  "(",
  "$",
  "response",
  ")",
  ";",
  "$",
  "this",
  "->",
  "sendHeaders",
  "(",
  "$",
  "response",
  ")",
  ";",
  "$",
  "this",
  "->",
  "sendBody",
  "(",
  "$",
  "response",
  ")",
  ";",
  "}"
]  | 
	{@inheritdoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/vaibhavpandeyvpz/sandesh/blob/bea2d06c7cac099ed82da973c922859de4158de0/src/ResponseSender.php#L25-L42 
 | 
					
	mothership-ec/composer 
 | 
	src/Composer/Downloader/SvnDownloader.php 
 | 
	SvnDownloader.doDownload 
 | 
	public function doDownload(PackageInterface $package, $path, $url)
    {
        SvnUtil::cleanEnv();
        $ref = $package->getSourceReference();
        $this->io->writeError("    Checking out ".$package->getSourceReference());
        $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
    } 
 | 
	php 
 | 
	public function doDownload(PackageInterface $package, $path, $url)
    {
        SvnUtil::cleanEnv();
        $ref = $package->getSourceReference();
        $this->io->writeError("    Checking out ".$package->getSourceReference());
        $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
    } 
 | 
	[
  "public",
  "function",
  "doDownload",
  "(",
  "PackageInterface",
  "$",
  "package",
  ",",
  "$",
  "path",
  ",",
  "$",
  "url",
  ")",
  "{",
  "SvnUtil",
  "::",
  "cleanEnv",
  "(",
  ")",
  ";",
  "$",
  "ref",
  "=",
  "$",
  "package",
  "->",
  "getSourceReference",
  "(",
  ")",
  ";",
  "$",
  "this",
  "->",
  "io",
  "->",
  "writeError",
  "(",
  "\"    Checking out \"",
  ".",
  "$",
  "package",
  "->",
  "getSourceReference",
  "(",
  ")",
  ")",
  ";",
  "$",
  "this",
  "->",
  "execute",
  "(",
  "$",
  "url",
  ",",
  "\"svn co\"",
  ",",
  "sprintf",
  "(",
  "\"%s/%s\"",
  ",",
  "$",
  "url",
  ",",
  "$",
  "ref",
  ")",
  ",",
  "null",
  ",",
  "$",
  "path",
  ")",
  ";",
  "}"
]  | 
	{@inheritDoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Downloader/SvnDownloader.php#L27-L34 
 | 
					
	mothership-ec/composer 
 | 
	src/Composer/Downloader/SvnDownloader.php 
 | 
	SvnDownloader.doUpdate 
 | 
	public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
    {
        SvnUtil::cleanEnv();
        $ref = $target->getSourceReference();
        if (!is_dir($path.'/.svn')) {
            throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
        }
        $flags = "";
        if (0 === $this->process->execute('svn --version', $output)) {
            if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match) && version_compare($match[1], '1.7.0', '>=')) {
                $flags .= ' --ignore-ancestry';
            }
        }
        $this->io->writeError("    Checking out " . $ref);
        $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
    } 
 | 
	php 
 | 
	public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
    {
        SvnUtil::cleanEnv();
        $ref = $target->getSourceReference();
        if (!is_dir($path.'/.svn')) {
            throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
        }
        $flags = "";
        if (0 === $this->process->execute('svn --version', $output)) {
            if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match) && version_compare($match[1], '1.7.0', '>=')) {
                $flags .= ' --ignore-ancestry';
            }
        }
        $this->io->writeError("    Checking out " . $ref);
        $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
    } 
 | 
	[
  "public",
  "function",
  "doUpdate",
  "(",
  "PackageInterface",
  "$",
  "initial",
  ",",
  "PackageInterface",
  "$",
  "target",
  ",",
  "$",
  "path",
  ",",
  "$",
  "url",
  ")",
  "{",
  "SvnUtil",
  "::",
  "cleanEnv",
  "(",
  ")",
  ";",
  "$",
  "ref",
  "=",
  "$",
  "target",
  "->",
  "getSourceReference",
  "(",
  ")",
  ";",
  "if",
  "(",
  "!",
  "is_dir",
  "(",
  "$",
  "path",
  ".",
  "'/.svn'",
  ")",
  ")",
  "{",
  "throw",
  "new",
  "\\",
  "RuntimeException",
  "(",
  "'The .svn directory is missing from '",
  ".",
  "$",
  "path",
  ".",
  "', see https://getcomposer.org/commit-deps for more information'",
  ")",
  ";",
  "}",
  "$",
  "flags",
  "=",
  "\"\"",
  ";",
  "if",
  "(",
  "0",
  "===",
  "$",
  "this",
  "->",
  "process",
  "->",
  "execute",
  "(",
  "'svn --version'",
  ",",
  "$",
  "output",
  ")",
  ")",
  "{",
  "if",
  "(",
  "preg_match",
  "(",
  "'{(\\d+(?:\\.\\d+)+)}'",
  ",",
  "$",
  "output",
  ",",
  "$",
  "match",
  ")",
  "&&",
  "version_compare",
  "(",
  "$",
  "match",
  "[",
  "1",
  "]",
  ",",
  "'1.7.0'",
  ",",
  "'>='",
  ")",
  ")",
  "{",
  "$",
  "flags",
  ".=",
  "' --ignore-ancestry'",
  ";",
  "}",
  "}",
  "$",
  "this",
  "->",
  "io",
  "->",
  "writeError",
  "(",
  "\"    Checking out \"",
  ".",
  "$",
  "ref",
  ")",
  ";",
  "$",
  "this",
  "->",
  "execute",
  "(",
  "$",
  "url",
  ",",
  "\"svn switch\"",
  ".",
  "$",
  "flags",
  ",",
  "sprintf",
  "(",
  "\"%s/%s\"",
  ",",
  "$",
  "url",
  ",",
  "$",
  "ref",
  ")",
  ",",
  "$",
  "path",
  ")",
  ";",
  "}"
]  | 
	{@inheritDoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Downloader/SvnDownloader.php#L39-L57 
 | 
					
	mothership-ec/composer 
 | 
	src/Composer/Downloader/SvnDownloader.php 
 | 
	SvnDownloader.cleanChanges 
 | 
	protected function cleanChanges(PackageInterface $package, $path, $update)
    {
        if (!$changes = $this->getLocalChanges($package, $path)) {
            return;
        }
        if (!$this->io->isInteractive()) {
            if (true === $this->config->get('discard-changes')) {
                return $this->discardChanges($path);
            }
            return parent::cleanChanges($package, $path, $update);
        }
        $changes = array_map(function ($elem) {
            return '    '.$elem;
        }, preg_split('{\s*\r?\n\s*}', $changes));
        $this->io->writeError('    <error>The package has modified files:</error>');
        $this->io->writeError(array_slice($changes, 0, 10));
        if (count($changes) > 10) {
            $this->io->writeError('    <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
        }
        while (true) {
            switch ($this->io->ask('    <info>Discard changes [y,n,v,?]?</info> ', '?')) {
                case 'y':
                    $this->discardChanges($path);
                    break 2;
                case 'n':
                    throw new \RuntimeException('Update aborted');
                case 'v':
                    $this->io->writeError($changes);
                    break;
                case '?':
                default:
                    $this->io->writeError(array(
                        '    y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
                        '    n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
                        '    v - view modified files',
                        '    ? - print help',
                    ));
                    break;
            }
        }
    } 
 | 
	php 
 | 
	protected function cleanChanges(PackageInterface $package, $path, $update)
    {
        if (!$changes = $this->getLocalChanges($package, $path)) {
            return;
        }
        if (!$this->io->isInteractive()) {
            if (true === $this->config->get('discard-changes')) {
                return $this->discardChanges($path);
            }
            return parent::cleanChanges($package, $path, $update);
        }
        $changes = array_map(function ($elem) {
            return '    '.$elem;
        }, preg_split('{\s*\r?\n\s*}', $changes));
        $this->io->writeError('    <error>The package has modified files:</error>');
        $this->io->writeError(array_slice($changes, 0, 10));
        if (count($changes) > 10) {
            $this->io->writeError('    <info>'.count($changes) - 10 . ' more files modified, choose "v" to view the full list</info>');
        }
        while (true) {
            switch ($this->io->ask('    <info>Discard changes [y,n,v,?]?</info> ', '?')) {
                case 'y':
                    $this->discardChanges($path);
                    break 2;
                case 'n':
                    throw new \RuntimeException('Update aborted');
                case 'v':
                    $this->io->writeError($changes);
                    break;
                case '?':
                default:
                    $this->io->writeError(array(
                        '    y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
                        '    n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
                        '    v - view modified files',
                        '    ? - print help',
                    ));
                    break;
            }
        }
    } 
 | 
	[
  "protected",
  "function",
  "cleanChanges",
  "(",
  "PackageInterface",
  "$",
  "package",
  ",",
  "$",
  "path",
  ",",
  "$",
  "update",
  ")",
  "{",
  "if",
  "(",
  "!",
  "$",
  "changes",
  "=",
  "$",
  "this",
  "->",
  "getLocalChanges",
  "(",
  "$",
  "package",
  ",",
  "$",
  "path",
  ")",
  ")",
  "{",
  "return",
  ";",
  "}",
  "if",
  "(",
  "!",
  "$",
  "this",
  "->",
  "io",
  "->",
  "isInteractive",
  "(",
  ")",
  ")",
  "{",
  "if",
  "(",
  "true",
  "===",
  "$",
  "this",
  "->",
  "config",
  "->",
  "get",
  "(",
  "'discard-changes'",
  ")",
  ")",
  "{",
  "return",
  "$",
  "this",
  "->",
  "discardChanges",
  "(",
  "$",
  "path",
  ")",
  ";",
  "}",
  "return",
  "parent",
  "::",
  "cleanChanges",
  "(",
  "$",
  "package",
  ",",
  "$",
  "path",
  ",",
  "$",
  "update",
  ")",
  ";",
  "}",
  "$",
  "changes",
  "=",
  "array_map",
  "(",
  "function",
  "(",
  "$",
  "elem",
  ")",
  "{",
  "return",
  "'    '",
  ".",
  "$",
  "elem",
  ";",
  "}",
  ",",
  "preg_split",
  "(",
  "'{\\s*\\r?\\n\\s*}'",
  ",",
  "$",
  "changes",
  ")",
  ")",
  ";",
  "$",
  "this",
  "->",
  "io",
  "->",
  "writeError",
  "(",
  "'    <error>The package has modified files:</error>'",
  ")",
  ";",
  "$",
  "this",
  "->",
  "io",
  "->",
  "writeError",
  "(",
  "array_slice",
  "(",
  "$",
  "changes",
  ",",
  "0",
  ",",
  "10",
  ")",
  ")",
  ";",
  "if",
  "(",
  "count",
  "(",
  "$",
  "changes",
  ")",
  ">",
  "10",
  ")",
  "{",
  "$",
  "this",
  "->",
  "io",
  "->",
  "writeError",
  "(",
  "'    <info>'",
  ".",
  "count",
  "(",
  "$",
  "changes",
  ")",
  "-",
  "10",
  ".",
  "' more files modified, choose \"v\" to view the full list</info>'",
  ")",
  ";",
  "}",
  "while",
  "(",
  "true",
  ")",
  "{",
  "switch",
  "(",
  "$",
  "this",
  "->",
  "io",
  "->",
  "ask",
  "(",
  "'    <info>Discard changes [y,n,v,?]?</info> '",
  ",",
  "'?'",
  ")",
  ")",
  "{",
  "case",
  "'y'",
  ":",
  "$",
  "this",
  "->",
  "discardChanges",
  "(",
  "$",
  "path",
  ")",
  ";",
  "break",
  "2",
  ";",
  "case",
  "'n'",
  ":",
  "throw",
  "new",
  "\\",
  "RuntimeException",
  "(",
  "'Update aborted'",
  ")",
  ";",
  "case",
  "'v'",
  ":",
  "$",
  "this",
  "->",
  "io",
  "->",
  "writeError",
  "(",
  "$",
  "changes",
  ")",
  ";",
  "break",
  ";",
  "case",
  "'?'",
  ":",
  "default",
  ":",
  "$",
  "this",
  "->",
  "io",
  "->",
  "writeError",
  "(",
  "array",
  "(",
  "'    y - discard changes and apply the '",
  ".",
  "(",
  "$",
  "update",
  "?",
  "'update'",
  ":",
  "'uninstall'",
  ")",
  ",",
  "'    n - abort the '",
  ".",
  "(",
  "$",
  "update",
  "?",
  "'update'",
  ":",
  "'uninstall'",
  ")",
  ".",
  "' and let you manually clean things up'",
  ",",
  "'    v - view modified files'",
  ",",
  "'    ? - print help'",
  ",",
  ")",
  ")",
  ";",
  "break",
  ";",
  "}",
  "}",
  "}"
]  | 
	{@inheritDoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Downloader/SvnDownloader.php#L100-L147 
 | 
					
	mothership-ec/composer 
 | 
	src/Composer/Downloader/SvnDownloader.php 
 | 
	SvnDownloader.getCommitLogs 
 | 
	protected function getCommitLogs($fromReference, $toReference, $path)
    {
        if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference) ) {
            // strip paths from references and only keep the actual revision
            $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
            $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
            $command = sprintf('svn log -r%s:%s --incremental', $fromRevision, $toRevision);
            if (0 !== $this->process->execute($command, $output, $path)) {
                throw new \RuntimeException(
                    'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
                );
            }
        } else {
            $output = "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
        }
        return $output;
    } 
 | 
	php 
 | 
	protected function getCommitLogs($fromReference, $toReference, $path)
    {
        if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference) ) {
            // strip paths from references and only keep the actual revision
            $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
            $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
            $command = sprintf('svn log -r%s:%s --incremental', $fromRevision, $toRevision);
            if (0 !== $this->process->execute($command, $output, $path)) {
                throw new \RuntimeException(
                    'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
                );
            }
        } else {
            $output = "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
        }
        return $output;
    } 
 | 
	[
  "protected",
  "function",
  "getCommitLogs",
  "(",
  "$",
  "fromReference",
  ",",
  "$",
  "toReference",
  ",",
  "$",
  "path",
  ")",
  "{",
  "if",
  "(",
  "preg_match",
  "(",
  "'{.*@(\\d+)$}'",
  ",",
  "$",
  "fromReference",
  ")",
  "&&",
  "preg_match",
  "(",
  "'{.*@(\\d+)$}'",
  ",",
  "$",
  "toReference",
  ")",
  ")",
  "{",
  "// strip paths from references and only keep the actual revision",
  "$",
  "fromRevision",
  "=",
  "preg_replace",
  "(",
  "'{.*@(\\d+)$}'",
  ",",
  "'$1'",
  ",",
  "$",
  "fromReference",
  ")",
  ";",
  "$",
  "toRevision",
  "=",
  "preg_replace",
  "(",
  "'{.*@(\\d+)$}'",
  ",",
  "'$1'",
  ",",
  "$",
  "toReference",
  ")",
  ";",
  "$",
  "command",
  "=",
  "sprintf",
  "(",
  "'svn log -r%s:%s --incremental'",
  ",",
  "$",
  "fromRevision",
  ",",
  "$",
  "toRevision",
  ")",
  ";",
  "if",
  "(",
  "0",
  "!==",
  "$",
  "this",
  "->",
  "process",
  "->",
  "execute",
  "(",
  "$",
  "command",
  ",",
  "$",
  "output",
  ",",
  "$",
  "path",
  ")",
  ")",
  "{",
  "throw",
  "new",
  "\\",
  "RuntimeException",
  "(",
  "'Failed to execute '",
  ".",
  "$",
  "command",
  ".",
  "\"\\n\\n\"",
  ".",
  "$",
  "this",
  "->",
  "process",
  "->",
  "getErrorOutput",
  "(",
  ")",
  ")",
  ";",
  "}",
  "}",
  "else",
  "{",
  "$",
  "output",
  "=",
  "\"Could not retrieve changes between $fromReference and $toReference due to missing revision information\"",
  ";",
  "}",
  "return",
  "$",
  "output",
  ";",
  "}"
]  | 
	{@inheritDoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Downloader/SvnDownloader.php#L152-L171 
 | 
					
	WellCommerce/AppBundle 
 | 
	Service/Admin/Provider/AdminMenuProvider.php 
 | 
	AdminMenuProvider.filterElements 
 | 
	protected function filterElements(Collection $collection, AdminMenu $parent = null)
    {
        $children = $collection->filter(function (AdminMenu $menuItem) use ($parent) {
            return $menuItem->getParent() === $parent;
        });
        
        return $children;
    } 
 | 
	php 
 | 
	protected function filterElements(Collection $collection, AdminMenu $parent = null)
    {
        $children = $collection->filter(function (AdminMenu $menuItem) use ($parent) {
            return $menuItem->getParent() === $parent;
        });
        
        return $children;
    } 
 | 
	[
  "protected",
  "function",
  "filterElements",
  "(",
  "Collection",
  "$",
  "collection",
  ",",
  "AdminMenu",
  "$",
  "parent",
  "=",
  "null",
  ")",
  "{",
  "$",
  "children",
  "=",
  "$",
  "collection",
  "->",
  "filter",
  "(",
  "function",
  "(",
  "AdminMenu",
  "$",
  "menuItem",
  ")",
  "use",
  "(",
  "$",
  "parent",
  ")",
  "{",
  "return",
  "$",
  "menuItem",
  "->",
  "getParent",
  "(",
  ")",
  "===",
  "$",
  "parent",
  ";",
  "}",
  ")",
  ";",
  "return",
  "$",
  "children",
  ";",
  "}"
]  | 
	Filters the collection and returns only children elements for given parent element
@param Collection     $collection
@param AdminMenu|null $parent
@return Collection 
 | 
	[
  "Filters",
  "the",
  "collection",
  "and",
  "returns",
  "only",
  "children",
  "elements",
  "for",
  "given",
  "parent",
  "element"
]  | 
	train 
 | 
	https://github.com/WellCommerce/AppBundle/blob/2add687d1c898dd0b24afd611d896e3811a0eac3/Service/Admin/Provider/AdminMenuProvider.php#L117-L124 
 | 
					
	SporkCode/Spork 
 | 
	src/View/Helper/CSS/AbstractHelper.php 
 | 
	AbstractHelper.compile 
 | 
	public function compile($template)
    {
        $file = $this->getResolver()->resolve($template);
        $css = $this->getCompiler()->compile($file);
        return "<style>$css</style>";
    } 
 | 
	php 
 | 
	public function compile($template)
    {
        $file = $this->getResolver()->resolve($template);
        $css = $this->getCompiler()->compile($file);
        return "<style>$css</style>";
    } 
 | 
	[
  "public",
  "function",
  "compile",
  "(",
  "$",
  "template",
  ")",
  "{",
  "$",
  "file",
  "=",
  "$",
  "this",
  "->",
  "getResolver",
  "(",
  ")",
  "->",
  "resolve",
  "(",
  "$",
  "template",
  ")",
  ";",
  "$",
  "css",
  "=",
  "$",
  "this",
  "->",
  "getCompiler",
  "(",
  ")",
  "->",
  "compile",
  "(",
  "$",
  "file",
  ")",
  ";",
  "return",
  "\"<style>$css</style>\"",
  ";",
  "}"
]  | 
	Compile template
@param string $template
@return string CSS 
 | 
	[
  "Compile",
  "template"
]  | 
	train 
 | 
	https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/CSS/AbstractHelper.php#L57-L62 
 | 
					
	SporkCode/Spork 
 | 
	src/View/Helper/CSS/AbstractHelper.php 
 | 
	AbstractHelper.getCompiler 
 | 
	public function getCompiler()
    {
        if (!$this->compiler instanceof AbstractCompiler) {
            if (null === $this->compiler) {
                throw new \Exception('Compiler not set');
            }
            $compiler = $this->getView()->getHelperPluginManager()->getServiceLocator()->get($this->compiler);
            if (!$compiler instanceof AbstractCompiler) {
                throw new \Exception(sprintf(
                    'Invalid compiler type: %s not instance of Spork\CSS\AbstractCompiler',
                    is_object($compiler) ? get_class($compiler) : gettype($compiler)));
            }
            $this->compiler = $compiler;
        }
        
        return $this->compiler;
    } 
 | 
	php 
 | 
	public function getCompiler()
    {
        if (!$this->compiler instanceof AbstractCompiler) {
            if (null === $this->compiler) {
                throw new \Exception('Compiler not set');
            }
            $compiler = $this->getView()->getHelperPluginManager()->getServiceLocator()->get($this->compiler);
            if (!$compiler instanceof AbstractCompiler) {
                throw new \Exception(sprintf(
                    'Invalid compiler type: %s not instance of Spork\CSS\AbstractCompiler',
                    is_object($compiler) ? get_class($compiler) : gettype($compiler)));
            }
            $this->compiler = $compiler;
        }
        
        return $this->compiler;
    } 
 | 
	[
  "public",
  "function",
  "getCompiler",
  "(",
  ")",
  "{",
  "if",
  "(",
  "!",
  "$",
  "this",
  "->",
  "compiler",
  "instanceof",
  "AbstractCompiler",
  ")",
  "{",
  "if",
  "(",
  "null",
  "===",
  "$",
  "this",
  "->",
  "compiler",
  ")",
  "{",
  "throw",
  "new",
  "\\",
  "Exception",
  "(",
  "'Compiler not set'",
  ")",
  ";",
  "}",
  "$",
  "compiler",
  "=",
  "$",
  "this",
  "->",
  "getView",
  "(",
  ")",
  "->",
  "getHelperPluginManager",
  "(",
  ")",
  "->",
  "getServiceLocator",
  "(",
  ")",
  "->",
  "get",
  "(",
  "$",
  "this",
  "->",
  "compiler",
  ")",
  ";",
  "if",
  "(",
  "!",
  "$",
  "compiler",
  "instanceof",
  "AbstractCompiler",
  ")",
  "{",
  "throw",
  "new",
  "\\",
  "Exception",
  "(",
  "sprintf",
  "(",
  "'Invalid compiler type: %s not instance of Spork\\CSS\\AbstractCompiler'",
  ",",
  "is_object",
  "(",
  "$",
  "compiler",
  ")",
  "?",
  "get_class",
  "(",
  "$",
  "compiler",
  ")",
  ":",
  "gettype",
  "(",
  "$",
  "compiler",
  ")",
  ")",
  ")",
  ";",
  "}",
  "$",
  "this",
  "->",
  "compiler",
  "=",
  "$",
  "compiler",
  ";",
  "}",
  "return",
  "$",
  "this",
  "->",
  "compiler",
  ";",
  "}"
]  | 
	Get compiler instance
@throws \Exception On compiler not set or invalid compiler type found
@return \Spork\CSS\AbstractCompiler 
 | 
	[
  "Get",
  "compiler",
  "instance"
]  | 
	train 
 | 
	https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/CSS/AbstractHelper.php#L70-L86 
 | 
					
	SporkCode/Spork 
 | 
	src/View/Helper/CSS/AbstractHelper.php 
 | 
	AbstractHelper.initializeResolver 
 | 
	protected function initializeResolver()
    {
        $extensions = $this->getCompiler()->getExtensions();
        $resolver = $this->resolver = new AggregateResolver();
    
        $stack = array($this->getView()->resolver());
        while ($source = array_shift($stack)) {
            if ($source instanceof AggregateResolver) {
                foreach ($source as $child) {
                    array_push($stack, $child);
                }
            } elseif ($source instanceof TemplatePathStack) {
                foreach ($extensions as $extension) {
                    $child = clone $source;
                    $child->setDefaultSuffix($extension);
                    $resolver->attach($child);
                }
            } else {
                $resolver->attach($source);
            }
        }
    } 
 | 
	php 
 | 
	protected function initializeResolver()
    {
        $extensions = $this->getCompiler()->getExtensions();
        $resolver = $this->resolver = new AggregateResolver();
    
        $stack = array($this->getView()->resolver());
        while ($source = array_shift($stack)) {
            if ($source instanceof AggregateResolver) {
                foreach ($source as $child) {
                    array_push($stack, $child);
                }
            } elseif ($source instanceof TemplatePathStack) {
                foreach ($extensions as $extension) {
                    $child = clone $source;
                    $child->setDefaultSuffix($extension);
                    $resolver->attach($child);
                }
            } else {
                $resolver->attach($source);
            }
        }
    } 
 | 
	[
  "protected",
  "function",
  "initializeResolver",
  "(",
  ")",
  "{",
  "$",
  "extensions",
  "=",
  "$",
  "this",
  "->",
  "getCompiler",
  "(",
  ")",
  "->",
  "getExtensions",
  "(",
  ")",
  ";",
  "$",
  "resolver",
  "=",
  "$",
  "this",
  "->",
  "resolver",
  "=",
  "new",
  "AggregateResolver",
  "(",
  ")",
  ";",
  "$",
  "stack",
  "=",
  "array",
  "(",
  "$",
  "this",
  "->",
  "getView",
  "(",
  ")",
  "->",
  "resolver",
  "(",
  ")",
  ")",
  ";",
  "while",
  "(",
  "$",
  "source",
  "=",
  "array_shift",
  "(",
  "$",
  "stack",
  ")",
  ")",
  "{",
  "if",
  "(",
  "$",
  "source",
  "instanceof",
  "AggregateResolver",
  ")",
  "{",
  "foreach",
  "(",
  "$",
  "source",
  "as",
  "$",
  "child",
  ")",
  "{",
  "array_push",
  "(",
  "$",
  "stack",
  ",",
  "$",
  "child",
  ")",
  ";",
  "}",
  "}",
  "elseif",
  "(",
  "$",
  "source",
  "instanceof",
  "TemplatePathStack",
  ")",
  "{",
  "foreach",
  "(",
  "$",
  "extensions",
  "as",
  "$",
  "extension",
  ")",
  "{",
  "$",
  "child",
  "=",
  "clone",
  "$",
  "source",
  ";",
  "$",
  "child",
  "->",
  "setDefaultSuffix",
  "(",
  "$",
  "extension",
  ")",
  ";",
  "$",
  "resolver",
  "->",
  "attach",
  "(",
  "$",
  "child",
  ")",
  ";",
  "}",
  "}",
  "else",
  "{",
  "$",
  "resolver",
  "->",
  "attach",
  "(",
  "$",
  "source",
  ")",
  ";",
  "}",
  "}",
  "}"
]  | 
	Initializes Resolver to find files by mimicking the default template
resolver and using compiler extensions. 
 | 
	[
  "Initializes",
  "Resolver",
  "to",
  "find",
  "files",
  "by",
  "mimicking",
  "the",
  "default",
  "template",
  "resolver",
  "and",
  "using",
  "compiler",
  "extensions",
  "."
]  | 
	train 
 | 
	https://github.com/SporkCode/Spork/blob/7f569efdc0ceb4a9c1c7a8b648b6a7ed50d2088a/src/View/Helper/CSS/AbstractHelper.php#L130-L151 
 | 
					
	svkurowski/yii2-shell 
 | 
	ShellController.php 
 | 
	ShellController.actionRun 
 | 
	public function actionRun()
    {
        $vars         = get_defined_vars();
        $vars['this'] = Yii::$app;
        $sh           = new \Psy\Shell();
        $sh->setScopeVariables($vars);
        $sh->run();
        return self::EXIT_CODE_NORMAL;
    } 
 | 
	php 
 | 
	public function actionRun()
    {
        $vars         = get_defined_vars();
        $vars['this'] = Yii::$app;
        $sh           = new \Psy\Shell();
        $sh->setScopeVariables($vars);
        $sh->run();
        return self::EXIT_CODE_NORMAL;
    } 
 | 
	[
  "public",
  "function",
  "actionRun",
  "(",
  ")",
  "{",
  "$",
  "vars",
  "=",
  "get_defined_vars",
  "(",
  ")",
  ";",
  "$",
  "vars",
  "[",
  "'this'",
  "]",
  "=",
  "Yii",
  "::",
  "$",
  "app",
  ";",
  "$",
  "sh",
  "=",
  "new",
  "\\",
  "Psy",
  "\\",
  "Shell",
  "(",
  ")",
  ";",
  "$",
  "sh",
  "->",
  "setScopeVariables",
  "(",
  "$",
  "vars",
  ")",
  ";",
  "$",
  "sh",
  "->",
  "run",
  "(",
  ")",
  ";",
  "return",
  "self",
  "::",
  "EXIT_CODE_NORMAL",
  ";",
  "}"
]  | 
	Starts the shell. 
 | 
	[
  "Starts",
  "the",
  "shell",
  "."
]  | 
	train 
 | 
	https://github.com/svkurowski/yii2-shell/blob/6e2f594b558fd3b4109ad1ad3c9c80dcdb8415e4/ShellController.php#L18-L27 
 | 
					
	Eresus/EresusCMS 
 | 
	src/core/plgmgr.php 
 | 
	TPlgMgr.toggle 
 | 
	private function toggle()
    {
        $q = Eresus_DB::getHandler()->createUpdateQuery();
        $e = $q->expr;
        $q->update('plugins')
            ->set('active', $e->not('active'))
            ->where(
                $e->eq('name', $q->bindValue(arg('toggle')))
            );
        $q->execute();
        HttpResponse::redirect(Eresus_Kernel::app()->getPage()->url());
    } 
 | 
	php 
 | 
	private function toggle()
    {
        $q = Eresus_DB::getHandler()->createUpdateQuery();
        $e = $q->expr;
        $q->update('plugins')
            ->set('active', $e->not('active'))
            ->where(
                $e->eq('name', $q->bindValue(arg('toggle')))
            );
        $q->execute();
        HttpResponse::redirect(Eresus_Kernel::app()->getPage()->url());
    } 
 | 
	[
  "private",
  "function",
  "toggle",
  "(",
  ")",
  "{",
  "$",
  "q",
  "=",
  "Eresus_DB",
  "::",
  "getHandler",
  "(",
  ")",
  "->",
  "createUpdateQuery",
  "(",
  ")",
  ";",
  "$",
  "e",
  "=",
  "$",
  "q",
  "->",
  "expr",
  ";",
  "$",
  "q",
  "->",
  "update",
  "(",
  "'plugins'",
  ")",
  "->",
  "set",
  "(",
  "'active'",
  ",",
  "$",
  "e",
  "->",
  "not",
  "(",
  "'active'",
  ")",
  ")",
  "->",
  "where",
  "(",
  "$",
  "e",
  "->",
  "eq",
  "(",
  "'name'",
  ",",
  "$",
  "q",
  "->",
  "bindValue",
  "(",
  "arg",
  "(",
  "'toggle'",
  ")",
  ")",
  ")",
  ")",
  ";",
  "$",
  "q",
  "->",
  "execute",
  "(",
  ")",
  ";",
  "HttpResponse",
  "::",
  "redirect",
  "(",
  "Eresus_Kernel",
  "::",
  "app",
  "(",
  ")",
  "->",
  "getPage",
  "(",
  ")",
  "->",
  "url",
  "(",
  ")",
  ")",
  ";",
  "}"
]  | 
	Включает или отключает плагин
@return void 
 | 
	[
  "Включает",
  "или",
  "отключает",
  "плагин"
]  | 
	train 
 | 
	https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/plgmgr.php#L47-L59 
 | 
					
	Eresus/EresusCMS 
 | 
	src/core/plgmgr.php 
 | 
	TPlgMgr.actionSettings 
 | 
	private function actionSettings($pluginName, Eresus_CMS_Request $request)
    {
        $plugin = Eresus_Plugin_Registry::getInstance()->load($pluginName);
        if (false === $plugin)
        {
            throw new Eresus_CMS_Exception_NotFound;
        }
        $provider = new Eresus_Admin_ContentProvider_Plugin($plugin);
        $controller = $provider->getSettingsController();
        if (false === $controller)
        {
            throw new Eresus_CMS_Exception_NotFound;
        }
        $html = $controller->getHtml($request);
        $request = Eresus_Kernel::app()->getLegacyKernel()->request;
        if ('POST' == $request['method'])
        {
            HTTP::redirect(arg('submitURL'));
        }
        return $html;
    } 
 | 
	php 
 | 
	private function actionSettings($pluginName, Eresus_CMS_Request $request)
    {
        $plugin = Eresus_Plugin_Registry::getInstance()->load($pluginName);
        if (false === $plugin)
        {
            throw new Eresus_CMS_Exception_NotFound;
        }
        $provider = new Eresus_Admin_ContentProvider_Plugin($plugin);
        $controller = $provider->getSettingsController();
        if (false === $controller)
        {
            throw new Eresus_CMS_Exception_NotFound;
        }
        $html = $controller->getHtml($request);
        $request = Eresus_Kernel::app()->getLegacyKernel()->request;
        if ('POST' == $request['method'])
        {
            HTTP::redirect(arg('submitURL'));
        }
        return $html;
    } 
 | 
	[
  "private",
  "function",
  "actionSettings",
  "(",
  "$",
  "pluginName",
  ",",
  "Eresus_CMS_Request",
  "$",
  "request",
  ")",
  "{",
  "$",
  "plugin",
  "=",
  "Eresus_Plugin_Registry",
  "::",
  "getInstance",
  "(",
  ")",
  "->",
  "load",
  "(",
  "$",
  "pluginName",
  ")",
  ";",
  "if",
  "(",
  "false",
  "===",
  "$",
  "plugin",
  ")",
  "{",
  "throw",
  "new",
  "Eresus_CMS_Exception_NotFound",
  ";",
  "}",
  "$",
  "provider",
  "=",
  "new",
  "Eresus_Admin_ContentProvider_Plugin",
  "(",
  "$",
  "plugin",
  ")",
  ";",
  "$",
  "controller",
  "=",
  "$",
  "provider",
  "->",
  "getSettingsController",
  "(",
  ")",
  ";",
  "if",
  "(",
  "false",
  "===",
  "$",
  "controller",
  ")",
  "{",
  "throw",
  "new",
  "Eresus_CMS_Exception_NotFound",
  ";",
  "}",
  "$",
  "html",
  "=",
  "$",
  "controller",
  "->",
  "getHtml",
  "(",
  "$",
  "request",
  ")",
  ";",
  "$",
  "request",
  "=",
  "Eresus_Kernel",
  "::",
  "app",
  "(",
  ")",
  "->",
  "getLegacyKernel",
  "(",
  ")",
  "->",
  "request",
  ";",
  "if",
  "(",
  "'POST'",
  "==",
  "$",
  "request",
  "[",
  "'method'",
  "]",
  ")",
  "{",
  "HTTP",
  "::",
  "redirect",
  "(",
  "arg",
  "(",
  "'submitURL'",
  ")",
  ")",
  ";",
  "}",
  "return",
  "$",
  "html",
  ";",
  "}"
]  | 
	Настройки модуля
@param string             $pluginName  имя модуля
@param Eresus_CMS_Request $request     запрос
@return mixed
@throws Eresus_CMS_Exception_NotFound 
 | 
	[
  "Настройки",
  "модуля"
]  | 
	train 
 | 
	https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/plgmgr.php#L79-L102 
 | 
					
	Eresus/EresusCMS 
 | 
	src/core/plgmgr.php 
 | 
	TPlgMgr.insert 
 | 
	private function insert()
    {
        Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '()');
        $plugins = Eresus_Plugin_Registry::getInstance();
        $files = arg('files');
        if ($files && is_array($files))
        {
            foreach ($files as $plugin => $install)
            {
                if ($install)
                {
                    try
                    {
                        $plugins->install($plugin);
                    }
                    catch (DomainException $e)
                    {
                        Eresus_Kernel::app()->getPage()->addErrorMessage($e->getMessage());
                    }
                }
            }
        }
        HttpResponse::redirect('admin.php?mod=plgmgr');
    } 
 | 
	php 
 | 
	private function insert()
    {
        Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '()');
        $plugins = Eresus_Plugin_Registry::getInstance();
        $files = arg('files');
        if ($files && is_array($files))
        {
            foreach ($files as $plugin => $install)
            {
                if ($install)
                {
                    try
                    {
                        $plugins->install($plugin);
                    }
                    catch (DomainException $e)
                    {
                        Eresus_Kernel::app()->getPage()->addErrorMessage($e->getMessage());
                    }
                }
            }
        }
        HttpResponse::redirect('admin.php?mod=plgmgr');
    } 
 | 
	[
  "private",
  "function",
  "insert",
  "(",
  ")",
  "{",
  "Eresus_Kernel",
  "::",
  "log",
  "(",
  "__METHOD__",
  ",",
  "LOG_DEBUG",
  ",",
  "'()'",
  ")",
  ";",
  "$",
  "plugins",
  "=",
  "Eresus_Plugin_Registry",
  "::",
  "getInstance",
  "(",
  ")",
  ";",
  "$",
  "files",
  "=",
  "arg",
  "(",
  "'files'",
  ")",
  ";",
  "if",
  "(",
  "$",
  "files",
  "&&",
  "is_array",
  "(",
  "$",
  "files",
  ")",
  ")",
  "{",
  "foreach",
  "(",
  "$",
  "files",
  "as",
  "$",
  "plugin",
  "=>",
  "$",
  "install",
  ")",
  "{",
  "if",
  "(",
  "$",
  "install",
  ")",
  "{",
  "try",
  "{",
  "$",
  "plugins",
  "->",
  "install",
  "(",
  "$",
  "plugin",
  ")",
  ";",
  "}",
  "catch",
  "(",
  "DomainException",
  "$",
  "e",
  ")",
  "{",
  "Eresus_Kernel",
  "::",
  "app",
  "(",
  ")",
  "->",
  "getPage",
  "(",
  ")",
  "->",
  "addErrorMessage",
  "(",
  "$",
  "e",
  "->",
  "getMessage",
  "(",
  ")",
  ")",
  ";",
  "}",
  "}",
  "}",
  "}",
  "HttpResponse",
  "::",
  "redirect",
  "(",
  "'admin.php?mod=plgmgr'",
  ")",
  ";",
  "}"
]  | 
	Подключает плагины
@return void
@see add() 
 | 
	[
  "Подключает",
  "плагины"
]  | 
	train 
 | 
	https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/plgmgr.php#L110-L135 
 | 
					
	Eresus/EresusCMS 
 | 
	src/core/plgmgr.php 
 | 
	TPlgMgr.add 
 | 
	private function add()
    {
        $data = array();
        /* Составляем список доступных плагинов */
        $files = glob(Eresus_CMS::getLegacyKernel()->froot . 'ext/*.php');
        if (false === $files)
        {
            $files = array();
        }
        /* Составляем список установленных плагинов */
        $items = Eresus_CMS::getLegacyKernel()->db->select('plugins', '', 'name, version');
        $installed = array();
        foreach ($items as $item)
        {
            $installed []= Eresus_CMS::getLegacyKernel()->froot . 'ext/' . $item['name'] . '.php';
        }
        // Оставляем только неустановленные
        $files = array_diff($files, $installed);
        /*
         * Собираем информацию о неустановленных плагинах
         */
        $data['plugins'] = array();
        if (count($files))
        {
            // Удаляем из версии CMS все буквы, чтобы сравнивать только цифры
            $kernelVersion = preg_replace('/[^\d\.]/', '', Eresus_Kernel::app()->version);
            foreach ($files as $file)
            {
                $errors = array();
                try
                {
                    $info = Eresus_PluginInfo::loadFromFile($file);
                    $required = $info->getRequiredKernel();
                    if (
                        version_compare($kernelVersion, $required[0], '<')/* ||
						version_compare($kernelVersion, $required[1], '>')*/
                    )
                    {
                        $msg =  I18n::getInstance()->getText('admPluginsInvalidVersion', $this);
                        $errors []= sprintf($msg, /*implode(' - ', */$required[0]/*)*/);
                    }
                }
                catch (RuntimeException $e)
                {
                    $errors []= $e->getMessage();
                    $info = new Plugin(); // TODO: Придумать решение без Plugin
                    $info->title = $info->name = basename($file, '.php');
                    $info->version = '';
                }
                $available[$info->name] = $info->version;
                $data['plugins'][$info->title] = array('info' => $info, 'errors' => $errors);
            }
        }
        $plugins = Eresus_Plugin_Registry::getInstance();
        foreach ($data['plugins'] as &$item)
        {
            if ($item['info'] instanceof Eresus_PluginInfo)
            {
                $required = $item['info']->getRequiredPlugins();
                foreach ($required as $plugin)
                {
                    list ($name, $minVer, $maxVer) = $plugin;
                    if (
                        !isset($plugins->items[$name]) ||
                        ($minVer && version_compare($plugins->items[$name]->version, $minVer, '<')) ||
                        ($maxVer && version_compare($plugins->items[$name]->version, $maxVer, '>'))
                    )
                    {
                        {
                            $msg = I18n::getInstance()->getText('Requires plugin: %s', $this);
                            $item['errors'] []= sprintf($msg, $name . ' ' . $minVer . '-' . $maxVer);
                        }
                    }
                }
            }
        }
        ksort($data['plugins']);
        /* @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $tmpl = $page->getUITheme()->getTemplate('PluginManager/add-dialog.html');
        $html = $tmpl->compile($data);
        return $html;
    } 
 | 
	php 
 | 
	private function add()
    {
        $data = array();
        /* Составляем список доступных плагинов */
        $files = glob(Eresus_CMS::getLegacyKernel()->froot . 'ext/*.php');
        if (false === $files)
        {
            $files = array();
        }
        /* Составляем список установленных плагинов */
        $items = Eresus_CMS::getLegacyKernel()->db->select('plugins', '', 'name, version');
        $installed = array();
        foreach ($items as $item)
        {
            $installed []= Eresus_CMS::getLegacyKernel()->froot . 'ext/' . $item['name'] . '.php';
        }
        // Оставляем только неустановленные
        $files = array_diff($files, $installed);
        /*
         * Собираем информацию о неустановленных плагинах
         */
        $data['plugins'] = array();
        if (count($files))
        {
            // Удаляем из версии CMS все буквы, чтобы сравнивать только цифры
            $kernelVersion = preg_replace('/[^\d\.]/', '', Eresus_Kernel::app()->version);
            foreach ($files as $file)
            {
                $errors = array();
                try
                {
                    $info = Eresus_PluginInfo::loadFromFile($file);
                    $required = $info->getRequiredKernel();
                    if (
                        version_compare($kernelVersion, $required[0], '<')/* ||
						version_compare($kernelVersion, $required[1], '>')*/
                    )
                    {
                        $msg =  I18n::getInstance()->getText('admPluginsInvalidVersion', $this);
                        $errors []= sprintf($msg, /*implode(' - ', */$required[0]/*)*/);
                    }
                }
                catch (RuntimeException $e)
                {
                    $errors []= $e->getMessage();
                    $info = new Plugin(); // TODO: Придумать решение без Plugin
                    $info->title = $info->name = basename($file, '.php');
                    $info->version = '';
                }
                $available[$info->name] = $info->version;
                $data['plugins'][$info->title] = array('info' => $info, 'errors' => $errors);
            }
        }
        $plugins = Eresus_Plugin_Registry::getInstance();
        foreach ($data['plugins'] as &$item)
        {
            if ($item['info'] instanceof Eresus_PluginInfo)
            {
                $required = $item['info']->getRequiredPlugins();
                foreach ($required as $plugin)
                {
                    list ($name, $minVer, $maxVer) = $plugin;
                    if (
                        !isset($plugins->items[$name]) ||
                        ($minVer && version_compare($plugins->items[$name]->version, $minVer, '<')) ||
                        ($maxVer && version_compare($plugins->items[$name]->version, $maxVer, '>'))
                    )
                    {
                        {
                            $msg = I18n::getInstance()->getText('Requires plugin: %s', $this);
                            $item['errors'] []= sprintf($msg, $name . ' ' . $minVer . '-' . $maxVer);
                        }
                    }
                }
            }
        }
        ksort($data['plugins']);
        /* @var TAdminUI $page */
        $page = Eresus_Kernel::app()->getPage();
        $tmpl = $page->getUITheme()->getTemplate('PluginManager/add-dialog.html');
        $html = $tmpl->compile($data);
        return $html;
    } 
 | 
	[
  "private",
  "function",
  "add",
  "(",
  ")",
  "{",
  "$",
  "data",
  "=",
  "array",
  "(",
  ")",
  ";",
  "/* Составляем список доступных плагинов */",
  "$",
  "files",
  "=",
  "glob",
  "(",
  "Eresus_CMS",
  "::",
  "getLegacyKernel",
  "(",
  ")",
  "->",
  "froot",
  ".",
  "'ext/*.php'",
  ")",
  ";",
  "if",
  "(",
  "false",
  "===",
  "$",
  "files",
  ")",
  "{",
  "$",
  "files",
  "=",
  "array",
  "(",
  ")",
  ";",
  "}",
  "/* Составляем список установленных плагинов */",
  "$",
  "items",
  "=",
  "Eresus_CMS",
  "::",
  "getLegacyKernel",
  "(",
  ")",
  "->",
  "db",
  "->",
  "select",
  "(",
  "'plugins'",
  ",",
  "''",
  ",",
  "'name, version'",
  ")",
  ";",
  "$",
  "installed",
  "=",
  "array",
  "(",
  ")",
  ";",
  "foreach",
  "(",
  "$",
  "items",
  "as",
  "$",
  "item",
  ")",
  "{",
  "$",
  "installed",
  "[",
  "]",
  "=",
  "Eresus_CMS",
  "::",
  "getLegacyKernel",
  "(",
  ")",
  "->",
  "froot",
  ".",
  "'ext/'",
  ".",
  "$",
  "item",
  "[",
  "'name'",
  "]",
  ".",
  "'.php'",
  ";",
  "}",
  "// Оставляем только неустановленные",
  "$",
  "files",
  "=",
  "array_diff",
  "(",
  "$",
  "files",
  ",",
  "$",
  "installed",
  ")",
  ";",
  "/*\n         * Собираем информацию о неустановленных плагинах\n         */",
  "$",
  "data",
  "[",
  "'plugins'",
  "]",
  "=",
  "array",
  "(",
  ")",
  ";",
  "if",
  "(",
  "count",
  "(",
  "$",
  "files",
  ")",
  ")",
  "{",
  "// Удаляем из версии CMS все буквы, чтобы сравнивать только цифры",
  "$",
  "kernelVersion",
  "=",
  "preg_replace",
  "(",
  "'/[^\\d\\.]/'",
  ",",
  "''",
  ",",
  "Eresus_Kernel",
  "::",
  "app",
  "(",
  ")",
  "->",
  "version",
  ")",
  ";",
  "foreach",
  "(",
  "$",
  "files",
  "as",
  "$",
  "file",
  ")",
  "{",
  "$",
  "errors",
  "=",
  "array",
  "(",
  ")",
  ";",
  "try",
  "{",
  "$",
  "info",
  "=",
  "Eresus_PluginInfo",
  "::",
  "loadFromFile",
  "(",
  "$",
  "file",
  ")",
  ";",
  "$",
  "required",
  "=",
  "$",
  "info",
  "->",
  "getRequiredKernel",
  "(",
  ")",
  ";",
  "if",
  "(",
  "version_compare",
  "(",
  "$",
  "kernelVersion",
  ",",
  "$",
  "required",
  "[",
  "0",
  "]",
  ",",
  "'<'",
  ")",
  "/* ||\n\t\t\t\t\t\tversion_compare($kernelVersion, $required[1], '>')*/",
  ")",
  "{",
  "$",
  "msg",
  "=",
  "I18n",
  "::",
  "getInstance",
  "(",
  ")",
  "->",
  "getText",
  "(",
  "'admPluginsInvalidVersion'",
  ",",
  "$",
  "this",
  ")",
  ";",
  "$",
  "errors",
  "[",
  "]",
  "=",
  "sprintf",
  "(",
  "$",
  "msg",
  ",",
  "/*implode(' - ', */",
  "$",
  "required",
  "[",
  "0",
  "]",
  "/*)*/",
  ")",
  ";",
  "}",
  "}",
  "catch",
  "(",
  "RuntimeException",
  "$",
  "e",
  ")",
  "{",
  "$",
  "errors",
  "[",
  "]",
  "=",
  "$",
  "e",
  "->",
  "getMessage",
  "(",
  ")",
  ";",
  "$",
  "info",
  "=",
  "new",
  "Plugin",
  "(",
  ")",
  ";",
  "// TODO: Придумать решение без Plugin",
  "$",
  "info",
  "->",
  "title",
  "=",
  "$",
  "info",
  "->",
  "name",
  "=",
  "basename",
  "(",
  "$",
  "file",
  ",",
  "'.php'",
  ")",
  ";",
  "$",
  "info",
  "->",
  "version",
  "=",
  "''",
  ";",
  "}",
  "$",
  "available",
  "[",
  "$",
  "info",
  "->",
  "name",
  "]",
  "=",
  "$",
  "info",
  "->",
  "version",
  ";",
  "$",
  "data",
  "[",
  "'plugins'",
  "]",
  "[",
  "$",
  "info",
  "->",
  "title",
  "]",
  "=",
  "array",
  "(",
  "'info'",
  "=>",
  "$",
  "info",
  ",",
  "'errors'",
  "=>",
  "$",
  "errors",
  ")",
  ";",
  "}",
  "}",
  "$",
  "plugins",
  "=",
  "Eresus_Plugin_Registry",
  "::",
  "getInstance",
  "(",
  ")",
  ";",
  "foreach",
  "(",
  "$",
  "data",
  "[",
  "'plugins'",
  "]",
  "as",
  "&",
  "$",
  "item",
  ")",
  "{",
  "if",
  "(",
  "$",
  "item",
  "[",
  "'info'",
  "]",
  "instanceof",
  "Eresus_PluginInfo",
  ")",
  "{",
  "$",
  "required",
  "=",
  "$",
  "item",
  "[",
  "'info'",
  "]",
  "->",
  "getRequiredPlugins",
  "(",
  ")",
  ";",
  "foreach",
  "(",
  "$",
  "required",
  "as",
  "$",
  "plugin",
  ")",
  "{",
  "list",
  "(",
  "$",
  "name",
  ",",
  "$",
  "minVer",
  ",",
  "$",
  "maxVer",
  ")",
  "=",
  "$",
  "plugin",
  ";",
  "if",
  "(",
  "!",
  "isset",
  "(",
  "$",
  "plugins",
  "->",
  "items",
  "[",
  "$",
  "name",
  "]",
  ")",
  "||",
  "(",
  "$",
  "minVer",
  "&&",
  "version_compare",
  "(",
  "$",
  "plugins",
  "->",
  "items",
  "[",
  "$",
  "name",
  "]",
  "->",
  "version",
  ",",
  "$",
  "minVer",
  ",",
  "'<'",
  ")",
  ")",
  "||",
  "(",
  "$",
  "maxVer",
  "&&",
  "version_compare",
  "(",
  "$",
  "plugins",
  "->",
  "items",
  "[",
  "$",
  "name",
  "]",
  "->",
  "version",
  ",",
  "$",
  "maxVer",
  ",",
  "'>'",
  ")",
  ")",
  ")",
  "{",
  "{",
  "$",
  "msg",
  "=",
  "I18n",
  "::",
  "getInstance",
  "(",
  ")",
  "->",
  "getText",
  "(",
  "'Requires plugin: %s'",
  ",",
  "$",
  "this",
  ")",
  ";",
  "$",
  "item",
  "[",
  "'errors'",
  "]",
  "[",
  "]",
  "=",
  "sprintf",
  "(",
  "$",
  "msg",
  ",",
  "$",
  "name",
  ".",
  "' '",
  ".",
  "$",
  "minVer",
  ".",
  "'-'",
  ".",
  "$",
  "maxVer",
  ")",
  ";",
  "}",
  "}",
  "}",
  "}",
  "}",
  "ksort",
  "(",
  "$",
  "data",
  "[",
  "'plugins'",
  "]",
  ")",
  ";",
  "/* @var TAdminUI $page */",
  "$",
  "page",
  "=",
  "Eresus_Kernel",
  "::",
  "app",
  "(",
  ")",
  "->",
  "getPage",
  "(",
  ")",
  ";",
  "$",
  "tmpl",
  "=",
  "$",
  "page",
  "->",
  "getUITheme",
  "(",
  ")",
  "->",
  "getTemplate",
  "(",
  "'PluginManager/add-dialog.html'",
  ")",
  ";",
  "$",
  "html",
  "=",
  "$",
  "tmpl",
  "->",
  "compile",
  "(",
  "$",
  "data",
  ")",
  ";",
  "return",
  "$",
  "html",
  ";",
  "}"
]  | 
	Возвращает диалог добавления плагина
@return string  HTML 
 | 
	[
  "Возвращает",
  "диалог",
  "добавления",
  "плагина"
]  | 
	train 
 | 
	https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/plgmgr.php#L142-L233 
 | 
					
	Eresus/EresusCMS 
 | 
	src/core/plgmgr.php 
 | 
	TPlgMgr.adminRender 
 | 
	public function adminRender(Eresus_CMS_Request $request)
    {
        if (!UserRights($this->access))
        {
            Eresus_Kernel::log(__METHOD__, LOG_WARNING, 'Access denied for user "%s"',
                Eresus_CMS::getLegacyKernel()->user['name']);
            return '';
        }
        Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '()');
        $result = '';
        Eresus_Kernel::app()->getPage()->title = admPlugins;
        switch (true)
        {
            case arg('update') !== null:
                $result = $this->actionSettings(arg('update'), $request);
                break;
            case arg('toggle') !== null:
                $this->toggle();
                break;
            case arg('delete') !== null:
                $this->delete();
                break;
            case arg('id') !== null:
                $result = $this->actionSettings(arg('id'), $request);
                break;
            case arg('action') == 'add':
                $result = $this->add();
                break;
            case arg('action') == 'insert':
                $this->insert();
                break;
            default:
                $table = array (
                    'name' => 'plugins',
                    'key' => 'name',
                    'sortMode' => 'title',
                    'columns' => array(
                        array('name' => 'title', 'caption' => admPlugin, 'width' => '90px', 'wrap'=>false),
                        array('name' => 'description', 'caption' => admDescription),
                        array('name' => 'version', 'caption' => admVersion, 'width'=>'70px','align'=>'center'),
                    ),
                    'controls' => array (
                        'delete' => '',
                        'edit' => 'checkHasSettings',
                        'toggle' => '',
                    ),
                    'tabs' => array(
                        'width'=>'180px',
                        'items'=>array(
                            array('caption'=>admPluginsAdd, 'name'=>'action', 'value'=>'add')
                        )
                    )
                );
                /** @var TAdminUI $page */
                $page = Eresus_Kernel::app()->getPage();
                $result = $page->renderTable($table);
                break;
        }
        return $result;
    } 
 | 
	php 
 | 
	public function adminRender(Eresus_CMS_Request $request)
    {
        if (!UserRights($this->access))
        {
            Eresus_Kernel::log(__METHOD__, LOG_WARNING, 'Access denied for user "%s"',
                Eresus_CMS::getLegacyKernel()->user['name']);
            return '';
        }
        Eresus_Kernel::log(__METHOD__, LOG_DEBUG, '()');
        $result = '';
        Eresus_Kernel::app()->getPage()->title = admPlugins;
        switch (true)
        {
            case arg('update') !== null:
                $result = $this->actionSettings(arg('update'), $request);
                break;
            case arg('toggle') !== null:
                $this->toggle();
                break;
            case arg('delete') !== null:
                $this->delete();
                break;
            case arg('id') !== null:
                $result = $this->actionSettings(arg('id'), $request);
                break;
            case arg('action') == 'add':
                $result = $this->add();
                break;
            case arg('action') == 'insert':
                $this->insert();
                break;
            default:
                $table = array (
                    'name' => 'plugins',
                    'key' => 'name',
                    'sortMode' => 'title',
                    'columns' => array(
                        array('name' => 'title', 'caption' => admPlugin, 'width' => '90px', 'wrap'=>false),
                        array('name' => 'description', 'caption' => admDescription),
                        array('name' => 'version', 'caption' => admVersion, 'width'=>'70px','align'=>'center'),
                    ),
                    'controls' => array (
                        'delete' => '',
                        'edit' => 'checkHasSettings',
                        'toggle' => '',
                    ),
                    'tabs' => array(
                        'width'=>'180px',
                        'items'=>array(
                            array('caption'=>admPluginsAdd, 'name'=>'action', 'value'=>'add')
                        )
                    )
                );
                /** @var TAdminUI $page */
                $page = Eresus_Kernel::app()->getPage();
                $result = $page->renderTable($table);
                break;
        }
        return $result;
    } 
 | 
	[
  "public",
  "function",
  "adminRender",
  "(",
  "Eresus_CMS_Request",
  "$",
  "request",
  ")",
  "{",
  "if",
  "(",
  "!",
  "UserRights",
  "(",
  "$",
  "this",
  "->",
  "access",
  ")",
  ")",
  "{",
  "Eresus_Kernel",
  "::",
  "log",
  "(",
  "__METHOD__",
  ",",
  "LOG_WARNING",
  ",",
  "'Access denied for user \"%s\"'",
  ",",
  "Eresus_CMS",
  "::",
  "getLegacyKernel",
  "(",
  ")",
  "->",
  "user",
  "[",
  "'name'",
  "]",
  ")",
  ";",
  "return",
  "''",
  ";",
  "}",
  "Eresus_Kernel",
  "::",
  "log",
  "(",
  "__METHOD__",
  ",",
  "LOG_DEBUG",
  ",",
  "'()'",
  ")",
  ";",
  "$",
  "result",
  "=",
  "''",
  ";",
  "Eresus_Kernel",
  "::",
  "app",
  "(",
  ")",
  "->",
  "getPage",
  "(",
  ")",
  "->",
  "title",
  "=",
  "admPlugins",
  ";",
  "switch",
  "(",
  "true",
  ")",
  "{",
  "case",
  "arg",
  "(",
  "'update'",
  ")",
  "!==",
  "null",
  ":",
  "$",
  "result",
  "=",
  "$",
  "this",
  "->",
  "actionSettings",
  "(",
  "arg",
  "(",
  "'update'",
  ")",
  ",",
  "$",
  "request",
  ")",
  ";",
  "break",
  ";",
  "case",
  "arg",
  "(",
  "'toggle'",
  ")",
  "!==",
  "null",
  ":",
  "$",
  "this",
  "->",
  "toggle",
  "(",
  ")",
  ";",
  "break",
  ";",
  "case",
  "arg",
  "(",
  "'delete'",
  ")",
  "!==",
  "null",
  ":",
  "$",
  "this",
  "->",
  "delete",
  "(",
  ")",
  ";",
  "break",
  ";",
  "case",
  "arg",
  "(",
  "'id'",
  ")",
  "!==",
  "null",
  ":",
  "$",
  "result",
  "=",
  "$",
  "this",
  "->",
  "actionSettings",
  "(",
  "arg",
  "(",
  "'id'",
  ")",
  ",",
  "$",
  "request",
  ")",
  ";",
  "break",
  ";",
  "case",
  "arg",
  "(",
  "'action'",
  ")",
  "==",
  "'add'",
  ":",
  "$",
  "result",
  "=",
  "$",
  "this",
  "->",
  "add",
  "(",
  ")",
  ";",
  "break",
  ";",
  "case",
  "arg",
  "(",
  "'action'",
  ")",
  "==",
  "'insert'",
  ":",
  "$",
  "this",
  "->",
  "insert",
  "(",
  ")",
  ";",
  "break",
  ";",
  "default",
  ":",
  "$",
  "table",
  "=",
  "array",
  "(",
  "'name'",
  "=>",
  "'plugins'",
  ",",
  "'key'",
  "=>",
  "'name'",
  ",",
  "'sortMode'",
  "=>",
  "'title'",
  ",",
  "'columns'",
  "=>",
  "array",
  "(",
  "array",
  "(",
  "'name'",
  "=>",
  "'title'",
  ",",
  "'caption'",
  "=>",
  "admPlugin",
  ",",
  "'width'",
  "=>",
  "'90px'",
  ",",
  "'wrap'",
  "=>",
  "false",
  ")",
  ",",
  "array",
  "(",
  "'name'",
  "=>",
  "'description'",
  ",",
  "'caption'",
  "=>",
  "admDescription",
  ")",
  ",",
  "array",
  "(",
  "'name'",
  "=>",
  "'version'",
  ",",
  "'caption'",
  "=>",
  "admVersion",
  ",",
  "'width'",
  "=>",
  "'70px'",
  ",",
  "'align'",
  "=>",
  "'center'",
  ")",
  ",",
  ")",
  ",",
  "'controls'",
  "=>",
  "array",
  "(",
  "'delete'",
  "=>",
  "''",
  ",",
  "'edit'",
  "=>",
  "'checkHasSettings'",
  ",",
  "'toggle'",
  "=>",
  "''",
  ",",
  ")",
  ",",
  "'tabs'",
  "=>",
  "array",
  "(",
  "'width'",
  "=>",
  "'180px'",
  ",",
  "'items'",
  "=>",
  "array",
  "(",
  "array",
  "(",
  "'caption'",
  "=>",
  "admPluginsAdd",
  ",",
  "'name'",
  "=>",
  "'action'",
  ",",
  "'value'",
  "=>",
  "'add'",
  ")",
  ")",
  ")",
  ")",
  ";",
  "/** @var TAdminUI $page */",
  "$",
  "page",
  "=",
  "Eresus_Kernel",
  "::",
  "app",
  "(",
  ")",
  "->",
  "getPage",
  "(",
  ")",
  ";",
  "$",
  "result",
  "=",
  "$",
  "page",
  "->",
  "renderTable",
  "(",
  "$",
  "table",
  ")",
  ";",
  "break",
  ";",
  "}",
  "return",
  "$",
  "result",
  ";",
  "}"
]  | 
	Отрисовка контента модуля
@param Eresus_CMS_Request $request
@return string 
 | 
	[
  "Отрисовка",
  "контента",
  "модуля"
]  | 
	train 
 | 
	https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/plgmgr.php#L242-L304 
 | 
					
	Eresus/EresusCMS 
 | 
	src/core/plgmgr.php 
 | 
	TPlgMgr.checkHasSettings 
 | 
	public function checkHasSettings($item)
    {
        $plugin = Eresus_Plugin_Registry::getInstance()->load($item['name']);
        if (false === $plugin)
        {
            return false;
        }
        $provider = new Eresus_Admin_ContentProvider_Plugin($plugin);
        return false !== $provider->getSettingsController();
    } 
 | 
	php 
 | 
	public function checkHasSettings($item)
    {
        $plugin = Eresus_Plugin_Registry::getInstance()->load($item['name']);
        if (false === $plugin)
        {
            return false;
        }
        $provider = new Eresus_Admin_ContentProvider_Plugin($plugin);
        return false !== $provider->getSettingsController();
    } 
 | 
	[
  "public",
  "function",
  "checkHasSettings",
  "(",
  "$",
  "item",
  ")",
  "{",
  "$",
  "plugin",
  "=",
  "Eresus_Plugin_Registry",
  "::",
  "getInstance",
  "(",
  ")",
  "->",
  "load",
  "(",
  "$",
  "item",
  "[",
  "'name'",
  "]",
  ")",
  ";",
  "if",
  "(",
  "false",
  "===",
  "$",
  "plugin",
  ")",
  "{",
  "return",
  "false",
  ";",
  "}",
  "$",
  "provider",
  "=",
  "new",
  "Eresus_Admin_ContentProvider_Plugin",
  "(",
  "$",
  "plugin",
  ")",
  ";",
  "return",
  "false",
  "!==",
  "$",
  "provider",
  "->",
  "getSettingsController",
  "(",
  ")",
  ";",
  "}"
]  | 
	Проверяет, есть ли у модуля настройки
@param array $item
@return bool 
 | 
	[
  "Проверяет",
  "есть",
  "ли",
  "у",
  "модуля",
  "настройки"
]  | 
	train 
 | 
	https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/plgmgr.php#L311-L320 
 | 
					
	odiaseo/pagebuilder 
 | 
	src/PageBuilder/Model/ModelDependencyTrait.php 
 | 
	ModelDependencyTrait.setDependency 
 | 
	protected function setDependency(ContainerInterface $serviceLocator, AbstractModel $model, $entity)
    {
        /** @var EntityManager $entityManager */
        $cacheStatus   = $serviceLocator->get('synergy\cache\status');
        $entityManager = $serviceLocator->get('doctrine.entitymanager.' . $model->getOrm());
        $config        = $serviceLocator->get('config');
        $site          = null;
        $filterName    = 'super_sites';
        if ($serviceLocator->has(AuthenticationService::class)) {
            /** @var AuthenticationService $authService */
            $authService = $serviceLocator->get(AuthenticationService::class);
            $identity    = $authService->hasIdentity();
            $model->setIdentity($authService->getIdentity());
        } else {
            $identity = false;
        }
        if (is_string($entity)) {
            $model->setEntity($entity);
        } elseif ($model instanceof BaseModel) {
            $model->setEntityInstance($entity);
            $model->setEntity(get_class($entity));
        }
        /** @var Site $site */
        if (!$model instanceof SiteModel) {
            $site = $serviceLocator->get('active\site');
            if ($site and in_array($site->getId(), $config['super_sites']) and
                $entityManager->getFilters()->has($filterName) and
                $entityManager->getFilters()->isEnabled($filterName)
            ) {
                $entityManager->getFilters()->disable($filterName);
            }
        }
        if ($site and $model instanceof LocaleAwareInterface) {
            if ($locale = $site->getLocale()) {
                $model->setLocale($locale);
            }
        }
        if ($model instanceof CacheAwareInterface) {
            $model->setCache('system\cache');
        }
        $enabled       = (!$identity and $cacheStatus->enabled);
        $cachedManager = new CachedEntityManager($entityManager, $enabled);
        $model->setEnableResultCache($enabled);
        $model->setLogger($serviceLocator->get('logger'));
        $model->setEntityManager($cachedManager);
        $model->setServiceLocator($serviceLocator);
        return $model;
    } 
 | 
	php 
 | 
	protected function setDependency(ContainerInterface $serviceLocator, AbstractModel $model, $entity)
    {
        /** @var EntityManager $entityManager */
        $cacheStatus   = $serviceLocator->get('synergy\cache\status');
        $entityManager = $serviceLocator->get('doctrine.entitymanager.' . $model->getOrm());
        $config        = $serviceLocator->get('config');
        $site          = null;
        $filterName    = 'super_sites';
        if ($serviceLocator->has(AuthenticationService::class)) {
            /** @var AuthenticationService $authService */
            $authService = $serviceLocator->get(AuthenticationService::class);
            $identity    = $authService->hasIdentity();
            $model->setIdentity($authService->getIdentity());
        } else {
            $identity = false;
        }
        if (is_string($entity)) {
            $model->setEntity($entity);
        } elseif ($model instanceof BaseModel) {
            $model->setEntityInstance($entity);
            $model->setEntity(get_class($entity));
        }
        /** @var Site $site */
        if (!$model instanceof SiteModel) {
            $site = $serviceLocator->get('active\site');
            if ($site and in_array($site->getId(), $config['super_sites']) and
                $entityManager->getFilters()->has($filterName) and
                $entityManager->getFilters()->isEnabled($filterName)
            ) {
                $entityManager->getFilters()->disable($filterName);
            }
        }
        if ($site and $model instanceof LocaleAwareInterface) {
            if ($locale = $site->getLocale()) {
                $model->setLocale($locale);
            }
        }
        if ($model instanceof CacheAwareInterface) {
            $model->setCache('system\cache');
        }
        $enabled       = (!$identity and $cacheStatus->enabled);
        $cachedManager = new CachedEntityManager($entityManager, $enabled);
        $model->setEnableResultCache($enabled);
        $model->setLogger($serviceLocator->get('logger'));
        $model->setEntityManager($cachedManager);
        $model->setServiceLocator($serviceLocator);
        return $model;
    } 
 | 
	[
  "protected",
  "function",
  "setDependency",
  "(",
  "ContainerInterface",
  "$",
  "serviceLocator",
  ",",
  "AbstractModel",
  "$",
  "model",
  ",",
  "$",
  "entity",
  ")",
  "{",
  "/** @var EntityManager $entityManager */",
  "$",
  "cacheStatus",
  "=",
  "$",
  "serviceLocator",
  "->",
  "get",
  "(",
  "'synergy\\cache\\status'",
  ")",
  ";",
  "$",
  "entityManager",
  "=",
  "$",
  "serviceLocator",
  "->",
  "get",
  "(",
  "'doctrine.entitymanager.'",
  ".",
  "$",
  "model",
  "->",
  "getOrm",
  "(",
  ")",
  ")",
  ";",
  "$",
  "config",
  "=",
  "$",
  "serviceLocator",
  "->",
  "get",
  "(",
  "'config'",
  ")",
  ";",
  "$",
  "site",
  "=",
  "null",
  ";",
  "$",
  "filterName",
  "=",
  "'super_sites'",
  ";",
  "if",
  "(",
  "$",
  "serviceLocator",
  "->",
  "has",
  "(",
  "AuthenticationService",
  "::",
  "class",
  ")",
  ")",
  "{",
  "/** @var AuthenticationService $authService */",
  "$",
  "authService",
  "=",
  "$",
  "serviceLocator",
  "->",
  "get",
  "(",
  "AuthenticationService",
  "::",
  "class",
  ")",
  ";",
  "$",
  "identity",
  "=",
  "$",
  "authService",
  "->",
  "hasIdentity",
  "(",
  ")",
  ";",
  "$",
  "model",
  "->",
  "setIdentity",
  "(",
  "$",
  "authService",
  "->",
  "getIdentity",
  "(",
  ")",
  ")",
  ";",
  "}",
  "else",
  "{",
  "$",
  "identity",
  "=",
  "false",
  ";",
  "}",
  "if",
  "(",
  "is_string",
  "(",
  "$",
  "entity",
  ")",
  ")",
  "{",
  "$",
  "model",
  "->",
  "setEntity",
  "(",
  "$",
  "entity",
  ")",
  ";",
  "}",
  "elseif",
  "(",
  "$",
  "model",
  "instanceof",
  "BaseModel",
  ")",
  "{",
  "$",
  "model",
  "->",
  "setEntityInstance",
  "(",
  "$",
  "entity",
  ")",
  ";",
  "$",
  "model",
  "->",
  "setEntity",
  "(",
  "get_class",
  "(",
  "$",
  "entity",
  ")",
  ")",
  ";",
  "}",
  "/** @var Site $site */",
  "if",
  "(",
  "!",
  "$",
  "model",
  "instanceof",
  "SiteModel",
  ")",
  "{",
  "$",
  "site",
  "=",
  "$",
  "serviceLocator",
  "->",
  "get",
  "(",
  "'active\\site'",
  ")",
  ";",
  "if",
  "(",
  "$",
  "site",
  "and",
  "in_array",
  "(",
  "$",
  "site",
  "->",
  "getId",
  "(",
  ")",
  ",",
  "$",
  "config",
  "[",
  "'super_sites'",
  "]",
  ")",
  "and",
  "$",
  "entityManager",
  "->",
  "getFilters",
  "(",
  ")",
  "->",
  "has",
  "(",
  "$",
  "filterName",
  ")",
  "and",
  "$",
  "entityManager",
  "->",
  "getFilters",
  "(",
  ")",
  "->",
  "isEnabled",
  "(",
  "$",
  "filterName",
  ")",
  ")",
  "{",
  "$",
  "entityManager",
  "->",
  "getFilters",
  "(",
  ")",
  "->",
  "disable",
  "(",
  "$",
  "filterName",
  ")",
  ";",
  "}",
  "}",
  "if",
  "(",
  "$",
  "site",
  "and",
  "$",
  "model",
  "instanceof",
  "LocaleAwareInterface",
  ")",
  "{",
  "if",
  "(",
  "$",
  "locale",
  "=",
  "$",
  "site",
  "->",
  "getLocale",
  "(",
  ")",
  ")",
  "{",
  "$",
  "model",
  "->",
  "setLocale",
  "(",
  "$",
  "locale",
  ")",
  ";",
  "}",
  "}",
  "if",
  "(",
  "$",
  "model",
  "instanceof",
  "CacheAwareInterface",
  ")",
  "{",
  "$",
  "model",
  "->",
  "setCache",
  "(",
  "'system\\cache'",
  ")",
  ";",
  "}",
  "$",
  "enabled",
  "=",
  "(",
  "!",
  "$",
  "identity",
  "and",
  "$",
  "cacheStatus",
  "->",
  "enabled",
  ")",
  ";",
  "$",
  "cachedManager",
  "=",
  "new",
  "CachedEntityManager",
  "(",
  "$",
  "entityManager",
  ",",
  "$",
  "enabled",
  ")",
  ";",
  "$",
  "model",
  "->",
  "setEnableResultCache",
  "(",
  "$",
  "enabled",
  ")",
  ";",
  "$",
  "model",
  "->",
  "setLogger",
  "(",
  "$",
  "serviceLocator",
  "->",
  "get",
  "(",
  "'logger'",
  ")",
  ")",
  ";",
  "$",
  "model",
  "->",
  "setEntityManager",
  "(",
  "$",
  "cachedManager",
  ")",
  ";",
  "$",
  "model",
  "->",
  "setServiceLocator",
  "(",
  "$",
  "serviceLocator",
  ")",
  ";",
  "return",
  "$",
  "model",
  ";",
  "}"
]  | 
	@param ContainerInterface $serviceLocator
@param AbstractModel $model
@param                         $entity
@return BaseModel 
 | 
	[
  "@param",
  "ContainerInterface",
  "$serviceLocator",
  "@param",
  "AbstractModel",
  "$model",
  "@param",
  "$entity"
]  | 
	train 
 | 
	https://github.com/odiaseo/pagebuilder/blob/88ef7cccf305368561307efe4ca07fac8e5774f3/src/PageBuilder/Model/ModelDependencyTrait.php#L23-L78 
 | 
					
	dotkernel/dot-rbac-guard 
 | 
	src/Provider/ArrayGuardsProvider.php 
 | 
	ArrayGuardsProvider.getGuards 
 | 
	public function getGuards(): array
    {
        if ($this->guards) {
            return $this->guards;
        }
        if (empty($this->guardsConfig)) {
            return [];
        }
        $this->guards = [];
        foreach ($this->guardsConfig as $guardConfig) {
            $this->guards[] = $this->getGuardFactory()->create($guardConfig);
        }
        $this->sortGuardsByPriority();
        return $this->guards;
    } 
 | 
	php 
 | 
	public function getGuards(): array
    {
        if ($this->guards) {
            return $this->guards;
        }
        if (empty($this->guardsConfig)) {
            return [];
        }
        $this->guards = [];
        foreach ($this->guardsConfig as $guardConfig) {
            $this->guards[] = $this->getGuardFactory()->create($guardConfig);
        }
        $this->sortGuardsByPriority();
        return $this->guards;
    } 
 | 
	[
  "public",
  "function",
  "getGuards",
  "(",
  ")",
  ":",
  "array",
  "{",
  "if",
  "(",
  "$",
  "this",
  "->",
  "guards",
  ")",
  "{",
  "return",
  "$",
  "this",
  "->",
  "guards",
  ";",
  "}",
  "if",
  "(",
  "empty",
  "(",
  "$",
  "this",
  "->",
  "guardsConfig",
  ")",
  ")",
  "{",
  "return",
  "[",
  "]",
  ";",
  "}",
  "$",
  "this",
  "->",
  "guards",
  "=",
  "[",
  "]",
  ";",
  "foreach",
  "(",
  "$",
  "this",
  "->",
  "guardsConfig",
  "as",
  "$",
  "guardConfig",
  ")",
  "{",
  "$",
  "this",
  "->",
  "guards",
  "[",
  "]",
  "=",
  "$",
  "this",
  "->",
  "getGuardFactory",
  "(",
  ")",
  "->",
  "create",
  "(",
  "$",
  "guardConfig",
  ")",
  ";",
  "}",
  "$",
  "this",
  "->",
  "sortGuardsByPriority",
  "(",
  ")",
  ";",
  "return",
  "$",
  "this",
  "->",
  "guards",
  ";",
  "}"
]  | 
	Gets the  cached guard list or creates it from the config
@return GuardInterface[] 
 | 
	[
  "Gets",
  "the",
  "cached",
  "guard",
  "list",
  "or",
  "creates",
  "it",
  "from",
  "the",
  "config"
]  | 
	train 
 | 
	https://github.com/dotkernel/dot-rbac-guard/blob/4ecaafe2bfcf1d2a66ae582d6d7af4830ec51653/src/Provider/ArrayGuardsProvider.php#L44-L61 
 | 
					
	dotkernel/dot-rbac-guard 
 | 
	src/Provider/ArrayGuardsProvider.php 
 | 
	ArrayGuardsProvider.sortGuardsByPriority 
 | 
	protected function sortGuardsByPriority()
    {
        usort($this->guards, function (GuardInterface $a, GuardInterface $b) {
            return $b->getPriority() - $a->getPriority();
        });
    } 
 | 
	php 
 | 
	protected function sortGuardsByPriority()
    {
        usort($this->guards, function (GuardInterface $a, GuardInterface $b) {
            return $b->getPriority() - $a->getPriority();
        });
    } 
 | 
	[
  "protected",
  "function",
  "sortGuardsByPriority",
  "(",
  ")",
  "{",
  "usort",
  "(",
  "$",
  "this",
  "->",
  "guards",
  ",",
  "function",
  "(",
  "GuardInterface",
  "$",
  "a",
  ",",
  "GuardInterface",
  "$",
  "b",
  ")",
  "{",
  "return",
  "$",
  "b",
  "->",
  "getPriority",
  "(",
  ")",
  "-",
  "$",
  "a",
  "->",
  "getPriority",
  "(",
  ")",
  ";",
  "}",
  ")",
  ";",
  "}"
]  | 
	Sort the guards list internally
@return void 
 | 
	[
  "Sort",
  "the",
  "guards",
  "list",
  "internally"
]  | 
	train 
 | 
	https://github.com/dotkernel/dot-rbac-guard/blob/4ecaafe2bfcf1d2a66ae582d6d7af4830ec51653/src/Provider/ArrayGuardsProvider.php#L68-L73 
 | 
					
	EmanuelNikolov/IgdbApiBundle 
 | 
	Igdb/Parameter/Factory/ParameterCollectionFactory.php 
 | 
	ParameterCollectionFactory.createCollection 
 | 
	public function createCollection(string $className): AbstractParameterCollection
    {
        if (!class_exists($className)) {
            throw new \InvalidArgumentException("Could not load group {$className}: class doesn't exist.");
        }
        if (!is_subclass_of($className, AbstractParameterCollection::class)) {
            throw new \InvalidArgumentException("Could not load group {$className}: class doesn't extend App\Service\Igdb\Utils\AbstractParameterGroup.");
        }
        return new $className($this->builder);
    } 
 | 
	php 
 | 
	public function createCollection(string $className): AbstractParameterCollection
    {
        if (!class_exists($className)) {
            throw new \InvalidArgumentException("Could not load group {$className}: class doesn't exist.");
        }
        if (!is_subclass_of($className, AbstractParameterCollection::class)) {
            throw new \InvalidArgumentException("Could not load group {$className}: class doesn't extend App\Service\Igdb\Utils\AbstractParameterGroup.");
        }
        return new $className($this->builder);
    } 
 | 
	[
  "public",
  "function",
  "createCollection",
  "(",
  "string",
  "$",
  "className",
  ")",
  ":",
  "AbstractParameterCollection",
  "{",
  "if",
  "(",
  "!",
  "class_exists",
  "(",
  "$",
  "className",
  ")",
  ")",
  "{",
  "throw",
  "new",
  "\\",
  "InvalidArgumentException",
  "(",
  "\"Could not load group {$className}: class doesn't exist.\"",
  ")",
  ";",
  "}",
  "if",
  "(",
  "!",
  "is_subclass_of",
  "(",
  "$",
  "className",
  ",",
  "AbstractParameterCollection",
  "::",
  "class",
  ")",
  ")",
  "{",
  "throw",
  "new",
  "\\",
  "InvalidArgumentException",
  "(",
  "\"Could not load group {$className}: class doesn't extend App\\Service\\Igdb\\Utils\\AbstractParameterGroup.\"",
  ")",
  ";",
  "}",
  "return",
  "new",
  "$",
  "className",
  "(",
  "$",
  "this",
  "->",
  "builder",
  ")",
  ";",
  "}"
]  | 
	{@inheritdoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/EmanuelNikolov/IgdbApiBundle/blob/eedfc80298064a424990ebc5924649afdeaa00c8/Igdb/Parameter/Factory/ParameterCollectionFactory.php#L36-L47 
 | 
					
	heidelpay/PhpDoc 
 | 
	src/phpDocumentor/Plugin/Twig/Extension.php 
 | 
	Extension.getFilters 
 | 
	public function getFilters()
    {
        $parser = \Parsedown::instance();
        $translator = $this->translator;
        $routeRenderer = $this->routeRenderer;
        return array(
            'markdown' => new \Twig_SimpleFilter(
                'markdown',
                function ($value) use ($parser) {
                    return $parser->text($value);
                }
            ),
            'trans' => new \Twig_SimpleFilter(
                'trans',
                function ($value, $context) use ($translator) {
                    if (!$context) {
                        $context = array();
                    }
                    return vsprintf($translator->translate($value), $context);
                }
            ),
            'route' => new \Twig_SimpleFilter(
                'route',
                function ($value, $presentation = 'normal') use ($routeRenderer) {
                    return $routeRenderer->render($value, $presentation);
                }
            ),
            'sort' => new \Twig_SimpleFilter(
                'sort_*',
                function ($direction, $collection) {
                    if (!$collection instanceof Collection) {
                        return $collection;
                    }
                    $iterator = $collection->getIterator();
                    $iterator->uasort(
                        function ($a, $b) use ($direction) {
                            $aElem = strtolower($a->getName());
                            $bElem = strtolower($b->getName());
                            if ($aElem === $bElem) {
                                return 0;
                            }
                            if ($direction === 'asc' && $aElem > $bElem || $direction === 'desc' && $aElem < $bElem) {
                                return 1;
                            }
                            return -1;
                        }
                    );
                    return $iterator;
                }
            ),
        );
    } 
 | 
	php 
 | 
	public function getFilters()
    {
        $parser = \Parsedown::instance();
        $translator = $this->translator;
        $routeRenderer = $this->routeRenderer;
        return array(
            'markdown' => new \Twig_SimpleFilter(
                'markdown',
                function ($value) use ($parser) {
                    return $parser->text($value);
                }
            ),
            'trans' => new \Twig_SimpleFilter(
                'trans',
                function ($value, $context) use ($translator) {
                    if (!$context) {
                        $context = array();
                    }
                    return vsprintf($translator->translate($value), $context);
                }
            ),
            'route' => new \Twig_SimpleFilter(
                'route',
                function ($value, $presentation = 'normal') use ($routeRenderer) {
                    return $routeRenderer->render($value, $presentation);
                }
            ),
            'sort' => new \Twig_SimpleFilter(
                'sort_*',
                function ($direction, $collection) {
                    if (!$collection instanceof Collection) {
                        return $collection;
                    }
                    $iterator = $collection->getIterator();
                    $iterator->uasort(
                        function ($a, $b) use ($direction) {
                            $aElem = strtolower($a->getName());
                            $bElem = strtolower($b->getName());
                            if ($aElem === $bElem) {
                                return 0;
                            }
                            if ($direction === 'asc' && $aElem > $bElem || $direction === 'desc' && $aElem < $bElem) {
                                return 1;
                            }
                            return -1;
                        }
                    );
                    return $iterator;
                }
            ),
        );
    } 
 | 
	[
  "public",
  "function",
  "getFilters",
  "(",
  ")",
  "{",
  "$",
  "parser",
  "=",
  "\\",
  "Parsedown",
  "::",
  "instance",
  "(",
  ")",
  ";",
  "$",
  "translator",
  "=",
  "$",
  "this",
  "->",
  "translator",
  ";",
  "$",
  "routeRenderer",
  "=",
  "$",
  "this",
  "->",
  "routeRenderer",
  ";",
  "return",
  "array",
  "(",
  "'markdown'",
  "=>",
  "new",
  "\\",
  "Twig_SimpleFilter",
  "(",
  "'markdown'",
  ",",
  "function",
  "(",
  "$",
  "value",
  ")",
  "use",
  "(",
  "$",
  "parser",
  ")",
  "{",
  "return",
  "$",
  "parser",
  "->",
  "text",
  "(",
  "$",
  "value",
  ")",
  ";",
  "}",
  ")",
  ",",
  "'trans'",
  "=>",
  "new",
  "\\",
  "Twig_SimpleFilter",
  "(",
  "'trans'",
  ",",
  "function",
  "(",
  "$",
  "value",
  ",",
  "$",
  "context",
  ")",
  "use",
  "(",
  "$",
  "translator",
  ")",
  "{",
  "if",
  "(",
  "!",
  "$",
  "context",
  ")",
  "{",
  "$",
  "context",
  "=",
  "array",
  "(",
  ")",
  ";",
  "}",
  "return",
  "vsprintf",
  "(",
  "$",
  "translator",
  "->",
  "translate",
  "(",
  "$",
  "value",
  ")",
  ",",
  "$",
  "context",
  ")",
  ";",
  "}",
  ")",
  ",",
  "'route'",
  "=>",
  "new",
  "\\",
  "Twig_SimpleFilter",
  "(",
  "'route'",
  ",",
  "function",
  "(",
  "$",
  "value",
  ",",
  "$",
  "presentation",
  "=",
  "'normal'",
  ")",
  "use",
  "(",
  "$",
  "routeRenderer",
  ")",
  "{",
  "return",
  "$",
  "routeRenderer",
  "->",
  "render",
  "(",
  "$",
  "value",
  ",",
  "$",
  "presentation",
  ")",
  ";",
  "}",
  ")",
  ",",
  "'sort'",
  "=>",
  "new",
  "\\",
  "Twig_SimpleFilter",
  "(",
  "'sort_*'",
  ",",
  "function",
  "(",
  "$",
  "direction",
  ",",
  "$",
  "collection",
  ")",
  "{",
  "if",
  "(",
  "!",
  "$",
  "collection",
  "instanceof",
  "Collection",
  ")",
  "{",
  "return",
  "$",
  "collection",
  ";",
  "}",
  "$",
  "iterator",
  "=",
  "$",
  "collection",
  "->",
  "getIterator",
  "(",
  ")",
  ";",
  "$",
  "iterator",
  "->",
  "uasort",
  "(",
  "function",
  "(",
  "$",
  "a",
  ",",
  "$",
  "b",
  ")",
  "use",
  "(",
  "$",
  "direction",
  ")",
  "{",
  "$",
  "aElem",
  "=",
  "strtolower",
  "(",
  "$",
  "a",
  "->",
  "getName",
  "(",
  ")",
  ")",
  ";",
  "$",
  "bElem",
  "=",
  "strtolower",
  "(",
  "$",
  "b",
  "->",
  "getName",
  "(",
  ")",
  ")",
  ";",
  "if",
  "(",
  "$",
  "aElem",
  "===",
  "$",
  "bElem",
  ")",
  "{",
  "return",
  "0",
  ";",
  "}",
  "if",
  "(",
  "$",
  "direction",
  "===",
  "'asc'",
  "&&",
  "$",
  "aElem",
  ">",
  "$",
  "bElem",
  "||",
  "$",
  "direction",
  "===",
  "'desc'",
  "&&",
  "$",
  "aElem",
  "<",
  "$",
  "bElem",
  ")",
  "{",
  "return",
  "1",
  ";",
  "}",
  "return",
  "-",
  "1",
  ";",
  "}",
  ")",
  ";",
  "return",
  "$",
  "iterator",
  ";",
  "}",
  ")",
  ",",
  ")",
  ";",
  "}"
]  | 
	Returns a list of all filters that are exposed by this extension.
@return \Twig_SimpleFilter[] 
 | 
	[
  "Returns",
  "a",
  "list",
  "of",
  "all",
  "filters",
  "that",
  "are",
  "exposed",
  "by",
  "this",
  "extension",
  "."
]  | 
	train 
 | 
	https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Twig/Extension.php#L166-L222 
 | 
					
	seagoj/devtools 
 | 
	Response.php 
 | 
	Response.load 
 | 
	public function load($sql, $params = null)
    {
        if (is_null($this->repository)) {
            throw new \Exception('No repository available.');
        }
        $data = $this->repository->query($sql, $params, true);
        return $this->data = is_array($data) ? $data : array('data' => $data);
    } 
 | 
	php 
 | 
	public function load($sql, $params = null)
    {
        if (is_null($this->repository)) {
            throw new \Exception('No repository available.');
        }
        $data = $this->repository->query($sql, $params, true);
        return $this->data = is_array($data) ? $data : array('data' => $data);
    } 
 | 
	[
  "public",
  "function",
  "load",
  "(",
  "$",
  "sql",
  ",",
  "$",
  "params",
  "=",
  "null",
  ")",
  "{",
  "if",
  "(",
  "is_null",
  "(",
  "$",
  "this",
  "->",
  "repository",
  ")",
  ")",
  "{",
  "throw",
  "new",
  "\\",
  "Exception",
  "(",
  "'No repository available.'",
  ")",
  ";",
  "}",
  "$",
  "data",
  "=",
  "$",
  "this",
  "->",
  "repository",
  "->",
  "query",
  "(",
  "$",
  "sql",
  ",",
  "$",
  "params",
  ",",
  "true",
  ")",
  ";",
  "return",
  "$",
  "this",
  "->",
  "data",
  "=",
  "is_array",
  "(",
  "$",
  "data",
  ")",
  "?",
  "$",
  "data",
  ":",
  "array",
  "(",
  "'data'",
  "=>",
  "$",
  "data",
  ")",
  ";",
  "}"
]  | 
	/* DEPRECATED 
 | 
	[
  "/",
  "*",
  "DEPRECATED"
]  | 
	train 
 | 
	https://github.com/seagoj/devtools/blob/15dd451a0b00c272d3e1961f114342d5e0f526ba/Response.php#L168-L176 
 | 
					
	seagoj/devtools 
 | 
	Response.php 
 | 
	Response.data 
 | 
	public function data(array $data)
    {
       if (empty($data)) {
           trigger_error(var_export(debug_backtrace(), true));
       }
       foreach ($data as $key => $value) {
           $this->$key = $value;
       }
       return $this;
    } 
 | 
	php 
 | 
	public function data(array $data)
    {
       if (empty($data)) {
           trigger_error(var_export(debug_backtrace(), true));
       }
       foreach ($data as $key => $value) {
           $this->$key = $value;
       }
       return $this;
    } 
 | 
	[
  "public",
  "function",
  "data",
  "(",
  "array",
  "$",
  "data",
  ")",
  "{",
  "if",
  "(",
  "empty",
  "(",
  "$",
  "data",
  ")",
  ")",
  "{",
  "trigger_error",
  "(",
  "var_export",
  "(",
  "debug_backtrace",
  "(",
  ")",
  ",",
  "true",
  ")",
  ")",
  ";",
  "}",
  "foreach",
  "(",
  "$",
  "data",
  "as",
  "$",
  "key",
  "=>",
  "$",
  "value",
  ")",
  "{",
  "$",
  "this",
  "->",
  "$",
  "key",
  "=",
  "$",
  "value",
  ";",
  "}",
  "return",
  "$",
  "this",
  ";",
  "}"
]  | 
	=====INTERFACES===== 
 | 
	[
  "=====",
  "INTERFACES",
  "====="
]  | 
	train 
 | 
	https://github.com/seagoj/devtools/blob/15dd451a0b00c272d3e1961f114342d5e0f526ba/Response.php#L190-L199 
 | 
					
	alevilar/ristorantino-vendor 
 | 
	Risto/Model/TenantBaseSchema.php 
 | 
	TenantBaseSchema.__getExtraDefaultValues 
 | 
	private function __getExtraDefaultValues ( $tableName ) {
		$values = $this->__extraDefaultValues;
		if ( $values && $tableName && array_key_exists( $tableName, $values )) {
			return $values[$tableName];
		} else {
			return false;
		}
	} 
 | 
	php 
 | 
	private function __getExtraDefaultValues ( $tableName ) {
		$values = $this->__extraDefaultValues;
		if ( $values && $tableName && array_key_exists( $tableName, $values )) {
			return $values[$tableName];
		} else {
			return false;
		}
	} 
 | 
	[
  "private",
  "function",
  "__getExtraDefaultValues",
  "(",
  "$",
  "tableName",
  ")",
  "{",
  "$",
  "values",
  "=",
  "$",
  "this",
  "->",
  "__extraDefaultValues",
  ";",
  "if",
  "(",
  "$",
  "values",
  "&&",
  "$",
  "tableName",
  "&&",
  "array_key_exists",
  "(",
  "$",
  "tableName",
  ",",
  "$",
  "values",
  ")",
  ")",
  "{",
  "return",
  "$",
  "values",
  "[",
  "$",
  "tableName",
  "]",
  ";",
  "}",
  "else",
  "{",
  "return",
  "false",
  ";",
  "}",
  "}"
]  | 
	*
Devuelve los valores al ejecutar "SCHEMA CREATE"
@param string $tablename Nombre de la tabla
@return array listado de valores a insertar en la tabla para hacer el saveAll 
 | 
	[
  "*"
]  | 
	train 
 | 
	https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Risto/Model/TenantBaseSchema.php#L1335-L1343 
 | 
					
	DesignPond/newsletter 
 | 
	src/Http/Controllers/Backend/CampagneController.php 
 | 
	CampagneController.show 
 | 
	public function show($id)
    {
        $campagne = $this->campagne->find($id);
        $blocs    = $this->type->getAll();
        return view('newsletter::Backend.campagne.show')->with(['campagne' => $campagne, 'blocs' => $blocs]);
    } 
 | 
	php 
 | 
	public function show($id)
    {
        $campagne = $this->campagne->find($id);
        $blocs    = $this->type->getAll();
        return view('newsletter::Backend.campagne.show')->with(['campagne' => $campagne, 'blocs' => $blocs]);
    } 
 | 
	[
  "public",
  "function",
  "show",
  "(",
  "$",
  "id",
  ")",
  "{",
  "$",
  "campagne",
  "=",
  "$",
  "this",
  "->",
  "campagne",
  "->",
  "find",
  "(",
  "$",
  "id",
  ")",
  ";",
  "$",
  "blocs",
  "=",
  "$",
  "this",
  "->",
  "type",
  "->",
  "getAll",
  "(",
  ")",
  ";",
  "return",
  "view",
  "(",
  "'newsletter::Backend.campagne.show'",
  ")",
  "->",
  "with",
  "(",
  "[",
  "'campagne'",
  "=>",
  "$",
  "campagne",
  ",",
  "'blocs'",
  "=>",
  "$",
  "blocs",
  "]",
  ")",
  ";",
  "}"
]  | 
	Display the specified resource.
@param  int  $id
@return \Illuminate\Http\Response 
 | 
	[
  "Display",
  "the",
  "specified",
  "resource",
  "."
]  | 
	train 
 | 
	https://github.com/DesignPond/newsletter/blob/0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3/src/Http/Controllers/Backend/CampagneController.php#L52-L58 
 | 
					
	DesignPond/newsletter 
 | 
	src/Http/Controllers/Backend/CampagneController.php 
 | 
	CampagneController.preview 
 | 
	public function preview($id)
    {
        $campagne = $this->campagne->find($id);
        $data     = $this->mailjet->getHtml($campagne->api_campagne_id);
        return response($data);
    } 
 | 
	php 
 | 
	public function preview($id)
    {
        $campagne = $this->campagne->find($id);
        $data     = $this->mailjet->getHtml($campagne->api_campagne_id);
        return response($data);
    } 
 | 
	[
  "public",
  "function",
  "preview",
  "(",
  "$",
  "id",
  ")",
  "{",
  "$",
  "campagne",
  "=",
  "$",
  "this",
  "->",
  "campagne",
  "->",
  "find",
  "(",
  "$",
  "id",
  ")",
  ";",
  "$",
  "data",
  "=",
  "$",
  "this",
  "->",
  "mailjet",
  "->",
  "getHtml",
  "(",
  "$",
  "campagne",
  "->",
  "api_campagne_id",
  ")",
  ";",
  "return",
  "response",
  "(",
  "$",
  "data",
  ")",
  ";",
  "}"
]  | 
	Preview
@param  int  $id
@return \Illuminate\Http\Response 
 | 
	[
  "Preview"
]  | 
	train 
 | 
	https://github.com/DesignPond/newsletter/blob/0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3/src/Http/Controllers/Backend/CampagneController.php#L66-L72 
 | 
					
	DesignPond/newsletter 
 | 
	src/Http/Controllers/Backend/CampagneController.php 
 | 
	CampagneController.cancel 
 | 
	public function cancel($id)
    {
        $campagne = $this->campagne->find($id);
        $this->mailjet->deleteCampagne($campagne->api_campagne_id);
        // Update campagne status
        $this->campagne->update(['id' => $campagne->id, 'status' => 'brouillon', 'updated_at' => date('Y-m-d G:i:s'), 'send_at' => null]);
        alert()->success('Envoi de la campagne annulé');
        return redirect('build/newsletter');
    } 
 | 
	php 
 | 
	public function cancel($id)
    {
        $campagne = $this->campagne->find($id);
        $this->mailjet->deleteCampagne($campagne->api_campagne_id);
        // Update campagne status
        $this->campagne->update(['id' => $campagne->id, 'status' => 'brouillon', 'updated_at' => date('Y-m-d G:i:s'), 'send_at' => null]);
        alert()->success('Envoi de la campagne annulé');
        return redirect('build/newsletter');
    } 
 | 
	[
  "public",
  "function",
  "cancel",
  "(",
  "$",
  "id",
  ")",
  "{",
  "$",
  "campagne",
  "=",
  "$",
  "this",
  "->",
  "campagne",
  "->",
  "find",
  "(",
  "$",
  "id",
  ")",
  ";",
  "$",
  "this",
  "->",
  "mailjet",
  "->",
  "deleteCampagne",
  "(",
  "$",
  "campagne",
  "->",
  "api_campagne_id",
  ")",
  ";",
  "// Update campagne status",
  "$",
  "this",
  "->",
  "campagne",
  "->",
  "update",
  "(",
  "[",
  "'id'",
  "=>",
  "$",
  "campagne",
  "->",
  "id",
  ",",
  "'status'",
  "=>",
  "'brouillon'",
  ",",
  "'updated_at'",
  "=>",
  "date",
  "(",
  "'Y-m-d G:i:s'",
  ")",
  ",",
  "'send_at'",
  "=>",
  "null",
  "]",
  ")",
  ";",
  "alert",
  "(",
  ")",
  "->",
  "success",
  "(",
  "'Envoi de la campagne annulé')",
  ";",
  "",
  "return",
  "redirect",
  "(",
  "'build/newsletter'",
  ")",
  ";",
  "}"
]  | 
	Preview
@param  int  $id
@return \Illuminate\Http\Response 
 | 
	[
  "Preview"
]  | 
	train 
 | 
	https://github.com/DesignPond/newsletter/blob/0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3/src/Http/Controllers/Backend/CampagneController.php#L80-L91 
 | 
					
	DesignPond/newsletter 
 | 
	src/Http/Controllers/Backend/CampagneController.php 
 | 
	CampagneController.store 
 | 
	public function store(Request $request)
    {
        $campagne = $this->campagne->create(['sujet' => $request->input('sujet'), 'auteurs' => $request->input('auteurs'), 'newsletter_id' => $request->input('newsletter_id') ] );
        $this->mailjet->setList($campagne->newsletter->list_id);
        $created = $this->mailjet->createCampagne($campagne); // return Mailjet ID
        if(!$created)
        {
            throw new \designpond\newsletter\Exceptions\CampagneCreationException('Problème avec la création de campagne sur mailjet');
        }
        $this->campagne->update(['id' => $campagne->id, 'api_campagne_id' => $created]);
        alert()->success('Campagne crée');
        return redirect('build/campagne/'.$campagne->id);
    } 
 | 
	php 
 | 
	public function store(Request $request)
    {
        $campagne = $this->campagne->create(['sujet' => $request->input('sujet'), 'auteurs' => $request->input('auteurs'), 'newsletter_id' => $request->input('newsletter_id') ] );
        $this->mailjet->setList($campagne->newsletter->list_id);
        $created = $this->mailjet->createCampagne($campagne); // return Mailjet ID
        if(!$created)
        {
            throw new \designpond\newsletter\Exceptions\CampagneCreationException('Problème avec la création de campagne sur mailjet');
        }
        $this->campagne->update(['id' => $campagne->id, 'api_campagne_id' => $created]);
        alert()->success('Campagne crée');
        return redirect('build/campagne/'.$campagne->id);
    } 
 | 
	[
  "public",
  "function",
  "store",
  "(",
  "Request",
  "$",
  "request",
  ")",
  "{",
  "$",
  "campagne",
  "=",
  "$",
  "this",
  "->",
  "campagne",
  "->",
  "create",
  "(",
  "[",
  "'sujet'",
  "=>",
  "$",
  "request",
  "->",
  "input",
  "(",
  "'sujet'",
  ")",
  ",",
  "'auteurs'",
  "=>",
  "$",
  "request",
  "->",
  "input",
  "(",
  "'auteurs'",
  ")",
  ",",
  "'newsletter_id'",
  "=>",
  "$",
  "request",
  "->",
  "input",
  "(",
  "'newsletter_id'",
  ")",
  "]",
  ")",
  ";",
  "$",
  "this",
  "->",
  "mailjet",
  "->",
  "setList",
  "(",
  "$",
  "campagne",
  "->",
  "newsletter",
  "->",
  "list_id",
  ")",
  ";",
  "$",
  "created",
  "=",
  "$",
  "this",
  "->",
  "mailjet",
  "->",
  "createCampagne",
  "(",
  "$",
  "campagne",
  ")",
  ";",
  "// return Mailjet ID",
  "if",
  "(",
  "!",
  "$",
  "created",
  ")",
  "{",
  "throw",
  "new",
  "\\",
  "designpond",
  "\\",
  "newsletter",
  "\\",
  "Exceptions",
  "\\",
  "CampagneCreationException",
  "(",
  "'Problème avec la création de campagne sur mailjet');",
  "",
  "",
  "}",
  "$",
  "this",
  "->",
  "campagne",
  "->",
  "update",
  "(",
  "[",
  "'id'",
  "=>",
  "$",
  "campagne",
  "->",
  "id",
  ",",
  "'api_campagne_id'",
  "=>",
  "$",
  "created",
  "]",
  ")",
  ";",
  "alert",
  "(",
  ")",
  "->",
  "success",
  "(",
  "'Campagne crée')",
  ";",
  "",
  "return",
  "redirect",
  "(",
  "'build/campagne/'",
  ".",
  "$",
  "campagne",
  "->",
  "id",
  ")",
  ";",
  "}"
]  | 
	Store a newly created resource in storage.
@param  \Illuminate\Http\Request  $request
@return \Illuminate\Http\Response 
 | 
	[
  "Store",
  "a",
  "newly",
  "created",
  "resource",
  "in",
  "storage",
  "."
]  | 
	train 
 | 
	https://github.com/DesignPond/newsletter/blob/0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3/src/Http/Controllers/Backend/CampagneController.php#L124-L142 
 | 
					
	DesignPond/newsletter 
 | 
	src/Http/Controllers/Backend/CampagneController.php 
 | 
	CampagneController.update 
 | 
	public function update(Request $request, $id)
    {
        $campagne = $this->campagne->update($request->all());
        alert()->success('Campagne édité');
        return redirect('build/campagne/'.$campagne->id);
    } 
 | 
	php 
 | 
	public function update(Request $request, $id)
    {
        $campagne = $this->campagne->update($request->all());
        alert()->success('Campagne édité');
        return redirect('build/campagne/'.$campagne->id);
    } 
 | 
	[
  "public",
  "function",
  "update",
  "(",
  "Request",
  "$",
  "request",
  ",",
  "$",
  "id",
  ")",
  "{",
  "$",
  "campagne",
  "=",
  "$",
  "this",
  "->",
  "campagne",
  "->",
  "update",
  "(",
  "$",
  "request",
  "->",
  "all",
  "(",
  ")",
  ")",
  ";",
  "alert",
  "(",
  ")",
  "->",
  "success",
  "(",
  "'Campagne édité');",
  "",
  "",
  "return",
  "redirect",
  "(",
  "'build/campagne/'",
  ".",
  "$",
  "campagne",
  "->",
  "id",
  ")",
  ";",
  "}"
]  | 
	Update the specified resource in storage.
@param  \Illuminate\Http\Request  $request
@param  int  $id
@return \Illuminate\Http\Response 
 | 
	[
  "Update",
  "the",
  "specified",
  "resource",
  "in",
  "storage",
  "."
]  | 
	train 
 | 
	https://github.com/DesignPond/newsletter/blob/0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3/src/Http/Controllers/Backend/CampagneController.php#L151-L158 
 | 
					
	DesignPond/newsletter 
 | 
	src/Http/Controllers/Backend/CampagneController.php 
 | 
	CampagneController.destroy 
 | 
	public function destroy($id)
    {
        $campagne = $this->campagne->find($id);
        $campagne->content()->delete();
        
        $this->campagne->delete($id);
        alert()->success('Campagne supprimée');
        return redirect()->back();
    } 
 | 
	php 
 | 
	public function destroy($id)
    {
        $campagne = $this->campagne->find($id);
        $campagne->content()->delete();
        
        $this->campagne->delete($id);
        alert()->success('Campagne supprimée');
        return redirect()->back();
    } 
 | 
	[
  "public",
  "function",
  "destroy",
  "(",
  "$",
  "id",
  ")",
  "{",
  "$",
  "campagne",
  "=",
  "$",
  "this",
  "->",
  "campagne",
  "->",
  "find",
  "(",
  "$",
  "id",
  ")",
  ";",
  "$",
  "campagne",
  "->",
  "content",
  "(",
  ")",
  "->",
  "delete",
  "(",
  ")",
  ";",
  "$",
  "this",
  "->",
  "campagne",
  "->",
  "delete",
  "(",
  "$",
  "id",
  ")",
  ";",
  "alert",
  "(",
  ")",
  "->",
  "success",
  "(",
  "'Campagne supprimée')",
  ";",
  "",
  "return",
  "redirect",
  "(",
  ")",
  "->",
  "back",
  "(",
  ")",
  ";",
  "}"
]  | 
	Remove the specified resource from storage.
@param  int  $id
@return \Illuminate\Http\Response 
 | 
	[
  "Remove",
  "the",
  "specified",
  "resource",
  "from",
  "storage",
  "."
]  | 
	train 
 | 
	https://github.com/DesignPond/newsletter/blob/0bf0e7a8a42fa4b90a5e937771bb80058e0a91c3/src/Http/Controllers/Backend/CampagneController.php#L166-L176 
 | 
					
	cakebake/yii2-scalable-behavior 
 | 
	ScalableBehavior.php 
 | 
	ScalableBehavior.virtualToScalable 
 | 
	public function virtualToScalable($event)
    {
        if (($this->scalableAttributeName() !== null) &&
        ($this->virtualAttributesNames() !== null)) {
            $data = [];
            foreach ($this->virtualAttributesNames() as $name) {
                if (!empty($this->owner->{$name})) {
                    $data[$name] = $this->owner->{$name};
                }
            }
            $this->owner->{$this->scalableAttributeName()} = $this->convert($data);
        }
    } 
 | 
	php 
 | 
	public function virtualToScalable($event)
    {
        if (($this->scalableAttributeName() !== null) &&
        ($this->virtualAttributesNames() !== null)) {
            $data = [];
            foreach ($this->virtualAttributesNames() as $name) {
                if (!empty($this->owner->{$name})) {
                    $data[$name] = $this->owner->{$name};
                }
            }
            $this->owner->{$this->scalableAttributeName()} = $this->convert($data);
        }
    } 
 | 
	[
  "public",
  "function",
  "virtualToScalable",
  "(",
  "$",
  "event",
  ")",
  "{",
  "if",
  "(",
  "(",
  "$",
  "this",
  "->",
  "scalableAttributeName",
  "(",
  ")",
  "!==",
  "null",
  ")",
  "&&",
  "(",
  "$",
  "this",
  "->",
  "virtualAttributesNames",
  "(",
  ")",
  "!==",
  "null",
  ")",
  ")",
  "{",
  "$",
  "data",
  "=",
  "[",
  "]",
  ";",
  "foreach",
  "(",
  "$",
  "this",
  "->",
  "virtualAttributesNames",
  "(",
  ")",
  "as",
  "$",
  "name",
  ")",
  "{",
  "if",
  "(",
  "!",
  "empty",
  "(",
  "$",
  "this",
  "->",
  "owner",
  "->",
  "{",
  "$",
  "name",
  "}",
  ")",
  ")",
  "{",
  "$",
  "data",
  "[",
  "$",
  "name",
  "]",
  "=",
  "$",
  "this",
  "->",
  "owner",
  "->",
  "{",
  "$",
  "name",
  "}",
  ";",
  "}",
  "}",
  "$",
  "this",
  "->",
  "owner",
  "->",
  "{",
  "$",
  "this",
  "->",
  "scalableAttributeName",
  "(",
  ")",
  "}",
  "=",
  "$",
  "this",
  "->",
  "convert",
  "(",
  "$",
  "data",
  ")",
  ";",
  "}",
  "}"
]  | 
	Converts configured attributes before saving them to database
@param mixed $event 
 | 
	[
  "Converts",
  "configured",
  "attributes",
  "before",
  "saving",
  "them",
  "to",
  "database"
]  | 
	train 
 | 
	https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L68-L82 
 | 
					
	cakebake/yii2-scalable-behavior 
 | 
	ScalableBehavior.php 
 | 
	ScalableBehavior.scalableToVirtual 
 | 
	public function scalableToVirtual($event = null)
    {
        if (($this->scalableAttributeName() !== null) &&
        ($this->virtualAttributesNames() !== null)) {
            $virtualAttributesConf = [];
            foreach ($this->virtualAttributesNames() as $name) {
                $virtualAttributesConf[$name] = '';
            }
            $virtualAttributesNames = ArrayHelper::merge(
                $virtualAttributesConf,
                (($a = $this->unConvert($this->owner->{$this->scalableAttributeName()})) !== null) ? $a : []
            );
            foreach ($virtualAttributesNames as $name => $value) {
                if (in_array($name, $this->virtualAttributesNames())) {
                    $this->owner->{$name} = $value;
                }
            }
        }
    } 
 | 
	php 
 | 
	public function scalableToVirtual($event = null)
    {
        if (($this->scalableAttributeName() !== null) &&
        ($this->virtualAttributesNames() !== null)) {
            $virtualAttributesConf = [];
            foreach ($this->virtualAttributesNames() as $name) {
                $virtualAttributesConf[$name] = '';
            }
            $virtualAttributesNames = ArrayHelper::merge(
                $virtualAttributesConf,
                (($a = $this->unConvert($this->owner->{$this->scalableAttributeName()})) !== null) ? $a : []
            );
            foreach ($virtualAttributesNames as $name => $value) {
                if (in_array($name, $this->virtualAttributesNames())) {
                    $this->owner->{$name} = $value;
                }
            }
        }
    } 
 | 
	[
  "public",
  "function",
  "scalableToVirtual",
  "(",
  "$",
  "event",
  "=",
  "null",
  ")",
  "{",
  "if",
  "(",
  "(",
  "$",
  "this",
  "->",
  "scalableAttributeName",
  "(",
  ")",
  "!==",
  "null",
  ")",
  "&&",
  "(",
  "$",
  "this",
  "->",
  "virtualAttributesNames",
  "(",
  ")",
  "!==",
  "null",
  ")",
  ")",
  "{",
  "$",
  "virtualAttributesConf",
  "=",
  "[",
  "]",
  ";",
  "foreach",
  "(",
  "$",
  "this",
  "->",
  "virtualAttributesNames",
  "(",
  ")",
  "as",
  "$",
  "name",
  ")",
  "{",
  "$",
  "virtualAttributesConf",
  "[",
  "$",
  "name",
  "]",
  "=",
  "''",
  ";",
  "}",
  "$",
  "virtualAttributesNames",
  "=",
  "ArrayHelper",
  "::",
  "merge",
  "(",
  "$",
  "virtualAttributesConf",
  ",",
  "(",
  "(",
  "$",
  "a",
  "=",
  "$",
  "this",
  "->",
  "unConvert",
  "(",
  "$",
  "this",
  "->",
  "owner",
  "->",
  "{",
  "$",
  "this",
  "->",
  "scalableAttributeName",
  "(",
  ")",
  "}",
  ")",
  ")",
  "!==",
  "null",
  ")",
  "?",
  "$",
  "a",
  ":",
  "[",
  "]",
  ")",
  ";",
  "foreach",
  "(",
  "$",
  "virtualAttributesNames",
  "as",
  "$",
  "name",
  "=>",
  "$",
  "value",
  ")",
  "{",
  "if",
  "(",
  "in_array",
  "(",
  "$",
  "name",
  ",",
  "$",
  "this",
  "->",
  "virtualAttributesNames",
  "(",
  ")",
  ")",
  ")",
  "{",
  "$",
  "this",
  "->",
  "owner",
  "->",
  "{",
  "$",
  "name",
  "}",
  "=",
  "$",
  "value",
  ";",
  "}",
  "}",
  "}",
  "}"
]  | 
	Checks if the defined attributes are unserializeable and unserializes their values
@param mixed $event 
 | 
	[
  "Checks",
  "if",
  "the",
  "defined",
  "attributes",
  "are",
  "unserializeable",
  "and",
  "unserializes",
  "their",
  "values"
]  | 
	train 
 | 
	https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L90-L111 
 | 
					
	cakebake/yii2-scalable-behavior 
 | 
	ScalableBehavior.php 
 | 
	ScalableBehavior.convert 
 | 
	public function convert($data)
    {
        if (empty($data) || ($out = @serialize($data)) === false)
            return null;
        return $out;
    } 
 | 
	php 
 | 
	public function convert($data)
    {
        if (empty($data) || ($out = @serialize($data)) === false)
            return null;
        return $out;
    } 
 | 
	[
  "public",
  "function",
  "convert",
  "(",
  "$",
  "data",
  ")",
  "{",
  "if",
  "(",
  "empty",
  "(",
  "$",
  "data",
  ")",
  "||",
  "(",
  "$",
  "out",
  "=",
  "@",
  "serialize",
  "(",
  "$",
  "data",
  ")",
  ")",
  "===",
  "false",
  ")",
  "return",
  "null",
  ";",
  "return",
  "$",
  "out",
  ";",
  "}"
]  | 
	Converts some input to a serialized string
@param mixed $data Input as an array, String, Object, and so on
@return null|string null at fault, string on success 
 | 
	[
  "Converts",
  "some",
  "input",
  "to",
  "a",
  "serialized",
  "string"
]  | 
	train 
 | 
	https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L119-L125 
 | 
					
	cakebake/yii2-scalable-behavior 
 | 
	ScalableBehavior.php 
 | 
	ScalableBehavior.unConvert 
 | 
	public function unConvert($data)
    {
        if (empty($data) || !is_string($data) || ($out = @unserialize($data)) === false)
            return null;
        if (!is_array($out) || empty($out))
            return null;
        return $out;
    } 
 | 
	php 
 | 
	public function unConvert($data)
    {
        if (empty($data) || !is_string($data) || ($out = @unserialize($data)) === false)
            return null;
        if (!is_array($out) || empty($out))
            return null;
        return $out;
    } 
 | 
	[
  "public",
  "function",
  "unConvert",
  "(",
  "$",
  "data",
  ")",
  "{",
  "if",
  "(",
  "empty",
  "(",
  "$",
  "data",
  ")",
  "||",
  "!",
  "is_string",
  "(",
  "$",
  "data",
  ")",
  "||",
  "(",
  "$",
  "out",
  "=",
  "@",
  "unserialize",
  "(",
  "$",
  "data",
  ")",
  ")",
  "===",
  "false",
  ")",
  "return",
  "null",
  ";",
  "if",
  "(",
  "!",
  "is_array",
  "(",
  "$",
  "out",
  ")",
  "||",
  "empty",
  "(",
  "$",
  "out",
  ")",
  ")",
  "return",
  "null",
  ";",
  "return",
  "$",
  "out",
  ";",
  "}"
]  | 
	Unconverts a serialized string into an array
@param string $data Serialized string to convert
@return null|array null at fault, array on success 
 | 
	[
  "Unconverts",
  "a",
  "serialized",
  "string",
  "into",
  "an",
  "array"
]  | 
	train 
 | 
	https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L133-L142 
 | 
					
	cakebake/yii2-scalable-behavior 
 | 
	ScalableBehavior.php 
 | 
	ScalableBehavior.scalableAttributeName 
 | 
	public function scalableAttributeName()
    {
        if ($this->_scalableAttribute !== null)
            return $this->_scalableAttribute;
        if (in_array((string)$this->scalableAttribute, $this->objAttributesNames()))
            return $this->_scalableAttribute = $this->scalableAttribute;
        return null;
    } 
 | 
	php 
 | 
	public function scalableAttributeName()
    {
        if ($this->_scalableAttribute !== null)
            return $this->_scalableAttribute;
        if (in_array((string)$this->scalableAttribute, $this->objAttributesNames()))
            return $this->_scalableAttribute = $this->scalableAttribute;
        return null;
    } 
 | 
	[
  "public",
  "function",
  "scalableAttributeName",
  "(",
  ")",
  "{",
  "if",
  "(",
  "$",
  "this",
  "->",
  "_scalableAttribute",
  "!==",
  "null",
  ")",
  "return",
  "$",
  "this",
  "->",
  "_scalableAttribute",
  ";",
  "if",
  "(",
  "in_array",
  "(",
  "(",
  "string",
  ")",
  "$",
  "this",
  "->",
  "scalableAttribute",
  ",",
  "$",
  "this",
  "->",
  "objAttributesNames",
  "(",
  ")",
  ")",
  ")",
  "return",
  "$",
  "this",
  "->",
  "_scalableAttribute",
  "=",
  "$",
  "this",
  "->",
  "scalableAttribute",
  ";",
  "return",
  "null",
  ";",
  "}"
]  | 
	Verifies the configured scalable attribute
@return null|string 
 | 
	[
  "Verifies",
  "the",
  "configured",
  "scalable",
  "attribute"
]  | 
	train 
 | 
	https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L153-L162 
 | 
					
	cakebake/yii2-scalable-behavior 
 | 
	ScalableBehavior.php 
 | 
	ScalableBehavior.virtualAttributesNames 
 | 
	public function virtualAttributesNames()
    {
        if (!empty($this->_virtualAttributes))
            return $this->_virtualAttributes;
        if (!is_array($this->virtualAttributes) || empty($this->virtualAttributes))
            return null;
        $attributes = [];
        foreach ($this->virtualAttributes as $a) {
            if (!in_array($a, $this->objAttributesNames()) && !in_array($a, $attributes)) {
                $attributes[] = $a;
            }
        }
        return !empty($attributes) ? $this->_virtualAttributes = $attributes : null;
    } 
 | 
	php 
 | 
	public function virtualAttributesNames()
    {
        if (!empty($this->_virtualAttributes))
            return $this->_virtualAttributes;
        if (!is_array($this->virtualAttributes) || empty($this->virtualAttributes))
            return null;
        $attributes = [];
        foreach ($this->virtualAttributes as $a) {
            if (!in_array($a, $this->objAttributesNames()) && !in_array($a, $attributes)) {
                $attributes[] = $a;
            }
        }
        return !empty($attributes) ? $this->_virtualAttributes = $attributes : null;
    } 
 | 
	[
  "public",
  "function",
  "virtualAttributesNames",
  "(",
  ")",
  "{",
  "if",
  "(",
  "!",
  "empty",
  "(",
  "$",
  "this",
  "->",
  "_virtualAttributes",
  ")",
  ")",
  "return",
  "$",
  "this",
  "->",
  "_virtualAttributes",
  ";",
  "if",
  "(",
  "!",
  "is_array",
  "(",
  "$",
  "this",
  "->",
  "virtualAttributes",
  ")",
  "||",
  "empty",
  "(",
  "$",
  "this",
  "->",
  "virtualAttributes",
  ")",
  ")",
  "return",
  "null",
  ";",
  "$",
  "attributes",
  "=",
  "[",
  "]",
  ";",
  "foreach",
  "(",
  "$",
  "this",
  "->",
  "virtualAttributes",
  "as",
  "$",
  "a",
  ")",
  "{",
  "if",
  "(",
  "!",
  "in_array",
  "(",
  "$",
  "a",
  ",",
  "$",
  "this",
  "->",
  "objAttributesNames",
  "(",
  ")",
  ")",
  "&&",
  "!",
  "in_array",
  "(",
  "$",
  "a",
  ",",
  "$",
  "attributes",
  ")",
  ")",
  "{",
  "$",
  "attributes",
  "[",
  "]",
  "=",
  "$",
  "a",
  ";",
  "}",
  "}",
  "return",
  "!",
  "empty",
  "(",
  "$",
  "attributes",
  ")",
  "?",
  "$",
  "this",
  "->",
  "_virtualAttributes",
  "=",
  "$",
  "attributes",
  ":",
  "null",
  ";",
  "}"
]  | 
	Verifies the configured virtual attributes
@return mixed 
 | 
	[
  "Verifies",
  "the",
  "configured",
  "virtual",
  "attributes"
]  | 
	train 
 | 
	https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L173-L189 
 | 
					
	cakebake/yii2-scalable-behavior 
 | 
	ScalableBehavior.php 
 | 
	ScalableBehavior.objAttributesNames 
 | 
	public function objAttributesNames()
    {
        if (!empty($this->_objAttributes))
            return $this->_objAttributes;
        $attributes = $this->owner->attributes();
        return !empty($attributes) ? $this->_objAttributes = $attributes : null;
    } 
 | 
	php 
 | 
	public function objAttributesNames()
    {
        if (!empty($this->_objAttributes))
            return $this->_objAttributes;
        $attributes = $this->owner->attributes();
        return !empty($attributes) ? $this->_objAttributes = $attributes : null;
    } 
 | 
	[
  "public",
  "function",
  "objAttributesNames",
  "(",
  ")",
  "{",
  "if",
  "(",
  "!",
  "empty",
  "(",
  "$",
  "this",
  "->",
  "_objAttributes",
  ")",
  ")",
  "return",
  "$",
  "this",
  "->",
  "_objAttributes",
  ";",
  "$",
  "attributes",
  "=",
  "$",
  "this",
  "->",
  "owner",
  "->",
  "attributes",
  "(",
  ")",
  ";",
  "return",
  "!",
  "empty",
  "(",
  "$",
  "attributes",
  ")",
  "?",
  "$",
  "this",
  "->",
  "_objAttributes",
  "=",
  "$",
  "attributes",
  ":",
  "null",
  ";",
  "}"
]  | 
	Get the object's attributes / the columns of the corresponding table 
 | 
	[
  "Get",
  "the",
  "object",
  "s",
  "attributes",
  "/",
  "the",
  "columns",
  "of",
  "the",
  "corresponding",
  "table"
]  | 
	train 
 | 
	https://github.com/cakebake/yii2-scalable-behavior/blob/4cc7fa9766e9d58dbf6842b7f298063eac0ab9fb/ScalableBehavior.php#L199-L207 
 | 
					
	rhosocial/yii2-user 
 | 
	forms/LoginForm.php 
 | 
	LoginForm.validateId 
 | 
	public function validateId($attribute, $params)
    {
        foreach (Yii::$app->user->getLoginPriority() as $item) {
            if ($item::validate($this->$attribute)) {
                return;
            }
        }
        $this->addError($attribute, Yii::t('user', 'Incorrect ID.'));
    } 
 | 
	php 
 | 
	public function validateId($attribute, $params)
    {
        foreach (Yii::$app->user->getLoginPriority() as $item) {
            if ($item::validate($this->$attribute)) {
                return;
            }
        }
        $this->addError($attribute, Yii::t('user', 'Incorrect ID.'));
    } 
 | 
	[
  "public",
  "function",
  "validateId",
  "(",
  "$",
  "attribute",
  ",",
  "$",
  "params",
  ")",
  "{",
  "foreach",
  "(",
  "Yii",
  "::",
  "$",
  "app",
  "->",
  "user",
  "->",
  "getLoginPriority",
  "(",
  ")",
  "as",
  "$",
  "item",
  ")",
  "{",
  "if",
  "(",
  "$",
  "item",
  "::",
  "validate",
  "(",
  "$",
  "this",
  "->",
  "$",
  "attribute",
  ")",
  ")",
  "{",
  "return",
  ";",
  "}",
  "}",
  "$",
  "this",
  "->",
  "addError",
  "(",
  "$",
  "attribute",
  ",",
  "Yii",
  "::",
  "t",
  "(",
  "'user'",
  ",",
  "'Incorrect ID.'",
  ")",
  ")",
  ";",
  "}"
]  | 
	Validates the ID.
@param $attribute
@param $params 
 | 
	[
  "Validates",
  "the",
  "ID",
  "."
]  | 
	train 
 | 
	https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/forms/LoginForm.php#L82-L90 
 | 
					
	rhosocial/yii2-user 
 | 
	forms/LoginForm.php 
 | 
	LoginForm.getUser 
 | 
	public function getUser()
    {
        if ($this->_user === false) {
            foreach (Yii::$app->user->getLoginPriority() as $item) {
                if ($item::validate($this->id)) {
                    return $item::getUser($this->id);
                }
            }
        }
        return $this->_user;
    } 
 | 
	php 
 | 
	public function getUser()
    {
        if ($this->_user === false) {
            foreach (Yii::$app->user->getLoginPriority() as $item) {
                if ($item::validate($this->id)) {
                    return $item::getUser($this->id);
                }
            }
        }
        return $this->_user;
    } 
 | 
	[
  "public",
  "function",
  "getUser",
  "(",
  ")",
  "{",
  "if",
  "(",
  "$",
  "this",
  "->",
  "_user",
  "===",
  "false",
  ")",
  "{",
  "foreach",
  "(",
  "Yii",
  "::",
  "$",
  "app",
  "->",
  "user",
  "->",
  "getLoginPriority",
  "(",
  ")",
  "as",
  "$",
  "item",
  ")",
  "{",
  "if",
  "(",
  "$",
  "item",
  "::",
  "validate",
  "(",
  "$",
  "this",
  "->",
  "id",
  ")",
  ")",
  "{",
  "return",
  "$",
  "item",
  "::",
  "getUser",
  "(",
  "$",
  "this",
  "->",
  "id",
  ")",
  ";",
  "}",
  "}",
  "}",
  "return",
  "$",
  "this",
  "->",
  "_user",
  ";",
  "}"
]  | 
	Finds user by [[id]]
@return User|null 
 | 
	[
  "Finds",
  "user",
  "by",
  "[[",
  "id",
  "]]"
]  | 
	train 
 | 
	https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/forms/LoginForm.php#L127-L138 
 | 
					
	willhoffmann/domuserp-php 
 | 
	src/Request.php 
 | 
	Request.execute 
 | 
	public function execute($method, $url, array $data = [])
    {
        $client = new Client(['handler' => $this->handler]);
        return json_decode($client->request($method, $url, array_merge($data, self::$OPTIONS))->getBody());
    } 
 | 
	php 
 | 
	public function execute($method, $url, array $data = [])
    {
        $client = new Client(['handler' => $this->handler]);
        return json_decode($client->request($method, $url, array_merge($data, self::$OPTIONS))->getBody());
    } 
 | 
	[
  "public",
  "function",
  "execute",
  "(",
  "$",
  "method",
  ",",
  "$",
  "url",
  ",",
  "array",
  "$",
  "data",
  "=",
  "[",
  "]",
  ")",
  "{",
  "$",
  "client",
  "=",
  "new",
  "Client",
  "(",
  "[",
  "'handler'",
  "=>",
  "$",
  "this",
  "->",
  "handler",
  "]",
  ")",
  ";",
  "return",
  "json_decode",
  "(",
  "$",
  "client",
  "->",
  "request",
  "(",
  "$",
  "method",
  ",",
  "$",
  "url",
  ",",
  "array_merge",
  "(",
  "$",
  "data",
  ",",
  "self",
  "::",
  "$",
  "OPTIONS",
  ")",
  ")",
  "->",
  "getBody",
  "(",
  ")",
  ")",
  ";",
  "}"
]  | 
	Execute the request
@param $method
@param $url
@param array $data
@return string
@throws \GuzzleHttp\Exception\GuzzleException 
 | 
	[
  "Execute",
  "the",
  "request"
]  | 
	train 
 | 
	https://github.com/willhoffmann/domuserp-php/blob/44e77a4f02b0252bc26cae4c0e6b2b7d578f10a6/src/Request.php#L47-L52 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.flatten 
 | 
	public function flatten( array $array, $preserve_keys = false ) {
		$return = [];
		array_walk_recursive( $array, function ( $v, $k ) use ( &$return, $preserve_keys ) {
			if ( $preserve_keys ) {
				$return[ $k ] = $v;
			} else {
				$return[] = $v;
			}
		} );
		return $return;
	} 
 | 
	php 
 | 
	public function flatten( array $array, $preserve_keys = false ) {
		$return = [];
		array_walk_recursive( $array, function ( $v, $k ) use ( &$return, $preserve_keys ) {
			if ( $preserve_keys ) {
				$return[ $k ] = $v;
			} else {
				$return[] = $v;
			}
		} );
		return $return;
	} 
 | 
	[
  "public",
  "function",
  "flatten",
  "(",
  "array",
  "$",
  "array",
  ",",
  "$",
  "preserve_keys",
  "=",
  "false",
  ")",
  "{",
  "$",
  "return",
  "=",
  "[",
  "]",
  ";",
  "array_walk_recursive",
  "(",
  "$",
  "array",
  ",",
  "function",
  "(",
  "$",
  "v",
  ",",
  "$",
  "k",
  ")",
  "use",
  "(",
  "&",
  "$",
  "return",
  ",",
  "$",
  "preserve_keys",
  ")",
  "{",
  "if",
  "(",
  "$",
  "preserve_keys",
  ")",
  "{",
  "$",
  "return",
  "[",
  "$",
  "k",
  "]",
  "=",
  "$",
  "v",
  ";",
  "}",
  "else",
  "{",
  "$",
  "return",
  "[",
  "]",
  "=",
  "$",
  "v",
  ";",
  "}",
  "}",
  ")",
  ";",
  "return",
  "$",
  "return",
  ";",
  "}"
]  | 
	@param array $array
@param bool $preserve_keys
@return array 
 | 
	[
  "@param",
  "array",
  "$array",
  "@param",
  "bool",
  "$preserve_keys"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L53-L64 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.get_array_value 
 | 
	private function get_array_value( $obj ) {
		if ( $obj instanceof \stdClass ) {
			$obj = get_object_vars( $obj );
		} elseif ( ! is_array( $obj ) ) {
			if ( method_exists( $obj, 'to_array' ) ) {
				$obj = $obj->to_array();
			}
		}
		if ( ! is_array( $obj ) || empty( $obj ) ) {
			return [];
		}
		return $obj;
	} 
 | 
	php 
 | 
	private function get_array_value( $obj ) {
		if ( $obj instanceof \stdClass ) {
			$obj = get_object_vars( $obj );
		} elseif ( ! is_array( $obj ) ) {
			if ( method_exists( $obj, 'to_array' ) ) {
				$obj = $obj->to_array();
			}
		}
		if ( ! is_array( $obj ) || empty( $obj ) ) {
			return [];
		}
		return $obj;
	} 
 | 
	[
  "private",
  "function",
  "get_array_value",
  "(",
  "$",
  "obj",
  ")",
  "{",
  "if",
  "(",
  "$",
  "obj",
  "instanceof",
  "\\",
  "stdClass",
  ")",
  "{",
  "$",
  "obj",
  "=",
  "get_object_vars",
  "(",
  "$",
  "obj",
  ")",
  ";",
  "}",
  "elseif",
  "(",
  "!",
  "is_array",
  "(",
  "$",
  "obj",
  ")",
  ")",
  "{",
  "if",
  "(",
  "method_exists",
  "(",
  "$",
  "obj",
  ",",
  "'to_array'",
  ")",
  ")",
  "{",
  "$",
  "obj",
  "=",
  "$",
  "obj",
  "->",
  "to_array",
  "(",
  ")",
  ";",
  "}",
  "}",
  "if",
  "(",
  "!",
  "is_array",
  "(",
  "$",
  "obj",
  ")",
  "||",
  "empty",
  "(",
  "$",
  "obj",
  ")",
  ")",
  "{",
  "return",
  "[",
  "]",
  ";",
  "}",
  "return",
  "$",
  "obj",
  ";",
  "}"
]  | 
	@param array|object $obj
@return array 
 | 
	[
  "@param",
  "array|object",
  "$obj"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L115-L128 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.array_pluck 
 | 
	public function array_pluck( $array, $key, $default = null, $filter = false ) {
		$array = $this->get_array_value( $array );
		return array_map( function ( $d ) use ( $key, $default ) {
			is_object( $d ) and $d = (array) $d;
			return is_array( $d ) && array_key_exists( $key, $d ) ? $d[ $key ] : $default;
		}, $filter ? array_filter( $array, function ( $d ) use ( $key ) {
			is_object( $d ) and $d = (array) $d;
			return is_array( $d ) && array_key_exists( $key, $d );
		} ) : $array );
	} 
 | 
	php 
 | 
	public function array_pluck( $array, $key, $default = null, $filter = false ) {
		$array = $this->get_array_value( $array );
		return array_map( function ( $d ) use ( $key, $default ) {
			is_object( $d ) and $d = (array) $d;
			return is_array( $d ) && array_key_exists( $key, $d ) ? $d[ $key ] : $default;
		}, $filter ? array_filter( $array, function ( $d ) use ( $key ) {
			is_object( $d ) and $d = (array) $d;
			return is_array( $d ) && array_key_exists( $key, $d );
		} ) : $array );
	} 
 | 
	[
  "public",
  "function",
  "array_pluck",
  "(",
  "$",
  "array",
  ",",
  "$",
  "key",
  ",",
  "$",
  "default",
  "=",
  "null",
  ",",
  "$",
  "filter",
  "=",
  "false",
  ")",
  "{",
  "$",
  "array",
  "=",
  "$",
  "this",
  "->",
  "get_array_value",
  "(",
  "$",
  "array",
  ")",
  ";",
  "return",
  "array_map",
  "(",
  "function",
  "(",
  "$",
  "d",
  ")",
  "use",
  "(",
  "$",
  "key",
  ",",
  "$",
  "default",
  ")",
  "{",
  "is_object",
  "(",
  "$",
  "d",
  ")",
  "and",
  "$",
  "d",
  "=",
  "(",
  "array",
  ")",
  "$",
  "d",
  ";",
  "return",
  "is_array",
  "(",
  "$",
  "d",
  ")",
  "&&",
  "array_key_exists",
  "(",
  "$",
  "key",
  ",",
  "$",
  "d",
  ")",
  "?",
  "$",
  "d",
  "[",
  "$",
  "key",
  "]",
  ":",
  "$",
  "default",
  ";",
  "}",
  ",",
  "$",
  "filter",
  "?",
  "array_filter",
  "(",
  "$",
  "array",
  ",",
  "function",
  "(",
  "$",
  "d",
  ")",
  "use",
  "(",
  "$",
  "key",
  ")",
  "{",
  "is_object",
  "(",
  "$",
  "d",
  ")",
  "and",
  "$",
  "d",
  "=",
  "(",
  "array",
  ")",
  "$",
  "d",
  ";",
  "return",
  "is_array",
  "(",
  "$",
  "d",
  ")",
  "&&",
  "array_key_exists",
  "(",
  "$",
  "key",
  ",",
  "$",
  "d",
  ")",
  ";",
  "}",
  ")",
  ":",
  "$",
  "array",
  ")",
  ";",
  "}"
]  | 
	@param array|object $array
@param string $key
@param mixed $default
@param bool $filter
@return array 
 | 
	[
  "@param",
  "array|object",
  "$array",
  "@param",
  "string",
  "$key",
  "@param",
  "mixed",
  "$default",
  "@param",
  "bool",
  "$filter"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L163-L175 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.array_map 
 | 
	public function array_map( $array, $callback ) {
		$array = $this->get_array_value( $array );
		return array_map( function ( $d ) use ( $callback ) {
			return is_callable( $callback ) ? $callback( $d ) : ( is_string( $callback ) && method_exists( $d, $callback ) ? $d->$callback() : null );
		}, $array );
	} 
 | 
	php 
 | 
	public function array_map( $array, $callback ) {
		$array = $this->get_array_value( $array );
		return array_map( function ( $d ) use ( $callback ) {
			return is_callable( $callback ) ? $callback( $d ) : ( is_string( $callback ) && method_exists( $d, $callback ) ? $d->$callback() : null );
		}, $array );
	} 
 | 
	[
  "public",
  "function",
  "array_map",
  "(",
  "$",
  "array",
  ",",
  "$",
  "callback",
  ")",
  "{",
  "$",
  "array",
  "=",
  "$",
  "this",
  "->",
  "get_array_value",
  "(",
  "$",
  "array",
  ")",
  ";",
  "return",
  "array_map",
  "(",
  "function",
  "(",
  "$",
  "d",
  ")",
  "use",
  "(",
  "$",
  "callback",
  ")",
  "{",
  "return",
  "is_callable",
  "(",
  "$",
  "callback",
  ")",
  "?",
  "$",
  "callback",
  "(",
  "$",
  "d",
  ")",
  ":",
  "(",
  "is_string",
  "(",
  "$",
  "callback",
  ")",
  "&&",
  "method_exists",
  "(",
  "$",
  "d",
  ",",
  "$",
  "callback",
  ")",
  "?",
  "$",
  "d",
  "->",
  "$",
  "callback",
  "(",
  ")",
  ":",
  "null",
  ")",
  ";",
  "}",
  ",",
  "$",
  "array",
  ")",
  ";",
  "}"
]  | 
	@param array|object $array
@param string|callable $callback
@return array 
 | 
	[
  "@param",
  "array|object",
  "$array",
  "@param",
  "string|callable",
  "$callback"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L183-L189 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.array_combine 
 | 
	public function array_combine( array $array, $key, $value = null ) {
		$keys   = $this->array_pluck( $array, $key );
		$values = empty( $value ) ? $array : $this->array_pluck( $array, $value );
		return array_combine( $keys, $values );
	} 
 | 
	php 
 | 
	public function array_combine( array $array, $key, $value = null ) {
		$keys   = $this->array_pluck( $array, $key );
		$values = empty( $value ) ? $array : $this->array_pluck( $array, $value );
		return array_combine( $keys, $values );
	} 
 | 
	[
  "public",
  "function",
  "array_combine",
  "(",
  "array",
  "$",
  "array",
  ",",
  "$",
  "key",
  ",",
  "$",
  "value",
  "=",
  "null",
  ")",
  "{",
  "$",
  "keys",
  "=",
  "$",
  "this",
  "->",
  "array_pluck",
  "(",
  "$",
  "array",
  ",",
  "$",
  "key",
  ")",
  ";",
  "$",
  "values",
  "=",
  "empty",
  "(",
  "$",
  "value",
  ")",
  "?",
  "$",
  "array",
  ":",
  "$",
  "this",
  "->",
  "array_pluck",
  "(",
  "$",
  "array",
  ",",
  "$",
  "value",
  ")",
  ";",
  "return",
  "array_combine",
  "(",
  "$",
  "keys",
  ",",
  "$",
  "values",
  ")",
  ";",
  "}"
]  | 
	@param array $array
@param string $key
@param string $value
@return array 
 | 
	[
  "@param",
  "array",
  "$array",
  "@param",
  "string",
  "$key",
  "@param",
  "string",
  "$value"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L208-L213 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.replace 
 | 
	public function replace( $string, $data ) {
		foreach ( $data as $k => $v ) {
			$string = str_replace( '${' . $k . '}', $v, $string );
		}
		return $string;
	} 
 | 
	php 
 | 
	public function replace( $string, $data ) {
		foreach ( $data as $k => $v ) {
			$string = str_replace( '${' . $k . '}', $v, $string );
		}
		return $string;
	} 
 | 
	[
  "public",
  "function",
  "replace",
  "(",
  "$",
  "string",
  ",",
  "$",
  "data",
  ")",
  "{",
  "foreach",
  "(",
  "$",
  "data",
  "as",
  "$",
  "k",
  "=>",
  "$",
  "v",
  ")",
  "{",
  "$",
  "string",
  "=",
  "str_replace",
  "(",
  "'${'",
  ".",
  "$",
  "k",
  ".",
  "'}'",
  ",",
  "$",
  "v",
  ",",
  "$",
  "string",
  ")",
  ";",
  "}",
  "return",
  "$",
  "string",
  ";",
  "}"
]  | 
	@param string $string
@param array $data
@return string 
 | 
	[
  "@param",
  "string",
  "$string",
  "@param",
  "array",
  "$data"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L221-L227 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.replace_time 
 | 
	public function replace_time( $string ) {
		if ( ! isset( self::$_replace_time ) ) {
			self::$_replace_time = [];
			foreach (
				[
					'Y',
					'y',
					'M',
					'm',
					'n',
					'D',
					'd',
					'H',
					'h',
					'i',
					'j',
					's',
				] as $t
			) {
				self::$_replace_time[ $t ] = date_i18n( $t );
			}
		}
		return $this->replace( $string, self::$_replace_time );
	} 
 | 
	php 
 | 
	public function replace_time( $string ) {
		if ( ! isset( self::$_replace_time ) ) {
			self::$_replace_time = [];
			foreach (
				[
					'Y',
					'y',
					'M',
					'm',
					'n',
					'D',
					'd',
					'H',
					'h',
					'i',
					'j',
					's',
				] as $t
			) {
				self::$_replace_time[ $t ] = date_i18n( $t );
			}
		}
		return $this->replace( $string, self::$_replace_time );
	} 
 | 
	[
  "public",
  "function",
  "replace_time",
  "(",
  "$",
  "string",
  ")",
  "{",
  "if",
  "(",
  "!",
  "isset",
  "(",
  "self",
  "::",
  "$",
  "_replace_time",
  ")",
  ")",
  "{",
  "self",
  "::",
  "$",
  "_replace_time",
  "=",
  "[",
  "]",
  ";",
  "foreach",
  "(",
  "[",
  "'Y'",
  ",",
  "'y'",
  ",",
  "'M'",
  ",",
  "'m'",
  ",",
  "'n'",
  ",",
  "'D'",
  ",",
  "'d'",
  ",",
  "'H'",
  ",",
  "'h'",
  ",",
  "'i'",
  ",",
  "'j'",
  ",",
  "'s'",
  ",",
  "]",
  "as",
  "$",
  "t",
  ")",
  "{",
  "self",
  "::",
  "$",
  "_replace_time",
  "[",
  "$",
  "t",
  "]",
  "=",
  "date_i18n",
  "(",
  "$",
  "t",
  ")",
  ";",
  "}",
  "}",
  "return",
  "$",
  "this",
  "->",
  "replace",
  "(",
  "$",
  "string",
  ",",
  "self",
  "::",
  "$",
  "_replace_time",
  ")",
  ";",
  "}"
]  | 
	@param string $string
@return string 
 | 
	[
  "@param",
  "string",
  "$string"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L234-L258 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.exec 
 | 
	public function exec( $command ) {
		$command .= ' 2>&1';
		$command = escapeshellcmd( $command );
		exec( $command, $output, $return_var );
		return [ $output, $return_var ];
	} 
 | 
	php 
 | 
	public function exec( $command ) {
		$command .= ' 2>&1';
		$command = escapeshellcmd( $command );
		exec( $command, $output, $return_var );
		return [ $output, $return_var ];
	} 
 | 
	[
  "public",
  "function",
  "exec",
  "(",
  "$",
  "command",
  ")",
  "{",
  "$",
  "command",
  ".=",
  "' 2>&1'",
  ";",
  "$",
  "command",
  "=",
  "escapeshellcmd",
  "(",
  "$",
  "command",
  ")",
  ";",
  "exec",
  "(",
  "$",
  "command",
  ",",
  "$",
  "output",
  ",",
  "$",
  "return_var",
  ")",
  ";",
  "return",
  "[",
  "$",
  "output",
  ",",
  "$",
  "return_var",
  "]",
  ";",
  "}"
]  | 
	@param string $command
@return array 
 | 
	[
  "@param",
  "string",
  "$command"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L275-L281 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.starts_with 
 | 
	public function starts_with( $haystack, $needle ) {
		if ( '' === $haystack || '' === $needle ) {
			return false;
		}
		if ( $haystack === $needle ) {
			return true;
		}
		return strncmp( $haystack, $needle, strlen( $needle ) ) === 0;
	} 
 | 
	php 
 | 
	public function starts_with( $haystack, $needle ) {
		if ( '' === $haystack || '' === $needle ) {
			return false;
		}
		if ( $haystack === $needle ) {
			return true;
		}
		return strncmp( $haystack, $needle, strlen( $needle ) ) === 0;
	} 
 | 
	[
  "public",
  "function",
  "starts_with",
  "(",
  "$",
  "haystack",
  ",",
  "$",
  "needle",
  ")",
  "{",
  "if",
  "(",
  "''",
  "===",
  "$",
  "haystack",
  "||",
  "''",
  "===",
  "$",
  "needle",
  ")",
  "{",
  "return",
  "false",
  ";",
  "}",
  "if",
  "(",
  "$",
  "haystack",
  "===",
  "$",
  "needle",
  ")",
  "{",
  "return",
  "true",
  ";",
  "}",
  "return",
  "strncmp",
  "(",
  "$",
  "haystack",
  ",",
  "$",
  "needle",
  ",",
  "strlen",
  "(",
  "$",
  "needle",
  ")",
  ")",
  "===",
  "0",
  ";",
  "}"
]  | 
	@since 2.1.0
@param string $haystack
@param string $needle
@return bool 
 | 
	[
  "@since",
  "2",
  ".",
  "1",
  ".",
  "0"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L304-L313 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.ends_with 
 | 
	public function ends_with( $haystack, $needle ) {
		if ( '' === $haystack || '' === $needle ) {
			return false;
		}
		if ( $haystack === $needle ) {
			return true;
		}
		return substr_compare( $haystack, $needle, - strlen( $needle ) ) === 0;
	} 
 | 
	php 
 | 
	public function ends_with( $haystack, $needle ) {
		if ( '' === $haystack || '' === $needle ) {
			return false;
		}
		if ( $haystack === $needle ) {
			return true;
		}
		return substr_compare( $haystack, $needle, - strlen( $needle ) ) === 0;
	} 
 | 
	[
  "public",
  "function",
  "ends_with",
  "(",
  "$",
  "haystack",
  ",",
  "$",
  "needle",
  ")",
  "{",
  "if",
  "(",
  "''",
  "===",
  "$",
  "haystack",
  "||",
  "''",
  "===",
  "$",
  "needle",
  ")",
  "{",
  "return",
  "false",
  ";",
  "}",
  "if",
  "(",
  "$",
  "haystack",
  "===",
  "$",
  "needle",
  ")",
  "{",
  "return",
  "true",
  ";",
  "}",
  "return",
  "substr_compare",
  "(",
  "$",
  "haystack",
  ",",
  "$",
  "needle",
  ",",
  "-",
  "strlen",
  "(",
  "$",
  "needle",
  ")",
  ")",
  "===",
  "0",
  ";",
  "}"
]  | 
	@since 2.1.0
@param string $haystack
@param string $needle
@return bool 
 | 
	[
  "@since",
  "2",
  ".",
  "1",
  ".",
  "0"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L323-L332 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.get_debug_backtrace 
 | 
	public function get_debug_backtrace( $unset = [] ) {
		$backtrace = debug_backtrace();
		foreach ( $backtrace as $k => $v ) {
			// 大量のデータになりがちな object と args を削除や編集
			unset( $backtrace[ $k ]['object'] );
			if ( ! empty( $backtrace[ $k ]['args'] ) ) {
				$backtrace[ $k ]['args'] = $this->parse_backtrace_args( $backtrace[ $k ]['args'] );
			} else {
				unset( $backtrace[ $k ]['args'] );
			}
			if ( ! empty( $unset ) ) {
				foreach ( $v as $key => $value ) {
					if ( in_array( $key, $unset ) ) {
						unset( $backtrace[ $k ][ $key ] );
					}
				}
			}
		}
		return $backtrace;
	} 
 | 
	php 
 | 
	public function get_debug_backtrace( $unset = [] ) {
		$backtrace = debug_backtrace();
		foreach ( $backtrace as $k => $v ) {
			// 大量のデータになりがちな object と args を削除や編集
			unset( $backtrace[ $k ]['object'] );
			if ( ! empty( $backtrace[ $k ]['args'] ) ) {
				$backtrace[ $k ]['args'] = $this->parse_backtrace_args( $backtrace[ $k ]['args'] );
			} else {
				unset( $backtrace[ $k ]['args'] );
			}
			if ( ! empty( $unset ) ) {
				foreach ( $v as $key => $value ) {
					if ( in_array( $key, $unset ) ) {
						unset( $backtrace[ $k ][ $key ] );
					}
				}
			}
		}
		return $backtrace;
	} 
 | 
	[
  "public",
  "function",
  "get_debug_backtrace",
  "(",
  "$",
  "unset",
  "=",
  "[",
  "]",
  ")",
  "{",
  "$",
  "backtrace",
  "=",
  "debug_backtrace",
  "(",
  ")",
  ";",
  "foreach",
  "(",
  "$",
  "backtrace",
  "as",
  "$",
  "k",
  "=>",
  "$",
  "v",
  ")",
  "{",
  "// 大量のデータになりがちな object と args を削除や編集",
  "unset",
  "(",
  "$",
  "backtrace",
  "[",
  "$",
  "k",
  "]",
  "[",
  "'object'",
  "]",
  ")",
  ";",
  "if",
  "(",
  "!",
  "empty",
  "(",
  "$",
  "backtrace",
  "[",
  "$",
  "k",
  "]",
  "[",
  "'args'",
  "]",
  ")",
  ")",
  "{",
  "$",
  "backtrace",
  "[",
  "$",
  "k",
  "]",
  "[",
  "'args'",
  "]",
  "=",
  "$",
  "this",
  "->",
  "parse_backtrace_args",
  "(",
  "$",
  "backtrace",
  "[",
  "$",
  "k",
  "]",
  "[",
  "'args'",
  "]",
  ")",
  ";",
  "}",
  "else",
  "{",
  "unset",
  "(",
  "$",
  "backtrace",
  "[",
  "$",
  "k",
  "]",
  "[",
  "'args'",
  "]",
  ")",
  ";",
  "}",
  "if",
  "(",
  "!",
  "empty",
  "(",
  "$",
  "unset",
  ")",
  ")",
  "{",
  "foreach",
  "(",
  "$",
  "v",
  "as",
  "$",
  "key",
  "=>",
  "$",
  "value",
  ")",
  "{",
  "if",
  "(",
  "in_array",
  "(",
  "$",
  "key",
  ",",
  "$",
  "unset",
  ")",
  ")",
  "{",
  "unset",
  "(",
  "$",
  "backtrace",
  "[",
  "$",
  "k",
  "]",
  "[",
  "$",
  "key",
  "]",
  ")",
  ";",
  "}",
  "}",
  "}",
  "}",
  "return",
  "$",
  "backtrace",
  ";",
  "}"
]  | 
	@since 2.6.0
@param array $unset
@return array 
 | 
	[
  "@since",
  "2",
  ".",
  "6",
  ".",
  "0"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L357-L377 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.parse_backtrace_args 
 | 
	private function parse_backtrace_args( $args ) {
		return $this->array_map( $args, function ( $d ) {
			$type = gettype( $d );
			if ( 'array' === $type ) {
				return $this->parse_backtrace_args( $d );
			} elseif ( 'object' === $type ) {
				$type = get_class( $d );
			} elseif ( 'resource' !== $type && 'resource (closed)' !== $type && 'NULL' !== $type && 'unknown type' !== $type ) {
				if ( 'boolean' === $type ) {
					$d = var_export( $d, true );
				}
				$type .= ': ' . $d;
			}
			return $type;
		} );
	} 
 | 
	php 
 | 
	private function parse_backtrace_args( $args ) {
		return $this->array_map( $args, function ( $d ) {
			$type = gettype( $d );
			if ( 'array' === $type ) {
				return $this->parse_backtrace_args( $d );
			} elseif ( 'object' === $type ) {
				$type = get_class( $d );
			} elseif ( 'resource' !== $type && 'resource (closed)' !== $type && 'NULL' !== $type && 'unknown type' !== $type ) {
				if ( 'boolean' === $type ) {
					$d = var_export( $d, true );
				}
				$type .= ': ' . $d;
			}
			return $type;
		} );
	} 
 | 
	[
  "private",
  "function",
  "parse_backtrace_args",
  "(",
  "$",
  "args",
  ")",
  "{",
  "return",
  "$",
  "this",
  "->",
  "array_map",
  "(",
  "$",
  "args",
  ",",
  "function",
  "(",
  "$",
  "d",
  ")",
  "{",
  "$",
  "type",
  "=",
  "gettype",
  "(",
  "$",
  "d",
  ")",
  ";",
  "if",
  "(",
  "'array'",
  "===",
  "$",
  "type",
  ")",
  "{",
  "return",
  "$",
  "this",
  "->",
  "parse_backtrace_args",
  "(",
  "$",
  "d",
  ")",
  ";",
  "}",
  "elseif",
  "(",
  "'object'",
  "===",
  "$",
  "type",
  ")",
  "{",
  "$",
  "type",
  "=",
  "get_class",
  "(",
  "$",
  "d",
  ")",
  ";",
  "}",
  "elseif",
  "(",
  "'resource'",
  "!==",
  "$",
  "type",
  "&&",
  "'resource (closed)'",
  "!==",
  "$",
  "type",
  "&&",
  "'NULL'",
  "!==",
  "$",
  "type",
  "&&",
  "'unknown type'",
  "!==",
  "$",
  "type",
  ")",
  "{",
  "if",
  "(",
  "'boolean'",
  "===",
  "$",
  "type",
  ")",
  "{",
  "$",
  "d",
  "=",
  "var_export",
  "(",
  "$",
  "d",
  ",",
  "true",
  ")",
  ";",
  "}",
  "$",
  "type",
  ".=",
  "': '",
  ".",
  "$",
  "d",
  ";",
  "}",
  "return",
  "$",
  "type",
  ";",
  "}",
  ")",
  ";",
  "}"
]  | 
	@param array $args
@return array 
 | 
	[
  "@param",
  "array",
  "$args"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L384-L400 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.scan_dir_namespace_class 
 | 
	public function scan_dir_namespace_class( $dir, $split = false, $relative = '' ) {
		$dir  = rtrim( $dir, DS );
		$list = [];
		if ( is_dir( $dir ) ) {
			foreach ( scandir( $dir ) as $file ) {
				if ( $file === '.' || $file === '..' || $file === 'base.php' ) {
					continue;
				}
				$path = rtrim( $dir, DS ) . DS . $file;
				if ( is_file( $path ) ) {
					if ( $this->ends_with( $file, '.php' ) ) {
						if ( $split ) {
							$list[] = [ $relative, ucfirst( $this->app->get_page_slug( $file ) ) ];
						} else {
							$list[] = $relative . ucfirst( $this->app->get_page_slug( $file ) );
						}
					}
				} elseif ( is_dir( $path ) ) {
					$list = array_merge( $list, $this->scan_dir_namespace_class( $path, $split, $relative . ucfirst( $file ) . '\\' ) );
				}
			}
		}
		return $list;
	} 
 | 
	php 
 | 
	public function scan_dir_namespace_class( $dir, $split = false, $relative = '' ) {
		$dir  = rtrim( $dir, DS );
		$list = [];
		if ( is_dir( $dir ) ) {
			foreach ( scandir( $dir ) as $file ) {
				if ( $file === '.' || $file === '..' || $file === 'base.php' ) {
					continue;
				}
				$path = rtrim( $dir, DS ) . DS . $file;
				if ( is_file( $path ) ) {
					if ( $this->ends_with( $file, '.php' ) ) {
						if ( $split ) {
							$list[] = [ $relative, ucfirst( $this->app->get_page_slug( $file ) ) ];
						} else {
							$list[] = $relative . ucfirst( $this->app->get_page_slug( $file ) );
						}
					}
				} elseif ( is_dir( $path ) ) {
					$list = array_merge( $list, $this->scan_dir_namespace_class( $path, $split, $relative . ucfirst( $file ) . '\\' ) );
				}
			}
		}
		return $list;
	} 
 | 
	[
  "public",
  "function",
  "scan_dir_namespace_class",
  "(",
  "$",
  "dir",
  ",",
  "$",
  "split",
  "=",
  "false",
  ",",
  "$",
  "relative",
  "=",
  "''",
  ")",
  "{",
  "$",
  "dir",
  "=",
  "rtrim",
  "(",
  "$",
  "dir",
  ",",
  "DS",
  ")",
  ";",
  "$",
  "list",
  "=",
  "[",
  "]",
  ";",
  "if",
  "(",
  "is_dir",
  "(",
  "$",
  "dir",
  ")",
  ")",
  "{",
  "foreach",
  "(",
  "scandir",
  "(",
  "$",
  "dir",
  ")",
  "as",
  "$",
  "file",
  ")",
  "{",
  "if",
  "(",
  "$",
  "file",
  "===",
  "'.'",
  "||",
  "$",
  "file",
  "===",
  "'..'",
  "||",
  "$",
  "file",
  "===",
  "'base.php'",
  ")",
  "{",
  "continue",
  ";",
  "}",
  "$",
  "path",
  "=",
  "rtrim",
  "(",
  "$",
  "dir",
  ",",
  "DS",
  ")",
  ".",
  "DS",
  ".",
  "$",
  "file",
  ";",
  "if",
  "(",
  "is_file",
  "(",
  "$",
  "path",
  ")",
  ")",
  "{",
  "if",
  "(",
  "$",
  "this",
  "->",
  "ends_with",
  "(",
  "$",
  "file",
  ",",
  "'.php'",
  ")",
  ")",
  "{",
  "if",
  "(",
  "$",
  "split",
  ")",
  "{",
  "$",
  "list",
  "[",
  "]",
  "=",
  "[",
  "$",
  "relative",
  ",",
  "ucfirst",
  "(",
  "$",
  "this",
  "->",
  "app",
  "->",
  "get_page_slug",
  "(",
  "$",
  "file",
  ")",
  ")",
  "]",
  ";",
  "}",
  "else",
  "{",
  "$",
  "list",
  "[",
  "]",
  "=",
  "$",
  "relative",
  ".",
  "ucfirst",
  "(",
  "$",
  "this",
  "->",
  "app",
  "->",
  "get_page_slug",
  "(",
  "$",
  "file",
  ")",
  ")",
  ";",
  "}",
  "}",
  "}",
  "elseif",
  "(",
  "is_dir",
  "(",
  "$",
  "path",
  ")",
  ")",
  "{",
  "$",
  "list",
  "=",
  "array_merge",
  "(",
  "$",
  "list",
  ",",
  "$",
  "this",
  "->",
  "scan_dir_namespace_class",
  "(",
  "$",
  "path",
  ",",
  "$",
  "split",
  ",",
  "$",
  "relative",
  ".",
  "ucfirst",
  "(",
  "$",
  "file",
  ")",
  ".",
  "'\\\\'",
  ")",
  ")",
  ";",
  "}",
  "}",
  "}",
  "return",
  "$",
  "list",
  ";",
  "}"
]  | 
	@param string $dir
@param bool $split
@param string $relative
@return array 
 | 
	[
  "@param",
  "string",
  "$dir",
  "@param",
  "bool",
  "$split",
  "@param",
  "string",
  "$relative"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L409-L434 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/models/lib/utility.php 
 | 
	Utility.parse_db_type 
 | 
	public function parse_db_type( $type, $detect_text = false ) {
		switch ( true ) {
			case stristr( $type, 'TINYINT(1)' ) !== false:
				return 'bool';
			case stristr( $type, 'INT' ) !== false:
				return 'int';
			case stristr( $type, 'BIT' ) !== false:
				return 'bool';
			case stristr( $type, 'BOOLEAN' ) !== false:
				return 'bool';
			case stristr( $type, 'DECIMAL' ) !== false:
				return 'number';
			case stristr( $type, 'FLOAT' ) !== false:
				return 'float';
			case stristr( $type, 'DOUBLE' ) !== false:
				return 'number';
			case stristr( $type, 'REAL' ) !== false:
				return 'number';
			case $detect_text && stristr( $type, 'TEXT' ) !== false:
				return 'text';
		}
		return 'string';
	} 
 | 
	php 
 | 
	public function parse_db_type( $type, $detect_text = false ) {
		switch ( true ) {
			case stristr( $type, 'TINYINT(1)' ) !== false:
				return 'bool';
			case stristr( $type, 'INT' ) !== false:
				return 'int';
			case stristr( $type, 'BIT' ) !== false:
				return 'bool';
			case stristr( $type, 'BOOLEAN' ) !== false:
				return 'bool';
			case stristr( $type, 'DECIMAL' ) !== false:
				return 'number';
			case stristr( $type, 'FLOAT' ) !== false:
				return 'float';
			case stristr( $type, 'DOUBLE' ) !== false:
				return 'number';
			case stristr( $type, 'REAL' ) !== false:
				return 'number';
			case $detect_text && stristr( $type, 'TEXT' ) !== false:
				return 'text';
		}
		return 'string';
	} 
 | 
	[
  "public",
  "function",
  "parse_db_type",
  "(",
  "$",
  "type",
  ",",
  "$",
  "detect_text",
  "=",
  "false",
  ")",
  "{",
  "switch",
  "(",
  "true",
  ")",
  "{",
  "case",
  "stristr",
  "(",
  "$",
  "type",
  ",",
  "'TINYINT(1)'",
  ")",
  "!==",
  "false",
  ":",
  "return",
  "'bool'",
  ";",
  "case",
  "stristr",
  "(",
  "$",
  "type",
  ",",
  "'INT'",
  ")",
  "!==",
  "false",
  ":",
  "return",
  "'int'",
  ";",
  "case",
  "stristr",
  "(",
  "$",
  "type",
  ",",
  "'BIT'",
  ")",
  "!==",
  "false",
  ":",
  "return",
  "'bool'",
  ";",
  "case",
  "stristr",
  "(",
  "$",
  "type",
  ",",
  "'BOOLEAN'",
  ")",
  "!==",
  "false",
  ":",
  "return",
  "'bool'",
  ";",
  "case",
  "stristr",
  "(",
  "$",
  "type",
  ",",
  "'DECIMAL'",
  ")",
  "!==",
  "false",
  ":",
  "return",
  "'number'",
  ";",
  "case",
  "stristr",
  "(",
  "$",
  "type",
  ",",
  "'FLOAT'",
  ")",
  "!==",
  "false",
  ":",
  "return",
  "'float'",
  ";",
  "case",
  "stristr",
  "(",
  "$",
  "type",
  ",",
  "'DOUBLE'",
  ")",
  "!==",
  "false",
  ":",
  "return",
  "'number'",
  ";",
  "case",
  "stristr",
  "(",
  "$",
  "type",
  ",",
  "'REAL'",
  ")",
  "!==",
  "false",
  ":",
  "return",
  "'number'",
  ";",
  "case",
  "$",
  "detect_text",
  "&&",
  "stristr",
  "(",
  "$",
  "type",
  ",",
  "'TEXT'",
  ")",
  "!==",
  "false",
  ":",
  "return",
  "'text'",
  ";",
  "}",
  "return",
  "'string'",
  ";",
  "}"
]  | 
	@param string $type
@param bool $detect_text
@return string 
 | 
	[
  "@param",
  "string",
  "$type",
  "@param",
  "bool",
  "$detect_text"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/models/lib/utility.php#L442-L465 
 | 
					
	flextype-components/text 
 | 
	Text.php 
 | 
	Text.translitIt 
 | 
	public static function translitIt(string $str) : string
    {
        $patern = [
            // Latin
            'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'AE', 'Ç'=>'C',
            'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I',
            'Ð'=>'D', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ő'=>'O',
            'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ű'=>'U', 'Ý'=>'Y', 'Þ'=>'TH',
            'ß'=>'ss',
            'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'ae', 'ç'=>'c',
            'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i',
            'ð'=>'d', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ő'=>'o',
            'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ü'=>'u', 'ű'=>'u', 'ý'=>'y', 'þ'=>'th',
            'ÿ'=>'y',
            // Latin symbols
            '©'=>'(c)',
            // Greek
            'Α'=>'A', 'Β'=>'B', 'Γ'=>'G', 'Δ'=>'D', 'Ε'=>'E', 'Ζ'=>'Z', 'Η'=>'H', 'Θ'=>'8',
            'Ι'=>'I', 'Κ'=>'K', 'Λ'=>'L', 'Μ'=>'M', 'Ν'=>'N', 'Ξ'=>'3', 'Ο'=>'O', 'Π'=>'P',
            'Ρ'=>'R', 'Σ'=>'S', 'Τ'=>'T', 'Υ'=>'Y', 'Φ'=>'F', 'Χ'=>'X', 'Ψ'=>'PS', 'Ω'=>'W',
            'Ά'=>'A', 'Έ'=>'E', 'Ί'=>'I', 'Ό'=>'O', 'Ύ'=>'Y', 'Ή'=>'H', 'Ώ'=>'W', 'Ϊ'=>'I',
            'Ϋ'=>'Y',
            'α'=>'a', 'β'=>'b', 'γ'=>'g', 'δ'=>'d', 'ε'=>'e', 'ζ'=>'z', 'η'=>'h', 'θ'=>'8',
            'ι'=>'i', 'κ'=>'k', 'λ'=>'l', 'μ'=>'m', 'ν'=>'n', 'ξ'=>'3', 'ο'=>'o', 'π'=>'p',
            'ρ'=>'r', 'σ'=>'s', 'τ'=>'t', 'υ'=>'y', 'φ'=>'f', 'χ'=>'x', 'ψ'=>'ps', 'ω'=>'w',
            'ά'=>'a', 'έ'=>'e', 'ί'=>'i', 'ό'=>'o', 'ύ'=>'y', 'ή'=>'h', 'ώ'=>'w', 'ς'=>'s',
            'ϊ'=>'i', 'ΰ'=>'y', 'ϋ'=>'y', 'ΐ'=>'i',
            // Turkish
            'Ş'=>'S', 'İ'=>'I', 'Ç'=>'C', 'Ü'=>'U', 'Ö'=>'O', 'Ğ'=>'G',
            'ş'=>'s', 'ı'=>'i', 'ç'=>'c', 'ü'=>'u', 'ö'=>'o', 'ğ'=>'g',
            // Russian
            'А'=>'A', 'Б'=>'B', 'В'=>'V', 'Г'=>'G', 'Д'=>'D', 'Е'=>'E', 'Ё'=>'Yo', 'Ж'=>'Zh',
            'З'=>'Z', 'И'=>'I', 'Й'=>'J', 'К'=>'K', 'Л'=>'L', 'М'=>'M', 'Н'=>'N', 'О'=>'O',
            'П'=>'P', 'Р'=>'R', 'С'=>'S', 'Т'=>'T', 'У'=>'U', 'Ф'=>'F', 'Х'=>'H', 'Ц'=>'C',
            'Ч'=>'Ch', 'Ш'=>'Sh', 'Щ'=>'Sh', 'Ъ'=>'', 'Ы'=>'Y', 'Ь'=>'', 'Э'=>'E', 'Ю'=>'Yu',
            'Я'=>'Ya',
            'а'=>'a', 'б'=>'b', 'в'=>'v', 'г'=>'g', 'д'=>'d', 'е'=>'e', 'ё'=>'yo', 'ж'=>'zh',
            'з'=>'z', 'и'=>'i', 'й'=>'j', 'к'=>'k', 'л'=>'l', 'м'=>'m', 'н'=>'n', 'о'=>'o',
            'п'=>'p', 'р'=>'r', 'с'=>'s', 'т'=>'t', 'у'=>'u', 'ф'=>'f', 'х'=>'h', 'ц'=>'c',
            'ч'=>'ch', 'ш'=>'sh', 'щ'=>'sh', 'ъ'=>'', 'ы'=>'y', 'ь'=>'', 'э'=>'e', 'ю'=>'yu',
            'я'=>'ya',
            // Bulgarian
            'А'=>'A', 'Б'=>'B', 'В'=>'V', 'Г'=>'G', 'Д'=>'D', 'Е'=>'E', 'Ж'=>'Zh', 'З'=>'Z',
            'И'=>'I', 'Й'=>'J', 'К'=>'K', 'Л'=>'L', 'М'=>'M', 'Н'=>'N', 'О'=>'O', 'П'=>'P',
            'Р'=>'R', 'С'=>'S', 'Т'=>'T', 'У'=>'U', 'Ф'=>'F', 'Х'=>'H', 'Ц'=>'C', 'Ч'=>'Ch',
            'Ш'=>'Sh', 'Щ'=>'Sh', 'Ъ'=>'',	'Ь'=>'J','Ю'=>'Yu','Я'=>'Ya',
            'а'=>'a', 'б'=>'b', 'в'=>'v', 'г'=>'g', 'д'=>'d', 'е'=>'e', 'ж'=>'zh','з'=>'z',
            'и'=>'i', 'й'=>'j', 'к'=>'k', 'л'=>'l', 'м'=>'m', 'н'=>'n', 'о'=>'o','п'=>'p',
            'р'=>'r', 'с'=>'s', 'т'=>'t', 'у'=>'u', 'ф'=>'f', 'х'=>'h', 'ц'=>'c', 'ч'=>'ch',
            'ш'=>'sh', 'щ'=>'sh', 'ъ'=>'', 'ь'=>'j', 'ю'=>'yu', 'я'=>'ya',
            // Ukrainian
            'Є'=>'Ye', 'І'=>'I', 'Ї'=>'Yi', 'Ґ'=>'G',
            'є'=>'ye', 'і'=>'i', 'ї'=>'yi', 'ґ'=>'g',
            // Czech
            'Č'=>'C', 'Ď'=>'D', 'Ě'=>'E', 'Ň'=>'N', 'Ř'=>'R', 'Š'=>'S', 'Ť'=>'T', 'Ů'=>'U',
            'Ž'=>'Z',
            'č'=>'c', 'ď'=>'d', 'ě'=>'e', 'ň'=>'n', 'ř'=>'r', 'š'=>'s', 'ť'=>'t', 'ů'=>'u',
            'ž'=>'z',
            // Polish
            'Ą'=>'A', 'Ć'=>'C', 'Ę'=>'e', 'Ł'=>'L', 'Ń'=>'N', 'Ó'=>'o', 'Ś'=>'S', 'Ź'=>'Z',
            'Ż'=>'Z',
            'ą'=>'a', 'ć'=>'c', 'ę'=>'e', 'ł'=>'l', 'ń'=>'n', 'ó'=>'o', 'ś'=>'s', 'ź'=>'z',
            'ż'=>'z',
            // Latvian
            'Ā'=>'A', 'Č'=>'C', 'Ē'=>'E', 'Ģ'=>'G', 'Ī'=>'i', 'Ķ'=>'k', 'Ļ'=>'L', 'Ņ'=>'N',
            'Š'=>'S', 'Ū'=>'u', 'Ž'=>'Z',
            'ā'=>'a', 'č'=>'c', 'ē'=>'e', 'ģ'=>'g', 'ī'=>'i', 'ķ'=>'k', 'ļ'=>'l', 'ņ'=>'n',
            'š'=>'s', 'ū'=>'u', 'ž'=>'z'
        ];
        return strtr($str, $patern);
    } 
 | 
	php 
 | 
	public static function translitIt(string $str) : string
    {
        $patern = [
            // Latin
            'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'AE', 'Ç'=>'C',
            'È'=>'E', 'É'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I',
            'Ð'=>'D', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ő'=>'O',
            'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ű'=>'U', 'Ý'=>'Y', 'Þ'=>'TH',
            'ß'=>'ss',
            'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'ae', 'ç'=>'c',
            'è'=>'e', 'é'=>'e', 'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i',
            'ð'=>'d', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ő'=>'o',
            'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ü'=>'u', 'ű'=>'u', 'ý'=>'y', 'þ'=>'th',
            'ÿ'=>'y',
            // Latin symbols
            '©'=>'(c)',
            // Greek
            'Α'=>'A', 'Β'=>'B', 'Γ'=>'G', 'Δ'=>'D', 'Ε'=>'E', 'Ζ'=>'Z', 'Η'=>'H', 'Θ'=>'8',
            'Ι'=>'I', 'Κ'=>'K', 'Λ'=>'L', 'Μ'=>'M', 'Ν'=>'N', 'Ξ'=>'3', 'Ο'=>'O', 'Π'=>'P',
            'Ρ'=>'R', 'Σ'=>'S', 'Τ'=>'T', 'Υ'=>'Y', 'Φ'=>'F', 'Χ'=>'X', 'Ψ'=>'PS', 'Ω'=>'W',
            'Ά'=>'A', 'Έ'=>'E', 'Ί'=>'I', 'Ό'=>'O', 'Ύ'=>'Y', 'Ή'=>'H', 'Ώ'=>'W', 'Ϊ'=>'I',
            'Ϋ'=>'Y',
            'α'=>'a', 'β'=>'b', 'γ'=>'g', 'δ'=>'d', 'ε'=>'e', 'ζ'=>'z', 'η'=>'h', 'θ'=>'8',
            'ι'=>'i', 'κ'=>'k', 'λ'=>'l', 'μ'=>'m', 'ν'=>'n', 'ξ'=>'3', 'ο'=>'o', 'π'=>'p',
            'ρ'=>'r', 'σ'=>'s', 'τ'=>'t', 'υ'=>'y', 'φ'=>'f', 'χ'=>'x', 'ψ'=>'ps', 'ω'=>'w',
            'ά'=>'a', 'έ'=>'e', 'ί'=>'i', 'ό'=>'o', 'ύ'=>'y', 'ή'=>'h', 'ώ'=>'w', 'ς'=>'s',
            'ϊ'=>'i', 'ΰ'=>'y', 'ϋ'=>'y', 'ΐ'=>'i',
            // Turkish
            'Ş'=>'S', 'İ'=>'I', 'Ç'=>'C', 'Ü'=>'U', 'Ö'=>'O', 'Ğ'=>'G',
            'ş'=>'s', 'ı'=>'i', 'ç'=>'c', 'ü'=>'u', 'ö'=>'o', 'ğ'=>'g',
            // Russian
            'А'=>'A', 'Б'=>'B', 'В'=>'V', 'Г'=>'G', 'Д'=>'D', 'Е'=>'E', 'Ё'=>'Yo', 'Ж'=>'Zh',
            'З'=>'Z', 'И'=>'I', 'Й'=>'J', 'К'=>'K', 'Л'=>'L', 'М'=>'M', 'Н'=>'N', 'О'=>'O',
            'П'=>'P', 'Р'=>'R', 'С'=>'S', 'Т'=>'T', 'У'=>'U', 'Ф'=>'F', 'Х'=>'H', 'Ц'=>'C',
            'Ч'=>'Ch', 'Ш'=>'Sh', 'Щ'=>'Sh', 'Ъ'=>'', 'Ы'=>'Y', 'Ь'=>'', 'Э'=>'E', 'Ю'=>'Yu',
            'Я'=>'Ya',
            'а'=>'a', 'б'=>'b', 'в'=>'v', 'г'=>'g', 'д'=>'d', 'е'=>'e', 'ё'=>'yo', 'ж'=>'zh',
            'з'=>'z', 'и'=>'i', 'й'=>'j', 'к'=>'k', 'л'=>'l', 'м'=>'m', 'н'=>'n', 'о'=>'o',
            'п'=>'p', 'р'=>'r', 'с'=>'s', 'т'=>'t', 'у'=>'u', 'ф'=>'f', 'х'=>'h', 'ц'=>'c',
            'ч'=>'ch', 'ш'=>'sh', 'щ'=>'sh', 'ъ'=>'', 'ы'=>'y', 'ь'=>'', 'э'=>'e', 'ю'=>'yu',
            'я'=>'ya',
            // Bulgarian
            'А'=>'A', 'Б'=>'B', 'В'=>'V', 'Г'=>'G', 'Д'=>'D', 'Е'=>'E', 'Ж'=>'Zh', 'З'=>'Z',
            'И'=>'I', 'Й'=>'J', 'К'=>'K', 'Л'=>'L', 'М'=>'M', 'Н'=>'N', 'О'=>'O', 'П'=>'P',
            'Р'=>'R', 'С'=>'S', 'Т'=>'T', 'У'=>'U', 'Ф'=>'F', 'Х'=>'H', 'Ц'=>'C', 'Ч'=>'Ch',
            'Ш'=>'Sh', 'Щ'=>'Sh', 'Ъ'=>'',	'Ь'=>'J','Ю'=>'Yu','Я'=>'Ya',
            'а'=>'a', 'б'=>'b', 'в'=>'v', 'г'=>'g', 'д'=>'d', 'е'=>'e', 'ж'=>'zh','з'=>'z',
            'и'=>'i', 'й'=>'j', 'к'=>'k', 'л'=>'l', 'м'=>'m', 'н'=>'n', 'о'=>'o','п'=>'p',
            'р'=>'r', 'с'=>'s', 'т'=>'t', 'у'=>'u', 'ф'=>'f', 'х'=>'h', 'ц'=>'c', 'ч'=>'ch',
            'ш'=>'sh', 'щ'=>'sh', 'ъ'=>'', 'ь'=>'j', 'ю'=>'yu', 'я'=>'ya',
            // Ukrainian
            'Є'=>'Ye', 'І'=>'I', 'Ї'=>'Yi', 'Ґ'=>'G',
            'є'=>'ye', 'і'=>'i', 'ї'=>'yi', 'ґ'=>'g',
            // Czech
            'Č'=>'C', 'Ď'=>'D', 'Ě'=>'E', 'Ň'=>'N', 'Ř'=>'R', 'Š'=>'S', 'Ť'=>'T', 'Ů'=>'U',
            'Ž'=>'Z',
            'č'=>'c', 'ď'=>'d', 'ě'=>'e', 'ň'=>'n', 'ř'=>'r', 'š'=>'s', 'ť'=>'t', 'ů'=>'u',
            'ž'=>'z',
            // Polish
            'Ą'=>'A', 'Ć'=>'C', 'Ę'=>'e', 'Ł'=>'L', 'Ń'=>'N', 'Ó'=>'o', 'Ś'=>'S', 'Ź'=>'Z',
            'Ż'=>'Z',
            'ą'=>'a', 'ć'=>'c', 'ę'=>'e', 'ł'=>'l', 'ń'=>'n', 'ó'=>'o', 'ś'=>'s', 'ź'=>'z',
            'ż'=>'z',
            // Latvian
            'Ā'=>'A', 'Č'=>'C', 'Ē'=>'E', 'Ģ'=>'G', 'Ī'=>'i', 'Ķ'=>'k', 'Ļ'=>'L', 'Ņ'=>'N',
            'Š'=>'S', 'Ū'=>'u', 'Ž'=>'Z',
            'ā'=>'a', 'č'=>'c', 'ē'=>'e', 'ģ'=>'g', 'ī'=>'i', 'ķ'=>'k', 'ļ'=>'l', 'ņ'=>'n',
            'š'=>'s', 'ū'=>'u', 'ž'=>'z'
        ];
        return strtr($str, $patern);
    } 
 | 
	[
  "public",
  "static",
  "function",
  "translitIt",
  "(",
  "string",
  "$",
  "str",
  ")",
  ":",
  "string",
  "{",
  "$",
  "patern",
  "=",
  "[",
  "// Latin",
  "'À'=",
  ">'",
  "A',",
  " ",
  "Á'=>",
  "'A",
  "', ",
  "'",
  "'=>'",
  "A'",
  ", '",
  "Ã",
  "=>'A",
  "',",
  " 'Ä",
  "'",
  ">'A'",
  ", ",
  "'Å'",
  "=",
  "'A',",
  " '",
  "Æ'=",
  ">",
  "AE',",
  " '",
  "Ç'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'È'=",
  ">'",
  "E',",
  " ",
  "É'=>",
  "'E",
  "', ",
  "'",
  "'=>'",
  "E'",
  ", '",
  "Ë",
  "=>'E",
  "',",
  " 'Ì",
  "'",
  ">'I'",
  ", ",
  "'Í'",
  "=",
  "'I',",
  " '",
  "Î'=",
  ">",
  "I', ",
  "'Ï",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Ð'=",
  ">'",
  "D',",
  " ",
  "Ñ'=>",
  "'N",
  "', ",
  "'",
  "'=>'",
  "O'",
  ", '",
  "Ó",
  "=>'O",
  "',",
  " 'Ô",
  "'",
  ">'O'",
  ", ",
  "'Õ'",
  "=",
  "'O',",
  " '",
  "Ö'=",
  ">",
  "O', ",
  "'Ő",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Ø'=",
  ">'",
  "O',",
  " ",
  "Ù'=>",
  "'U",
  "', ",
  "'",
  "'=>'",
  "U'",
  ", '",
  "Û",
  "=>'U",
  "',",
  " 'Ü",
  "'",
  ">'U'",
  ", ",
  "'Ű'",
  "=",
  "'U',",
  " '",
  "Ý'=",
  ">",
  "Y', ",
  "'Þ",
  "'=>",
  "'",
  "H',",
  "",
  "",
  "",
  "'ß'=",
  ">'",
  "ss',",
  "",
  "'à'=",
  ">'",
  "a',",
  " ",
  "á'=>",
  "'a",
  "', ",
  "'",
  "'=>'",
  "a'",
  ", '",
  "ã",
  "=>'a",
  "',",
  " 'ä",
  "'",
  ">'a'",
  ", ",
  "'å'",
  "=",
  "'a',",
  " '",
  "æ'=",
  ">",
  "ae',",
  " '",
  "ç'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'è'=",
  ">'",
  "e',",
  " ",
  "é'=>",
  "'e",
  "', ",
  "'",
  "'=>'",
  "e'",
  ", '",
  "ë",
  "=>'e",
  "',",
  " 'ì",
  "'",
  ">'i'",
  ", ",
  "'í'",
  "=",
  "'i',",
  " '",
  "î'=",
  ">",
  "i', ",
  "'ï",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'ð'=",
  ">'",
  "d',",
  " ",
  "ñ'=>",
  "'n",
  "', ",
  "'",
  "'=>'",
  "o'",
  ", '",
  "ó",
  "=>'o",
  "',",
  " 'ô",
  "'",
  ">'o'",
  ", ",
  "'õ'",
  "=",
  "'o',",
  " '",
  "ö'=",
  ">",
  "o', ",
  "'ő",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'ø'=",
  ">'",
  "o',",
  " ",
  "ù'=>",
  "'u",
  "', ",
  "'",
  "'=>'",
  "u'",
  ", '",
  "û",
  "=>'u",
  "',",
  " 'ü",
  "'",
  ">'u'",
  ", ",
  "'ű'",
  "=",
  "'u',",
  " '",
  "ý'=",
  ">",
  "y', ",
  "'þ",
  "'=>",
  "'",
  "h',",
  "",
  "",
  "",
  "'ÿ'=",
  ">'",
  "y',",
  "",
  "// Latin symbols",
  "'©'=",
  ">'",
  "(c)',",
  "",
  "// Greek",
  "'Α'=",
  ">'",
  "A',",
  " ",
  "Β'=>",
  "'B",
  "', ",
  "'",
  "'=>'",
  "G'",
  ", '",
  "Δ",
  "=>'D",
  "',",
  " 'Ε",
  "'",
  ">'E'",
  ", ",
  "'Ζ'",
  "=",
  "'Z',",
  " '",
  "Η'=",
  ">",
  "H', ",
  "'Θ",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Ι'=",
  ">'",
  "I',",
  " ",
  "Κ'=>",
  "'K",
  "', ",
  "'",
  "'=>'",
  "L'",
  ", '",
  "Μ",
  "=>'M",
  "',",
  " 'Ν",
  "'",
  ">'N'",
  ", ",
  "'Ξ'",
  "=",
  "'3',",
  " '",
  "Ο'=",
  ">",
  "O', ",
  "'Π",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Ρ'=",
  ">'",
  "R',",
  " ",
  "Σ'=>",
  "'S",
  "', ",
  "'",
  "'=>'",
  "T'",
  ", '",
  "Υ",
  "=>'Y",
  "',",
  " 'Φ",
  "'",
  ">'F'",
  ", ",
  "'Χ'",
  "=",
  "'X',",
  " '",
  "Ψ'=",
  ">",
  "PS',",
  " '",
  "Ω'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Ά'=",
  ">'",
  "A',",
  " ",
  "Έ'=>",
  "'E",
  "', ",
  "'",
  "'=>'",
  "I'",
  ", '",
  "Ό",
  "=>'O",
  "',",
  " 'Ύ",
  "'",
  ">'Y'",
  ", ",
  "'Ή'",
  "=",
  "'H',",
  " '",
  "Ώ'=",
  ">",
  "W', ",
  "'Ϊ",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Ϋ'=",
  ">'",
  "Y',",
  "",
  "'α'=",
  ">'",
  "a',",
  " ",
  "β'=>",
  "'b",
  "', ",
  "'",
  "'=>'",
  "g'",
  ", '",
  "δ",
  "=>'d",
  "',",
  " 'ε",
  "'",
  ">'e'",
  ", ",
  "'ζ'",
  "=",
  "'z',",
  " '",
  "η'=",
  ">",
  "h', ",
  "'θ",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'ι'=",
  ">'",
  "i',",
  " ",
  "κ'=>",
  "'k",
  "', ",
  "'",
  "'=>'",
  "l'",
  ", '",
  "μ",
  "=>'m",
  "',",
  " 'ν",
  "'",
  ">'n'",
  ", ",
  "'ξ'",
  "=",
  "'3',",
  " '",
  "ο'=",
  ">",
  "o', ",
  "'π",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'ρ'=",
  ">'",
  "r',",
  " ",
  "σ'=>",
  "'s",
  "', ",
  "'",
  "'=>'",
  "t'",
  ", '",
  "υ",
  "=>'y",
  "',",
  " 'φ",
  "'",
  ">'f'",
  ", ",
  "'χ'",
  "=",
  "'x',",
  " '",
  "ψ'=",
  ">",
  "ps',",
  " '",
  "ω'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'ά'=",
  ">'",
  "a',",
  " ",
  "έ'=>",
  "'e",
  "', ",
  "'",
  "'=>'",
  "i'",
  ", '",
  "ό",
  "=>'o",
  "',",
  " 'ύ",
  "'",
  ">'y'",
  ", ",
  "'ή'",
  "=",
  "'h',",
  " '",
  "ώ'=",
  ">",
  "w', ",
  "'ς",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'ϊ'=",
  ">'",
  "i',",
  " ",
  "ΰ'=>",
  "'y",
  "', ",
  "'",
  "'=>'",
  "y'",
  ", '",
  "ΐ",
  "=>'i",
  "',",
  "",
  "",
  "// Turkish",
  "'Ş'=",
  ">'",
  "S',",
  " ",
  "İ'=>",
  "'I",
  "', ",
  "'",
  "'=>'",
  "C'",
  ", '",
  "Ü",
  "=>'U",
  "',",
  " 'Ö",
  "'",
  ">'O'",
  ", ",
  "'Ğ'",
  "=",
  "'G',",
  "",
  "",
  "",
  "'ş'=",
  ">'",
  "s',",
  " ",
  "ı'=>",
  "'i",
  "', ",
  "'",
  "'=>'",
  "c'",
  ", '",
  "ü",
  "=>'u",
  "',",
  " 'ö",
  "'",
  ">'o'",
  ", ",
  "'ğ'",
  "=",
  "'g',",
  "",
  "",
  "",
  "// Russian",
  "'А'=",
  ">'",
  "A',",
  " ",
  "Б'=>",
  "'B",
  "', ",
  "'",
  "'=>'",
  "V'",
  ", '",
  "Г",
  "=>'G",
  "',",
  " 'Д",
  "'",
  ">'D'",
  ", ",
  "'Е'",
  "=",
  "'E',",
  " '",
  "Ё'=",
  ">",
  "Yo',",
  " '",
  "Ж'=>",
  "'",
  "h',",
  "",
  "",
  "",
  "'З'=",
  ">'",
  "Z',",
  " ",
  "И'=>",
  "'I",
  "', ",
  "'",
  "'=>'",
  "J'",
  ", '",
  "К",
  "=>'K",
  "',",
  " 'Л",
  "'",
  ">'L'",
  ", ",
  "'М'",
  "=",
  "'M',",
  " '",
  "Н'=",
  ">",
  "N', ",
  "'О",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'П'=",
  ">'",
  "P',",
  " ",
  "Р'=>",
  "'R",
  "', ",
  "'",
  "'=>'",
  "S'",
  ", '",
  "Т",
  "=>'T",
  "',",
  " 'У",
  "'",
  ">'U'",
  ", ",
  "'Ф'",
  "=",
  "'F',",
  " '",
  "Х'=",
  ">",
  "H', ",
  "'Ц",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Ч'=",
  ">'",
  "Ch',",
  " ",
  "Ш'=>",
  "'S",
  "h', ",
  "'",
  "'=>'",
  "Sh",
  "', '",
  "Ъ",
  "=>''",
  ", ",
  "'Ы",
  "'",
  ">'Y'",
  ", ",
  "'Ь'",
  "=",
  "'', ",
  "'Э",
  "'=",
  ">",
  "E', ",
  "'Ю",
  "'=>",
  "'",
  "u',",
  "",
  "",
  "",
  "'Я'=",
  ">'",
  "Ya',",
  "",
  "'а'=",
  ">'",
  "a',",
  " ",
  "б'=>",
  "'b",
  "', ",
  "'",
  "'=>'",
  "v'",
  ", '",
  "г",
  "=>'g",
  "',",
  " 'д",
  "'",
  ">'d'",
  ", ",
  "'е'",
  "=",
  "'e',",
  " '",
  "ё'=",
  ">",
  "yo',",
  " '",
  "ж'=>",
  "'",
  "h',",
  "",
  "",
  "",
  "'з'=",
  ">'",
  "z',",
  " ",
  "и'=>",
  "'i",
  "', ",
  "'",
  "'=>'",
  "j'",
  ", '",
  "к",
  "=>'k",
  "',",
  " 'л",
  "'",
  ">'l'",
  ", ",
  "'м'",
  "=",
  "'m',",
  " '",
  "н'=",
  ">",
  "n', ",
  "'о",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'п'=",
  ">'",
  "p',",
  " ",
  "р'=>",
  "'r",
  "', ",
  "'",
  "'=>'",
  "s'",
  ", '",
  "т",
  "=>'t",
  "',",
  " 'у",
  "'",
  ">'u'",
  ", ",
  "'ф'",
  "=",
  "'f',",
  " '",
  "х'=",
  ">",
  "h', ",
  "'ц",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'ч'=",
  ">'",
  "ch',",
  " ",
  "ш'=>",
  "'s",
  "h', ",
  "'",
  "'=>'",
  "sh",
  "', '",
  "ъ",
  "=>''",
  ", ",
  "'ы",
  "'",
  ">'y'",
  ", ",
  "'ь'",
  "=",
  "'', ",
  "'э",
  "'=",
  ">",
  "e', ",
  "'ю",
  "'=>",
  "'",
  "u',",
  "",
  "",
  "",
  "'я'=",
  ">'",
  "ya',",
  "",
  "// Bulgarian",
  "'А'=",
  ">'",
  "A',",
  " ",
  "Б'=>",
  "'B",
  "', ",
  "'",
  "'=>'",
  "V'",
  ", '",
  "Г",
  "=>'G",
  "',",
  " 'Д",
  "'",
  ">'D'",
  ", ",
  "'Е'",
  "=",
  "'E',",
  " '",
  "Ж'=",
  ">",
  "Zh',",
  " '",
  "З'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'И'=",
  ">'",
  "I',",
  " ",
  "Й'=>",
  "'J",
  "', ",
  "'",
  "'=>'",
  "K'",
  ", '",
  "Л",
  "=>'L",
  "',",
  " 'М",
  "'",
  ">'M'",
  ", ",
  "'Н'",
  "=",
  "'N',",
  " '",
  "О'=",
  ">",
  "O', ",
  "'П",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Р'=",
  ">'",
  "R',",
  " ",
  "С'=>",
  "'S",
  "', ",
  "'",
  "'=>'",
  "T'",
  ", '",
  "У",
  "=>'U",
  "',",
  " 'Ф",
  "'",
  ">'F'",
  ", ",
  "'Х'",
  "=",
  "'H',",
  " '",
  "Ц'=",
  ">",
  "C', ",
  "'Ч",
  "'=>",
  "'",
  "h',",
  "",
  "",
  "",
  "'Ш'=",
  ">'",
  "Sh',",
  " ",
  "Щ'=>",
  "'S",
  "h', ",
  "'",
  "'=>'",
  "',",
  "\t'",
  "Ь",
  "=>'J",
  "',",
  "'Ю'",
  "=",
  ">'Yu",
  "',",
  "'Я'=",
  ">",
  "'Ya'",
  ",",
  "",
  "",
  "'а'=",
  ">'",
  "a',",
  " ",
  "б'=>",
  "'b",
  "', ",
  "'",
  "'=>'",
  "v'",
  ", '",
  "г",
  "=>'g",
  "',",
  " 'д",
  "'",
  ">'d'",
  ", ",
  "'е'",
  "=",
  "'e',",
  " '",
  "ж'=",
  ">",
  "zh',",
  "'з",
  "'=>'",
  "z",
  "',",
  "",
  "",
  "",
  "'и'=",
  ">'",
  "i',",
  " ",
  "й'=>",
  "'j",
  "', ",
  "'",
  "'=>'",
  "k'",
  ", '",
  "л",
  "=>'l",
  "',",
  " 'м",
  "'",
  ">'m'",
  ", ",
  "'н'",
  "=",
  "'n',",
  " '",
  "о'=",
  ">",
  "o','",
  "п'",
  "=>'",
  "p",
  "',",
  "",
  "",
  "",
  "'р'=",
  ">'",
  "r',",
  " ",
  "с'=>",
  "'s",
  "', ",
  "'",
  "'=>'",
  "t'",
  ", '",
  "у",
  "=>'u",
  "',",
  " 'ф",
  "'",
  ">'f'",
  ", ",
  "'х'",
  "=",
  "'h',",
  " '",
  "ц'=",
  ">",
  "c', ",
  "'ч",
  "'=>",
  "'",
  "h',",
  "",
  "",
  "",
  "'ш'=",
  ">'",
  "sh',",
  " ",
  "щ'=>",
  "'s",
  "h', ",
  "'",
  "'=>'",
  "',",
  " '",
  "ь",
  "=>'j",
  "',",
  " 'ю",
  "'",
  ">'yu",
  "',",
  " 'я'",
  "=",
  "'ya'",
  ",",
  "",
  "",
  "// Ukrainian",
  "'Є'=",
  ">'",
  "Ye',",
  " ",
  "І'=>",
  "'I",
  "', ",
  "'",
  "'=>'",
  "Yi",
  "', '",
  "Ґ",
  "=>'G",
  "',",
  "",
  "",
  "'є'=",
  ">'",
  "ye',",
  " ",
  "і'=>",
  "'i",
  "', ",
  "'",
  "'=>'",
  "yi",
  "', '",
  "ґ",
  "=>'g",
  "',",
  "",
  "",
  "// Czech",
  "'Č'=",
  ">'",
  "C',",
  " ",
  "Ď'=>",
  "'D",
  "', ",
  "'",
  "'=>'",
  "E'",
  ", '",
  "Ň",
  "=>'N",
  "',",
  " 'Ř",
  "'",
  ">'R'",
  ", ",
  "'Š'",
  "=",
  "'S',",
  " '",
  "Ť'=",
  ">",
  "T', ",
  "'Ů",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Ž'=",
  ">'",
  "Z',",
  "",
  "'č'=",
  ">'",
  "c',",
  " ",
  "ď'=>",
  "'d",
  "', ",
  "'",
  "'=>'",
  "e'",
  ", '",
  "ň",
  "=>'n",
  "',",
  " 'ř",
  "'",
  ">'r'",
  ", ",
  "'š'",
  "=",
  "'s',",
  " '",
  "ť'=",
  ">",
  "t', ",
  "'ů",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'ž'=",
  ">'",
  "z',",
  "",
  "// Polish",
  "'Ą'=",
  ">'",
  "A',",
  " ",
  "Ć'=>",
  "'C",
  "', ",
  "'",
  "'=>'",
  "e'",
  ", '",
  "Ł",
  "=>'L",
  "',",
  " 'Ń",
  "'",
  ">'N'",
  ", ",
  "'Ó'",
  "=",
  "'o',",
  " '",
  "Ś'=",
  ">",
  "S', ",
  "'Ź",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Ż'=",
  ">'",
  "Z',",
  "",
  "'ą'=",
  ">'",
  "a',",
  " ",
  "ć'=>",
  "'c",
  "', ",
  "'",
  "'=>'",
  "e'",
  ", '",
  "ł",
  "=>'l",
  "',",
  " 'ń",
  "'",
  ">'n'",
  ", ",
  "'ó'",
  "=",
  "'o',",
  " '",
  "ś'=",
  ">",
  "s', ",
  "'ź",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'ż'=",
  ">'",
  "z',",
  "",
  "// Latvian",
  "'Ā'=",
  ">'",
  "A',",
  " ",
  "Č'=>",
  "'C",
  "', ",
  "'",
  "'=>'",
  "E'",
  ", '",
  "Ģ",
  "=>'G",
  "',",
  " 'Ī",
  "'",
  ">'i'",
  ", ",
  "'Ķ'",
  "=",
  "'k',",
  " '",
  "Ļ'=",
  ">",
  "L', ",
  "'Ņ",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'Š'=",
  ">'",
  "S',",
  " ",
  "Ū'=>",
  "'u",
  "', ",
  "'",
  "'=>'",
  "Z'",
  ",",
  "",
  "'ā'=",
  ">'",
  "a',",
  " ",
  "č'=>",
  "'c",
  "', ",
  "'",
  "'=>'",
  "e'",
  ", '",
  "ģ",
  "=>'g",
  "',",
  " 'ī",
  "'",
  ">'i'",
  ", ",
  "'ķ'",
  "=",
  "'k',",
  " '",
  "ļ'=",
  ">",
  "l', ",
  "'ņ",
  "'=>",
  "'",
  "',",
  "",
  "",
  "",
  "'š'=",
  ">'",
  "s',",
  " ",
  "ū'=>",
  "'u",
  "', ",
  "'",
  "'=>'",
  "z'",
  "",
  "]",
  ";",
  "return",
  "strtr",
  "(",
  "$",
  "str",
  ",",
  "$",
  "patern",
  ")",
  ";",
  "}"
]  | 
	Translit function to convert text from one script to another.
echo Text::translitIt('Привет');
@param  string $str string
@return string $str 
 | 
	[
  "Translit",
  "function",
  "to",
  "convert",
  "text",
  "from",
  "one",
  "script",
  "to",
  "another",
  "."
]  | 
	train 
 | 
	https://github.com/flextype-components/text/blob/8d707eec2dd9025cb17ae3b0c3e995e67580ece3/Text.php#L25-L106 
 | 
					
	flextype-components/text 
 | 
	Text.php 
 | 
	Text.random 
 | 
	public static function random(string $type = 'alnum', int $length = 16) : string
    {
        switch ($type) {
            case 'basic':
                return mt_rand();
            break;
            default:
                case 'alnum':
                case 'numeric':
                case 'nozero':
                case 'alpha':
                case 'distinct':
                case 'hexdec':
                    switch ($type) {
                        case 'alpha':
                            $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
                        break;
                        default:
                        case 'alnum':
                            $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
                        break;
                        case 'numeric':
                            $pool = '0123456789';
                        break;
                        case 'nozero':
                            $pool = '123456789';
                        break;
                        case 'distinct':
                            $pool = '2345679ACDEFHJKLMNPRSTUVWXYZ';
                        break;
                        case 'hexdec':
                            $pool = '0123456789abcdef';
                        break;
                    }
                    $str = '';
                    for ($i=0; $i < $length; $i++) {
                        $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
                    }
                    return $str;
                break;
            case 'unique':
                return md5(uniqid(mt_rand()));
            break;
            case 'sha1' :
                return sha1(uniqid(mt_rand(), true));
            break;
        }
    } 
 | 
	php 
 | 
	public static function random(string $type = 'alnum', int $length = 16) : string
    {
        switch ($type) {
            case 'basic':
                return mt_rand();
            break;
            default:
                case 'alnum':
                case 'numeric':
                case 'nozero':
                case 'alpha':
                case 'distinct':
                case 'hexdec':
                    switch ($type) {
                        case 'alpha':
                            $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
                        break;
                        default:
                        case 'alnum':
                            $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
                        break;
                        case 'numeric':
                            $pool = '0123456789';
                        break;
                        case 'nozero':
                            $pool = '123456789';
                        break;
                        case 'distinct':
                            $pool = '2345679ACDEFHJKLMNPRSTUVWXYZ';
                        break;
                        case 'hexdec':
                            $pool = '0123456789abcdef';
                        break;
                    }
                    $str = '';
                    for ($i=0; $i < $length; $i++) {
                        $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1);
                    }
                    return $str;
                break;
            case 'unique':
                return md5(uniqid(mt_rand()));
            break;
            case 'sha1' :
                return sha1(uniqid(mt_rand(), true));
            break;
        }
    } 
 | 
	[
  "public",
  "static",
  "function",
  "random",
  "(",
  "string",
  "$",
  "type",
  "=",
  "'alnum'",
  ",",
  "int",
  "$",
  "length",
  "=",
  "16",
  ")",
  ":",
  "string",
  "{",
  "switch",
  "(",
  "$",
  "type",
  ")",
  "{",
  "case",
  "'basic'",
  ":",
  "return",
  "mt_rand",
  "(",
  ")",
  ";",
  "break",
  ";",
  "default",
  ":",
  "case",
  "'alnum'",
  ":",
  "case",
  "'numeric'",
  ":",
  "case",
  "'nozero'",
  ":",
  "case",
  "'alpha'",
  ":",
  "case",
  "'distinct'",
  ":",
  "case",
  "'hexdec'",
  ":",
  "switch",
  "(",
  "$",
  "type",
  ")",
  "{",
  "case",
  "'alpha'",
  ":",
  "$",
  "pool",
  "=",
  "'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'",
  ";",
  "break",
  ";",
  "default",
  ":",
  "case",
  "'alnum'",
  ":",
  "$",
  "pool",
  "=",
  "'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'",
  ";",
  "break",
  ";",
  "case",
  "'numeric'",
  ":",
  "$",
  "pool",
  "=",
  "'0123456789'",
  ";",
  "break",
  ";",
  "case",
  "'nozero'",
  ":",
  "$",
  "pool",
  "=",
  "'123456789'",
  ";",
  "break",
  ";",
  "case",
  "'distinct'",
  ":",
  "$",
  "pool",
  "=",
  "'2345679ACDEFHJKLMNPRSTUVWXYZ'",
  ";",
  "break",
  ";",
  "case",
  "'hexdec'",
  ":",
  "$",
  "pool",
  "=",
  "'0123456789abcdef'",
  ";",
  "break",
  ";",
  "}",
  "$",
  "str",
  "=",
  "''",
  ";",
  "for",
  "(",
  "$",
  "i",
  "=",
  "0",
  ";",
  "$",
  "i",
  "<",
  "$",
  "length",
  ";",
  "$",
  "i",
  "++",
  ")",
  "{",
  "$",
  "str",
  ".=",
  "substr",
  "(",
  "$",
  "pool",
  ",",
  "mt_rand",
  "(",
  "0",
  ",",
  "strlen",
  "(",
  "$",
  "pool",
  ")",
  "-",
  "1",
  ")",
  ",",
  "1",
  ")",
  ";",
  "}",
  "return",
  "$",
  "str",
  ";",
  "break",
  ";",
  "case",
  "'unique'",
  ":",
  "return",
  "md5",
  "(",
  "uniqid",
  "(",
  "mt_rand",
  "(",
  ")",
  ")",
  ")",
  ";",
  "break",
  ";",
  "case",
  "'sha1'",
  ":",
  "return",
  "sha1",
  "(",
  "uniqid",
  "(",
  "mt_rand",
  "(",
  ")",
  ",",
  "true",
  ")",
  ")",
  ";",
  "break",
  ";",
  "}",
  "}"
]  | 
	Creates a random string of characters
echo Text::random();
@param  string  $type   The type of string. Default is 'alnum'
@param  integer $length The number of characters. Default is 16
@return string 
 | 
	[
  "Creates",
  "a",
  "random",
  "string",
  "of",
  "characters"
]  | 
	train 
 | 
	https://github.com/flextype-components/text/blob/8d707eec2dd9025cb17ae3b0c3e995e67580ece3/Text.php#L169-L227 
 | 
					
	flextype-components/text 
 | 
	Text.php 
 | 
	Text.increment 
 | 
	public static function increment(string $str, int $first = 1, string $separator = '_') : string
    {
        preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match);
        return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first;
    } 
 | 
	php 
 | 
	public static function increment(string $str, int $first = 1, string $separator = '_') : string
    {
        preg_match('/(.+)'.$separator.'([0-9]+)$/', $str, $match);
        return isset($match[2]) ? $match[1].$separator.($match[2] + 1) : $str.$separator.$first;
    } 
 | 
	[
  "public",
  "static",
  "function",
  "increment",
  "(",
  "string",
  "$",
  "str",
  ",",
  "int",
  "$",
  "first",
  "=",
  "1",
  ",",
  "string",
  "$",
  "separator",
  "=",
  "'_'",
  ")",
  ":",
  "string",
  "{",
  "preg_match",
  "(",
  "'/(.+)'",
  ".",
  "$",
  "separator",
  ".",
  "'([0-9]+)$/'",
  ",",
  "$",
  "str",
  ",",
  "$",
  "match",
  ")",
  ";",
  "return",
  "isset",
  "(",
  "$",
  "match",
  "[",
  "2",
  "]",
  ")",
  "?",
  "$",
  "match",
  "[",
  "1",
  "]",
  ".",
  "$",
  "separator",
  ".",
  "(",
  "$",
  "match",
  "[",
  "2",
  "]",
  "+",
  "1",
  ")",
  ":",
  "$",
  "str",
  ".",
  "$",
  "separator",
  ".",
  "$",
  "first",
  ";",
  "}"
]  | 
	Add's _1 to a string or increment the ending number to allow _2, _3, etc
$str = Text::increment($str);
@param  string  $str       String to increment
@param  int     $first     Start with
@param  string  $separator Separator
@return string 
 | 
	[
  "Add",
  "s",
  "_1",
  "to",
  "a",
  "string",
  "or",
  "increment",
  "the",
  "ending",
  "number",
  "to",
  "allow",
  "_2",
  "_3",
  "etc"
]  | 
	train 
 | 
	https://github.com/flextype-components/text/blob/8d707eec2dd9025cb17ae3b0c3e995e67580ece3/Text.php#L239-L244 
 | 
					
	flextype-components/text 
 | 
	Text.php 
 | 
	Text.cut 
 | 
	public static function cut(string $str, int $length, string $cut_msg = null) : string
    {
        if (isset($cut_msg)) $msg = $cut_msg; else $msg = '...';
        return function_exists('mb_substr') ? mb_substr($str, 0, $length, 'utf-8') . $msg : substr($str, 0, $length) . $msg;
    } 
 | 
	php 
 | 
	public static function cut(string $str, int $length, string $cut_msg = null) : string
    {
        if (isset($cut_msg)) $msg = $cut_msg; else $msg = '...';
        return function_exists('mb_substr') ? mb_substr($str, 0, $length, 'utf-8') . $msg : substr($str, 0, $length) . $msg;
    } 
 | 
	[
  "public",
  "static",
  "function",
  "cut",
  "(",
  "string",
  "$",
  "str",
  ",",
  "int",
  "$",
  "length",
  ",",
  "string",
  "$",
  "cut_msg",
  "=",
  "null",
  ")",
  ":",
  "string",
  "{",
  "if",
  "(",
  "isset",
  "(",
  "$",
  "cut_msg",
  ")",
  ")",
  "$",
  "msg",
  "=",
  "$",
  "cut_msg",
  ";",
  "else",
  "$",
  "msg",
  "=",
  "'...'",
  ";",
  "return",
  "function_exists",
  "(",
  "'mb_substr'",
  ")",
  "?",
  "mb_substr",
  "(",
  "$",
  "str",
  ",",
  "0",
  ",",
  "$",
  "length",
  ",",
  "'utf-8'",
  ")",
  ".",
  "$",
  "msg",
  ":",
  "substr",
  "(",
  "$",
  "str",
  ",",
  "0",
  ",",
  "$",
  "length",
  ")",
  ".",
  "$",
  "msg",
  ";",
  "}"
]  | 
	Cut string
echo Text::cut('Some text here', 5);
@param  string  $str     Input string
@param  int     $length  Length after cut
@param  string  $cut_msg Message after cut string
@return string 
 | 
	[
  "Cut",
  "string"
]  | 
	train 
 | 
	https://github.com/flextype-components/text/blob/8d707eec2dd9025cb17ae3b0c3e995e67580ece3/Text.php#L256-L260 
 | 
					
	flextype-components/text 
 | 
	Text.php 
 | 
	Text.right 
 | 
	public static function right(string $str, int $num) : string
    {
        return substr($str, Text::length($str)-$num, $num);
    } 
 | 
	php 
 | 
	public static function right(string $str, int $num) : string
    {
        return substr($str, Text::length($str)-$num, $num);
    } 
 | 
	[
  "public",
  "static",
  "function",
  "right",
  "(",
  "string",
  "$",
  "str",
  ",",
  "int",
  "$",
  "num",
  ")",
  ":",
  "string",
  "{",
  "return",
  "substr",
  "(",
  "$",
  "str",
  ",",
  "Text",
  "::",
  "length",
  "(",
  "$",
  "str",
  ")",
  "-",
  "$",
  "num",
  ",",
  "$",
  "num",
  ")",
  ";",
  "}"
]  | 
	Extract the last `$num` characters from a string.
echo Text::right('Some text here', 4);
@param  string  $str The string to extract the characters from.
@param  int     $num The number of characters to extract.
@return string 
 | 
	[
  "Extract",
  "the",
  "last",
  "$num",
  "characters",
  "from",
  "a",
  "string",
  "."
]  | 
	train 
 | 
	https://github.com/flextype-components/text/blob/8d707eec2dd9025cb17ae3b0c3e995e67580ece3/Text.php#L323-L326 
 | 
					
	flextype-components/text 
 | 
	Text.php 
 | 
	Text.nl2br 
 | 
	public static function nl2br(string $str, bool $xhtml = true) : string
    {
        return str_replace(array("\r\n", "\n\r", "\n", "\r"), (($xhtml) ? '<br />' : '<br>'), $str);
    } 
 | 
	php 
 | 
	public static function nl2br(string $str, bool $xhtml = true) : string
    {
        return str_replace(array("\r\n", "\n\r", "\n", "\r"), (($xhtml) ? '<br />' : '<br>'), $str);
    } 
 | 
	[
  "public",
  "static",
  "function",
  "nl2br",
  "(",
  "string",
  "$",
  "str",
  ",",
  "bool",
  "$",
  "xhtml",
  "=",
  "true",
  ")",
  ":",
  "string",
  "{",
  "return",
  "str_replace",
  "(",
  "array",
  "(",
  "\"\\r\\n\"",
  ",",
  "\"\\n\\r\"",
  ",",
  "\"\\n\"",
  ",",
  "\"\\r\"",
  ")",
  ",",
  "(",
  "(",
  "$",
  "xhtml",
  ")",
  "?",
  "'<br />'",
  ":",
  "'<br>'",
  ")",
  ",",
  "$",
  "str",
  ")",
  ";",
  "}"
]  | 
	Replaces newline with <br> or <br />.
echo Text::nl2br("Some \n text \n here");
@param  string  $str   The input string
@param  bool    $xhtml Xhtml or not
@return string 
 | 
	[
  "Replaces",
  "newline",
  "with",
  "<br",
  ">",
  "or",
  "<br",
  "/",
  ">",
  "."
]  | 
	train 
 | 
	https://github.com/flextype-components/text/blob/8d707eec2dd9025cb17ae3b0c3e995e67580ece3/Text.php#L351-L354 
 | 
					
	flextype-components/text 
 | 
	Text.php 
 | 
	Text.safeString 
 | 
	public static function safeString(string $str, string $delimiter = '-', bool $lowercase = false) : string
    {
        // Remove tags
        $str = filter_var($str, FILTER_SANITIZE_STRING);
        // Decode all entities to their simpler forms
        $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8');
        // Reserved characters (RFC 3986)
        $reserved_characters = array(
            '/', '?', ':', '@', '#', '[', ']',
            '!', '$', '&', '\'', '(', ')', '*',
            '+', ',', ';', '='
        );
        // Remove reserved characters
        $str = str_replace($reserved_characters, ' ', $str);
        // Set locale to en_US.UTF8
        setlocale(LC_ALL, 'en_US.UTF8');
        // Translit ua,ru => latin
        $str = Text::translitIt($str);
        // Convert string
        $str = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
        // Remove characters
        $str = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $str);
        if ($delimiter != null) {
            $str = preg_replace("/[\/_|+ -]+/", $delimiter, $str);
            $str = trim($str, $delimiter);
        }
        // Lowercase
        if ($lowercase === true) {
            $str = Text::lowercase($str);
        }
        // Return safe name
        return $str;
    } 
 | 
	php 
 | 
	public static function safeString(string $str, string $delimiter = '-', bool $lowercase = false) : string
    {
        // Remove tags
        $str = filter_var($str, FILTER_SANITIZE_STRING);
        // Decode all entities to their simpler forms
        $str = html_entity_decode($str, ENT_QUOTES, 'UTF-8');
        // Reserved characters (RFC 3986)
        $reserved_characters = array(
            '/', '?', ':', '@', '#', '[', ']',
            '!', '$', '&', '\'', '(', ')', '*',
            '+', ',', ';', '='
        );
        // Remove reserved characters
        $str = str_replace($reserved_characters, ' ', $str);
        // Set locale to en_US.UTF8
        setlocale(LC_ALL, 'en_US.UTF8');
        // Translit ua,ru => latin
        $str = Text::translitIt($str);
        // Convert string
        $str = iconv('UTF-8', 'ASCII//TRANSLIT', $str);
        // Remove characters
        $str = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $str);
        if ($delimiter != null) {
            $str = preg_replace("/[\/_|+ -]+/", $delimiter, $str);
            $str = trim($str, $delimiter);
        }
        // Lowercase
        if ($lowercase === true) {
            $str = Text::lowercase($str);
        }
        // Return safe name
        return $str;
    } 
 | 
	[
  "public",
  "static",
  "function",
  "safeString",
  "(",
  "string",
  "$",
  "str",
  ",",
  "string",
  "$",
  "delimiter",
  "=",
  "'-'",
  ",",
  "bool",
  "$",
  "lowercase",
  "=",
  "false",
  ")",
  ":",
  "string",
  "{",
  "// Remove tags",
  "$",
  "str",
  "=",
  "filter_var",
  "(",
  "$",
  "str",
  ",",
  "FILTER_SANITIZE_STRING",
  ")",
  ";",
  "// Decode all entities to their simpler forms",
  "$",
  "str",
  "=",
  "html_entity_decode",
  "(",
  "$",
  "str",
  ",",
  "ENT_QUOTES",
  ",",
  "'UTF-8'",
  ")",
  ";",
  "// Reserved characters (RFC 3986)",
  "$",
  "reserved_characters",
  "=",
  "array",
  "(",
  "'/'",
  ",",
  "'?'",
  ",",
  "':'",
  ",",
  "'@'",
  ",",
  "'#'",
  ",",
  "'['",
  ",",
  "']'",
  ",",
  "'!'",
  ",",
  "'$'",
  ",",
  "'&'",
  ",",
  "'\\''",
  ",",
  "'('",
  ",",
  "')'",
  ",",
  "'*'",
  ",",
  "'+'",
  ",",
  "','",
  ",",
  "';'",
  ",",
  "'='",
  ")",
  ";",
  "// Remove reserved characters",
  "$",
  "str",
  "=",
  "str_replace",
  "(",
  "$",
  "reserved_characters",
  ",",
  "' '",
  ",",
  "$",
  "str",
  ")",
  ";",
  "// Set locale to en_US.UTF8",
  "setlocale",
  "(",
  "LC_ALL",
  ",",
  "'en_US.UTF8'",
  ")",
  ";",
  "// Translit ua,ru => latin",
  "$",
  "str",
  "=",
  "Text",
  "::",
  "translitIt",
  "(",
  "$",
  "str",
  ")",
  ";",
  "// Convert string",
  "$",
  "str",
  "=",
  "iconv",
  "(",
  "'UTF-8'",
  ",",
  "'ASCII//TRANSLIT'",
  ",",
  "$",
  "str",
  ")",
  ";",
  "// Remove characters",
  "$",
  "str",
  "=",
  "preg_replace",
  "(",
  "\"/[^a-zA-Z0-9\\/_|+ -]/\"",
  ",",
  "''",
  ",",
  "$",
  "str",
  ")",
  ";",
  "if",
  "(",
  "$",
  "delimiter",
  "!=",
  "null",
  ")",
  "{",
  "$",
  "str",
  "=",
  "preg_replace",
  "(",
  "\"/[\\/_|+ -]+/\"",
  ",",
  "$",
  "delimiter",
  ",",
  "$",
  "str",
  ")",
  ";",
  "$",
  "str",
  "=",
  "trim",
  "(",
  "$",
  "str",
  ",",
  "$",
  "delimiter",
  ")",
  ";",
  "}",
  "// Lowercase",
  "if",
  "(",
  "$",
  "lowercase",
  "===",
  "true",
  ")",
  "{",
  "$",
  "str",
  "=",
  "Text",
  "::",
  "lowercase",
  "(",
  "$",
  "str",
  ")",
  ";",
  "}",
  "// Return safe name",
  "return",
  "$",
  "str",
  ";",
  "}"
]  | 
	Create safe string. Use to create safe usernames or filenames.
$safe_string = Text::safeString('hello world');
@param  string   $str       String
@param  string   $delimiter String delimiter
@param  boolean  $lowercase String Lowercase
@return string 
 | 
	[
  "Create",
  "safe",
  "string",
  ".",
  "Use",
  "to",
  "create",
  "safe",
  "usernames",
  "or",
  "filenames",
  "."
]  | 
	train 
 | 
	https://github.com/flextype-components/text/blob/8d707eec2dd9025cb17ae3b0c3e995e67580ece3/Text.php#L418-L459 
 | 
					
	philiplb/Valdi 
 | 
	src/Valdi/Validator/Contains.php 
 | 
	Contains.adjustCaseInsensitive 
 | 
	protected function adjustCaseInsensitive(&$value, &$parameters) {
        $parameterAmount = count($parameters);
        if ($parameterAmount == 1 || $parameterAmount > 1 && $parameters[1]) {
            $parameters[0] = strtolower($parameters[0]);
            $value         = strtolower($value);
        }
    } 
 | 
	php 
 | 
	protected function adjustCaseInsensitive(&$value, &$parameters) {
        $parameterAmount = count($parameters);
        if ($parameterAmount == 1 || $parameterAmount > 1 && $parameters[1]) {
            $parameters[0] = strtolower($parameters[0]);
            $value         = strtolower($value);
        }
    } 
 | 
	[
  "protected",
  "function",
  "adjustCaseInsensitive",
  "(",
  "&",
  "$",
  "value",
  ",",
  "&",
  "$",
  "parameters",
  ")",
  "{",
  "$",
  "parameterAmount",
  "=",
  "count",
  "(",
  "$",
  "parameters",
  ")",
  ";",
  "if",
  "(",
  "$",
  "parameterAmount",
  "==",
  "1",
  "||",
  "$",
  "parameterAmount",
  ">",
  "1",
  "&&",
  "$",
  "parameters",
  "[",
  "1",
  "]",
  ")",
  "{",
  "$",
  "parameters",
  "[",
  "0",
  "]",
  "=",
  "strtolower",
  "(",
  "$",
  "parameters",
  "[",
  "0",
  "]",
  ")",
  ";",
  "$",
  "value",
  "=",
  "strtolower",
  "(",
  "$",
  "value",
  ")",
  ";",
  "}",
  "}"
]  | 
	Adjusts value and parameters to be case insensitive if the second
parameter says so or is not given.
@param mixed $value
the value to validate
@param array $parameters
the other parameters the validator need 
 | 
	[
  "Adjusts",
  "value",
  "and",
  "parameters",
  "to",
  "be",
  "case",
  "insensitive",
  "if",
  "the",
  "second",
  "parameter",
  "says",
  "so",
  "or",
  "is",
  "not",
  "given",
  "."
]  | 
	train 
 | 
	https://github.com/philiplb/Valdi/blob/9927ec34a2cb00cec705e952d3c2374e2dc3c972/src/Valdi/Validator/Contains.php#L47-L53 
 | 
					
	philiplb/Valdi 
 | 
	src/Valdi/Validator/Contains.php 
 | 
	Contains.isValid 
 | 
	public function isValid($value, array $parameters) {
        $parameterAmount = count($parameters);
        $this->validateParameterCount($parameterAmount);
        $this->adjustCaseInsensitive($value, $parameters);
        return in_array($value, ['', null], true) || strpos($value, $parameters[0]) !== false;
    } 
 | 
	php 
 | 
	public function isValid($value, array $parameters) {
        $parameterAmount = count($parameters);
        $this->validateParameterCount($parameterAmount);
        $this->adjustCaseInsensitive($value, $parameters);
        return in_array($value, ['', null], true) || strpos($value, $parameters[0]) !== false;
    } 
 | 
	[
  "public",
  "function",
  "isValid",
  "(",
  "$",
  "value",
  ",",
  "array",
  "$",
  "parameters",
  ")",
  "{",
  "$",
  "parameterAmount",
  "=",
  "count",
  "(",
  "$",
  "parameters",
  ")",
  ";",
  "$",
  "this",
  "->",
  "validateParameterCount",
  "(",
  "$",
  "parameterAmount",
  ")",
  ";",
  "$",
  "this",
  "->",
  "adjustCaseInsensitive",
  "(",
  "$",
  "value",
  ",",
  "$",
  "parameters",
  ")",
  ";",
  "return",
  "in_array",
  "(",
  "$",
  "value",
  ",",
  "[",
  "''",
  ",",
  "null",
  "]",
  ",",
  "true",
  ")",
  "||",
  "strpos",
  "(",
  "$",
  "value",
  ",",
  "$",
  "parameters",
  "[",
  "0",
  "]",
  ")",
  "!==",
  "false",
  ";",
  "}"
]  | 
	{@inheritdoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/philiplb/Valdi/blob/9927ec34a2cb00cec705e952d3c2374e2dc3c972/src/Valdi/Validator/Contains.php#L58-L65 
 | 
					
	david-mk/mail-map 
 | 
	src/MailMap/Query.php 
 | 
	Query.get 
 | 
	public function get(ConnectionContract $connection, MailFactoryContract $factory)
    {
        $uids = $connection->search($this->parseSearch());
        $stream = $connection->getStream();
        $max = $this->limit > 0 ? $this->limit : self::$max;
        $uids = array_slice($uids, 0, $max);
        return array_map(function ($uid) use ($factory, $stream) {
            return $factory->create($uid, $stream);
        }, $uids);
    } 
 | 
	php 
 | 
	public function get(ConnectionContract $connection, MailFactoryContract $factory)
    {
        $uids = $connection->search($this->parseSearch());
        $stream = $connection->getStream();
        $max = $this->limit > 0 ? $this->limit : self::$max;
        $uids = array_slice($uids, 0, $max);
        return array_map(function ($uid) use ($factory, $stream) {
            return $factory->create($uid, $stream);
        }, $uids);
    } 
 | 
	[
  "public",
  "function",
  "get",
  "(",
  "ConnectionContract",
  "$",
  "connection",
  ",",
  "MailFactoryContract",
  "$",
  "factory",
  ")",
  "{",
  "$",
  "uids",
  "=",
  "$",
  "connection",
  "->",
  "search",
  "(",
  "$",
  "this",
  "->",
  "parseSearch",
  "(",
  ")",
  ")",
  ";",
  "$",
  "stream",
  "=",
  "$",
  "connection",
  "->",
  "getStream",
  "(",
  ")",
  ";",
  "$",
  "max",
  "=",
  "$",
  "this",
  "->",
  "limit",
  ">",
  "0",
  "?",
  "$",
  "this",
  "->",
  "limit",
  ":",
  "self",
  "::",
  "$",
  "max",
  ";",
  "$",
  "uids",
  "=",
  "array_slice",
  "(",
  "$",
  "uids",
  ",",
  "0",
  ",",
  "$",
  "max",
  ")",
  ";",
  "return",
  "array_map",
  "(",
  "function",
  "(",
  "$",
  "uid",
  ")",
  "use",
  "(",
  "$",
  "factory",
  ",",
  "$",
  "stream",
  ")",
  "{",
  "return",
  "$",
  "factory",
  "->",
  "create",
  "(",
  "$",
  "uid",
  ",",
  "$",
  "stream",
  ")",
  ";",
  "}",
  ",",
  "$",
  "uids",
  ")",
  ";",
  "}"
]  | 
	Execute search query on connection and put
results into Mail wrappers using factory
@param \MailMap\Contracts\Connection $connection
@param \MailMap\Contracts\MailFactory $factory
@return array List of Mail wrappers 
 | 
	[
  "Execute",
  "search",
  "query",
  "on",
  "connection",
  "and",
  "put",
  "results",
  "into",
  "Mail",
  "wrappers",
  "using",
  "factory"
]  | 
	train 
 | 
	https://github.com/david-mk/mail-map/blob/4eea346ece9fa35c0d309b5a909f657ad83e1e6a/src/MailMap/Query.php#L108-L119 
 | 
					
	david-mk/mail-map 
 | 
	src/MailMap/Query.php 
 | 
	Query.where 
 | 
	public function where($flag, $value = null)
    {
        if (!in_array(strtolower($flag), static::$searchCriteria)) {
            throw new InvalidArgumentException("Invalid where criteria '{$flag}'");
        }
        $this->where[$flag] = $value;
        return $this;
    } 
 | 
	php 
 | 
	public function where($flag, $value = null)
    {
        if (!in_array(strtolower($flag), static::$searchCriteria)) {
            throw new InvalidArgumentException("Invalid where criteria '{$flag}'");
        }
        $this->where[$flag] = $value;
        return $this;
    } 
 | 
	[
  "public",
  "function",
  "where",
  "(",
  "$",
  "flag",
  ",",
  "$",
  "value",
  "=",
  "null",
  ")",
  "{",
  "if",
  "(",
  "!",
  "in_array",
  "(",
  "strtolower",
  "(",
  "$",
  "flag",
  ")",
  ",",
  "static",
  "::",
  "$",
  "searchCriteria",
  ")",
  ")",
  "{",
  "throw",
  "new",
  "InvalidArgumentException",
  "(",
  "\"Invalid where criteria '{$flag}'\"",
  ")",
  ";",
  "}",
  "$",
  "this",
  "->",
  "where",
  "[",
  "$",
  "flag",
  "]",
  "=",
  "$",
  "value",
  ";",
  "return",
  "$",
  "this",
  ";",
  "}"
]  | 
	Set where condition.
@param  string $flag
@param  string $value
@return $this 
 | 
	[
  "Set",
  "where",
  "condition",
  "."
]  | 
	train 
 | 
	https://github.com/david-mk/mail-map/blob/4eea346ece9fa35c0d309b5a909f657ad83e1e6a/src/MailMap/Query.php#L140-L148 
 | 
					
	david-mk/mail-map 
 | 
	src/MailMap/Query.php 
 | 
	Query.order 
 | 
	public function order($orderFlag, $dir = 'desc')
    {
        if (!in_array($orderFlag, static::$orderCriteria)) {
            throw new InvalidArgumentException("Invalid order criteria '{$orderFlag}'");
        }
        $this->order = $orderFlag;
        $this->orderDir = strtolower($dir) === 'asc' ? 0 : 1;
        return $this;
    } 
 | 
	php 
 | 
	public function order($orderFlag, $dir = 'desc')
    {
        if (!in_array($orderFlag, static::$orderCriteria)) {
            throw new InvalidArgumentException("Invalid order criteria '{$orderFlag}'");
        }
        $this->order = $orderFlag;
        $this->orderDir = strtolower($dir) === 'asc' ? 0 : 1;
        return $this;
    } 
 | 
	[
  "public",
  "function",
  "order",
  "(",
  "$",
  "orderFlag",
  ",",
  "$",
  "dir",
  "=",
  "'desc'",
  ")",
  "{",
  "if",
  "(",
  "!",
  "in_array",
  "(",
  "$",
  "orderFlag",
  ",",
  "static",
  "::",
  "$",
  "orderCriteria",
  ")",
  ")",
  "{",
  "throw",
  "new",
  "InvalidArgumentException",
  "(",
  "\"Invalid order criteria '{$orderFlag}'\"",
  ")",
  ";",
  "}",
  "$",
  "this",
  "->",
  "order",
  "=",
  "$",
  "orderFlag",
  ";",
  "$",
  "this",
  "->",
  "orderDir",
  "=",
  "strtolower",
  "(",
  "$",
  "dir",
  ")",
  "===",
  "'asc'",
  "?",
  "0",
  ":",
  "1",
  ";",
  "return",
  "$",
  "this",
  ";",
  "}"
]  | 
	Set sorting order.
imap_sort only allows one sort condition http://php.net/manual/en/function.imap-sort.php
Calling again will overwrite previous
@param  int $orderFlag
@param  string $dir
@return $this 
 | 
	[
  "Set",
  "sorting",
  "order",
  "."
]  | 
	train 
 | 
	https://github.com/david-mk/mail-map/blob/4eea346ece9fa35c0d309b5a909f657ad83e1e6a/src/MailMap/Query.php#L160-L170 
 | 
					
	david-mk/mail-map 
 | 
	src/MailMap/Query.php 
 | 
	Query.parseSearch 
 | 
	protected function parseSearch()
    {
        return implode(' ', array_map(function ($key, $val) {
            if (is_null($val)) {
                return strtoupper($key);
            }
            return sprintf('%s %s', strtoupper($key), $val);
        }, array_keys($this->where), array_values($this->where)));
    } 
 | 
	php 
 | 
	protected function parseSearch()
    {
        return implode(' ', array_map(function ($key, $val) {
            if (is_null($val)) {
                return strtoupper($key);
            }
            return sprintf('%s %s', strtoupper($key), $val);
        }, array_keys($this->where), array_values($this->where)));
    } 
 | 
	[
  "protected",
  "function",
  "parseSearch",
  "(",
  ")",
  "{",
  "return",
  "implode",
  "(",
  "' '",
  ",",
  "array_map",
  "(",
  "function",
  "(",
  "$",
  "key",
  ",",
  "$",
  "val",
  ")",
  "{",
  "if",
  "(",
  "is_null",
  "(",
  "$",
  "val",
  ")",
  ")",
  "{",
  "return",
  "strtoupper",
  "(",
  "$",
  "key",
  ")",
  ";",
  "}",
  "return",
  "sprintf",
  "(",
  "'%s %s'",
  ",",
  "strtoupper",
  "(",
  "$",
  "key",
  ")",
  ",",
  "$",
  "val",
  ")",
  ";",
  "}",
  ",",
  "array_keys",
  "(",
  "$",
  "this",
  "->",
  "where",
  ")",
  ",",
  "array_values",
  "(",
  "$",
  "this",
  "->",
  "where",
  ")",
  ")",
  ")",
  ";",
  "}"
]  | 
	Parse the 'where' conditions for imap_search
@return string 
 | 
	[
  "Parse",
  "the",
  "where",
  "conditions",
  "for",
  "imap_search"
]  | 
	train 
 | 
	https://github.com/david-mk/mail-map/blob/4eea346ece9fa35c0d309b5a909f657ad83e1e6a/src/MailMap/Query.php#L177-L185 
 | 
					
	bpolaszek/simple-dbal 
 | 
	src/Model/Adapter/Mysqli/Statement.php 
 | 
	Statement.toScalar 
 | 
	protected function toScalar($value)
    {
        if (is_scalar($value)) {
            return $value;
        } elseif (null === $value) {
            return 'NULL';
        } else {
            if (is_object($value)) {
                if (is_callable([$value, '__toString'])) {
                    return (string) $value;
                } elseif ($value instanceof \DateTimeInterface) {
                    return $value->format('Y-m-d H:i:s');
                } else {
                    throw new \InvalidArgumentException(sprintf("Cast of class %s is impossible", get_class($value)));
                }
            } else {
                throw new \InvalidArgumentException(sprintf("Cast of type %s is impossible", gettype($value)));
            }
        }
    } 
 | 
	php 
 | 
	protected function toScalar($value)
    {
        if (is_scalar($value)) {
            return $value;
        } elseif (null === $value) {
            return 'NULL';
        } else {
            if (is_object($value)) {
                if (is_callable([$value, '__toString'])) {
                    return (string) $value;
                } elseif ($value instanceof \DateTimeInterface) {
                    return $value->format('Y-m-d H:i:s');
                } else {
                    throw new \InvalidArgumentException(sprintf("Cast of class %s is impossible", get_class($value)));
                }
            } else {
                throw new \InvalidArgumentException(sprintf("Cast of type %s is impossible", gettype($value)));
            }
        }
    } 
 | 
	[
  "protected",
  "function",
  "toScalar",
  "(",
  "$",
  "value",
  ")",
  "{",
  "if",
  "(",
  "is_scalar",
  "(",
  "$",
  "value",
  ")",
  ")",
  "{",
  "return",
  "$",
  "value",
  ";",
  "}",
  "elseif",
  "(",
  "null",
  "===",
  "$",
  "value",
  ")",
  "{",
  "return",
  "'NULL'",
  ";",
  "}",
  "else",
  "{",
  "if",
  "(",
  "is_object",
  "(",
  "$",
  "value",
  ")",
  ")",
  "{",
  "if",
  "(",
  "is_callable",
  "(",
  "[",
  "$",
  "value",
  ",",
  "'__toString'",
  "]",
  ")",
  ")",
  "{",
  "return",
  "(",
  "string",
  ")",
  "$",
  "value",
  ";",
  "}",
  "elseif",
  "(",
  "$",
  "value",
  "instanceof",
  "\\",
  "DateTimeInterface",
  ")",
  "{",
  "return",
  "$",
  "value",
  "->",
  "format",
  "(",
  "'Y-m-d H:i:s'",
  ")",
  ";",
  "}",
  "else",
  "{",
  "throw",
  "new",
  "\\",
  "InvalidArgumentException",
  "(",
  "sprintf",
  "(",
  "\"Cast of class %s is impossible\"",
  ",",
  "get_class",
  "(",
  "$",
  "value",
  ")",
  ")",
  ")",
  ";",
  "}",
  "}",
  "else",
  "{",
  "throw",
  "new",
  "\\",
  "InvalidArgumentException",
  "(",
  "sprintf",
  "(",
  "\"Cast of type %s is impossible\"",
  ",",
  "gettype",
  "(",
  "$",
  "value",
  ")",
  ")",
  ")",
  ";",
  "}",
  "}",
  "}"
]  | 
	Attempt to convert non-scalar values.
@param $value
@return string 
 | 
	[
  "Attempt",
  "to",
  "convert",
  "non",
  "-",
  "scalar",
  "values",
  "."
]  | 
	train 
 | 
	https://github.com/bpolaszek/simple-dbal/blob/52cb50d326ba5854191814b470f5e84950ebb6e6/src/Model/Adapter/Mysqli/Statement.php#L136-L155 
 | 
					
	technote-space/wordpress-plugin-base 
 | 
	src/classes/controllers/api/nonce.php 
 | 
	Nonce.callback 
 | 
	public function callback( $params ) {
		/** @var \Technote\Classes\Models\Lib\Loader\Controller\Api $api */
		$api = \Technote\Classes\Models\Lib\Loader\Controller\Api::get_instance( $this->app );
		return new \WP_REST_Response( $api->get_nonce_data() );
	} 
 | 
	php 
 | 
	public function callback( $params ) {
		/** @var \Technote\Classes\Models\Lib\Loader\Controller\Api $api */
		$api = \Technote\Classes\Models\Lib\Loader\Controller\Api::get_instance( $this->app );
		return new \WP_REST_Response( $api->get_nonce_data() );
	} 
 | 
	[
  "public",
  "function",
  "callback",
  "(",
  "$",
  "params",
  ")",
  "{",
  "/** @var \\Technote\\Classes\\Models\\Lib\\Loader\\Controller\\Api $api */",
  "$",
  "api",
  "=",
  "\\",
  "Technote",
  "\\",
  "Classes",
  "\\",
  "Models",
  "\\",
  "Lib",
  "\\",
  "Loader",
  "\\",
  "Controller",
  "\\",
  "Api",
  "::",
  "get_instance",
  "(",
  "$",
  "this",
  "->",
  "app",
  ")",
  ";",
  "return",
  "new",
  "\\",
  "WP_REST_Response",
  "(",
  "$",
  "api",
  "->",
  "get_nonce_data",
  "(",
  ")",
  ")",
  ";",
  "}"
]  | 
	@param \WP_REST_Request|array $params
@return int|\WP_Error|\WP_REST_Response 
 | 
	[
  "@param",
  "\\",
  "WP_REST_Request|array",
  "$params"
]  | 
	train 
 | 
	https://github.com/technote-space/wordpress-plugin-base/blob/02cfcba358432a2539af07a69d9db00ff7c14eac/src/classes/controllers/api/nonce.php#L74-L79 
 | 
					
	derhasi/buddy 
 | 
	src/Command/Buddy.php 
 | 
	Buddy.execute 
 | 
	protected function execute(InputInterface $input, OutputInterface $output)
  {
    // Locate
    $config = new Config();
    $config->load(getcwd());
    // We need to use $argv directly, as otherwise we cannot retrieve all
    // arguments and options.
    global $argv;
    $arguments = $argv;
    // The first is the command itself.
    array_shift($arguments);
    $command = array_shift($arguments);
    $config->getCommand($command)
      ->execute($arguments);
  } 
 | 
	php 
 | 
	protected function execute(InputInterface $input, OutputInterface $output)
  {
    // Locate
    $config = new Config();
    $config->load(getcwd());
    // We need to use $argv directly, as otherwise we cannot retrieve all
    // arguments and options.
    global $argv;
    $arguments = $argv;
    // The first is the command itself.
    array_shift($arguments);
    $command = array_shift($arguments);
    $config->getCommand($command)
      ->execute($arguments);
  } 
 | 
	[
  "protected",
  "function",
  "execute",
  "(",
  "InputInterface",
  "$",
  "input",
  ",",
  "OutputInterface",
  "$",
  "output",
  ")",
  "{",
  "// Locate",
  "$",
  "config",
  "=",
  "new",
  "Config",
  "(",
  ")",
  ";",
  "$",
  "config",
  "->",
  "load",
  "(",
  "getcwd",
  "(",
  ")",
  ")",
  ";",
  "// We need to use $argv directly, as otherwise we cannot retrieve all",
  "// arguments and options.",
  "global",
  "$",
  "argv",
  ";",
  "$",
  "arguments",
  "=",
  "$",
  "argv",
  ";",
  "// The first is the command itself.",
  "array_shift",
  "(",
  "$",
  "arguments",
  ")",
  ";",
  "$",
  "command",
  "=",
  "array_shift",
  "(",
  "$",
  "arguments",
  ")",
  ";",
  "$",
  "config",
  "->",
  "getCommand",
  "(",
  "$",
  "command",
  ")",
  "->",
  "execute",
  "(",
  "$",
  "arguments",
  ")",
  ";",
  "}"
]  | 
	{@inheritdoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/derhasi/buddy/blob/a9f033470b61a9fc09bb1ba07f2a2d1fc16b4165/src/Command/Buddy.php#L44-L62 
 | 
					
	brick/di 
 | 
	src/ValueResolver/DefaultValueResolver.php 
 | 
	DefaultValueResolver.getParameterValue 
 | 
	public function getParameterValue(\ReflectionParameter $parameter)
    {
        if ($parameter->isDefaultValueAvailable()) {
            return $parameter->getDefaultValue();
        }
        throw UnresolvedValueException::unresolvedParameter($parameter);
    } 
 | 
	php 
 | 
	public function getParameterValue(\ReflectionParameter $parameter)
    {
        if ($parameter->isDefaultValueAvailable()) {
            return $parameter->getDefaultValue();
        }
        throw UnresolvedValueException::unresolvedParameter($parameter);
    } 
 | 
	[
  "public",
  "function",
  "getParameterValue",
  "(",
  "\\",
  "ReflectionParameter",
  "$",
  "parameter",
  ")",
  "{",
  "if",
  "(",
  "$",
  "parameter",
  "->",
  "isDefaultValueAvailable",
  "(",
  ")",
  ")",
  "{",
  "return",
  "$",
  "parameter",
  "->",
  "getDefaultValue",
  "(",
  ")",
  ";",
  "}",
  "throw",
  "UnresolvedValueException",
  "::",
  "unresolvedParameter",
  "(",
  "$",
  "parameter",
  ")",
  ";",
  "}"
]  | 
	{@inheritdoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/brick/di/blob/6ced82ab3623b8f1470317d38cbd2de855e7aa3d/src/ValueResolver/DefaultValueResolver.php#L19-L26 
 | 
					
	brick/di 
 | 
	src/ValueResolver/DefaultValueResolver.php 
 | 
	DefaultValueResolver.getPropertyValue 
 | 
	public function getPropertyValue(\ReflectionProperty $property)
    {
        $name = $property->getName();
        $class = $property->getDeclaringClass();
        $values = $class->getDefaultProperties(); // caution: this will return NULL for a property that has no default value declared!
        if (isset($values[$name])) {
            return $values[$name];
        }
        throw UnresolvedValueException::unresolvedProperty($property);
    } 
 | 
	php 
 | 
	public function getPropertyValue(\ReflectionProperty $property)
    {
        $name = $property->getName();
        $class = $property->getDeclaringClass();
        $values = $class->getDefaultProperties(); // caution: this will return NULL for a property that has no default value declared!
        if (isset($values[$name])) {
            return $values[$name];
        }
        throw UnresolvedValueException::unresolvedProperty($property);
    } 
 | 
	[
  "public",
  "function",
  "getPropertyValue",
  "(",
  "\\",
  "ReflectionProperty",
  "$",
  "property",
  ")",
  "{",
  "$",
  "name",
  "=",
  "$",
  "property",
  "->",
  "getName",
  "(",
  ")",
  ";",
  "$",
  "class",
  "=",
  "$",
  "property",
  "->",
  "getDeclaringClass",
  "(",
  ")",
  ";",
  "$",
  "values",
  "=",
  "$",
  "class",
  "->",
  "getDefaultProperties",
  "(",
  ")",
  ";",
  "// caution: this will return NULL for a property that has no default value declared!",
  "if",
  "(",
  "isset",
  "(",
  "$",
  "values",
  "[",
  "$",
  "name",
  "]",
  ")",
  ")",
  "{",
  "return",
  "$",
  "values",
  "[",
  "$",
  "name",
  "]",
  ";",
  "}",
  "throw",
  "UnresolvedValueException",
  "::",
  "unresolvedProperty",
  "(",
  "$",
  "property",
  ")",
  ";",
  "}"
]  | 
	{@inheritdoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/brick/di/blob/6ced82ab3623b8f1470317d38cbd2de855e7aa3d/src/ValueResolver/DefaultValueResolver.php#L31-L42 
 | 
					
	philiplb/Valdi 
 | 
	src/Valdi/Validator/InSet.php 
 | 
	InSet.isValid 
 | 
	public function isValid($value, array $parameters) {
        if (count($parameters) === 0) {
            throw new ValidationException('"set" expects at least one parameter.');
        }
        return in_array($value, ['', null], true) ||
            in_array($value, $parameters);
    } 
 | 
	php 
 | 
	public function isValid($value, array $parameters) {
        if (count($parameters) === 0) {
            throw new ValidationException('"set" expects at least one parameter.');
        }
        return in_array($value, ['', null], true) ||
            in_array($value, $parameters);
    } 
 | 
	[
  "public",
  "function",
  "isValid",
  "(",
  "$",
  "value",
  ",",
  "array",
  "$",
  "parameters",
  ")",
  "{",
  "if",
  "(",
  "count",
  "(",
  "$",
  "parameters",
  ")",
  "===",
  "0",
  ")",
  "{",
  "throw",
  "new",
  "ValidationException",
  "(",
  "'\"set\" expects at least one parameter.'",
  ")",
  ";",
  "}",
  "return",
  "in_array",
  "(",
  "$",
  "value",
  ",",
  "[",
  "''",
  ",",
  "null",
  "]",
  ",",
  "true",
  ")",
  "||",
  "in_array",
  "(",
  "$",
  "value",
  ",",
  "$",
  "parameters",
  ")",
  ";",
  "}"
]  | 
	{@inheritdoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/philiplb/Valdi/blob/9927ec34a2cb00cec705e952d3c2374e2dc3c972/src/Valdi/Validator/InSet.php#L24-L30 
 | 
					
	mekras/Types 
 | 
	src/Util/TypeChecker.php 
 | 
	TypeChecker.isString 
 | 
	public static function isString($value)
    {
        if (is_object($value) && method_exists($value, '__toString')) {
            return true;
        }
        if (is_null($value)) {
            return true;
        }
        return is_scalar($value);
    } 
 | 
	php 
 | 
	public static function isString($value)
    {
        if (is_object($value) && method_exists($value, '__toString')) {
            return true;
        }
        if (is_null($value)) {
            return true;
        }
        return is_scalar($value);
    } 
 | 
	[
  "public",
  "static",
  "function",
  "isString",
  "(",
  "$",
  "value",
  ")",
  "{",
  "if",
  "(",
  "is_object",
  "(",
  "$",
  "value",
  ")",
  "&&",
  "method_exists",
  "(",
  "$",
  "value",
  ",",
  "'__toString'",
  ")",
  ")",
  "{",
  "return",
  "true",
  ";",
  "}",
  "if",
  "(",
  "is_null",
  "(",
  "$",
  "value",
  ")",
  ")",
  "{",
  "return",
  "true",
  ";",
  "}",
  "return",
  "is_scalar",
  "(",
  "$",
  "value",
  ")",
  ";",
  "}"
]  | 
	Return true if $value can be casted to string
Examples:
```
'foo' => true
123 => true
null => true
true => true
false => true
new \Exception() => true
[] => false
new \stdClass() => false
```
@param mixed $value
@return bool
@since 1.04 
 | 
	[
  "Return",
  "true",
  "if",
  "$value",
  "can",
  "be",
  "casted",
  "to",
  "string"
]  | 
	train 
 | 
	https://github.com/mekras/Types/blob/a168809097d41f3dacec658b6ecd2fd0f10b30e1/src/Util/TypeChecker.php#L40-L51 
 | 
					
	php-lug/lug 
 | 
	src/Bundle/RegistryBundle/Model/LazyRegistry.php 
 | 
	LazyRegistry.hasLazy 
 | 
	public function hasLazy($type)
    {
        return array_key_exists($type, $this->services) && $this->container->has($this->services[$type]);
    } 
 | 
	php 
 | 
	public function hasLazy($type)
    {
        return array_key_exists($type, $this->services) && $this->container->has($this->services[$type]);
    } 
 | 
	[
  "public",
  "function",
  "hasLazy",
  "(",
  "$",
  "type",
  ")",
  "{",
  "return",
  "array_key_exists",
  "(",
  "$",
  "type",
  ",",
  "$",
  "this",
  "->",
  "services",
  ")",
  "&&",
  "$",
  "this",
  "->",
  "container",
  "->",
  "has",
  "(",
  "$",
  "this",
  "->",
  "services",
  "[",
  "$",
  "type",
  "]",
  ")",
  ";",
  "}"
]  | 
	{@inheritdoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/RegistryBundle/Model/LazyRegistry.php#L57-L60 
 | 
					
	php-lug/lug 
 | 
	src/Bundle/RegistryBundle/Model/LazyRegistry.php 
 | 
	LazyRegistry.getLazy 
 | 
	public function getLazy($type)
    {
        if (!$this->hasLazy($type)) {
            throw new LazyServiceNotFoundException(sprintf('The lazy service "%s" could not be found.', $type));
        }
        return $this->services[$type];
    } 
 | 
	php 
 | 
	public function getLazy($type)
    {
        if (!$this->hasLazy($type)) {
            throw new LazyServiceNotFoundException(sprintf('The lazy service "%s" could not be found.', $type));
        }
        return $this->services[$type];
    } 
 | 
	[
  "public",
  "function",
  "getLazy",
  "(",
  "$",
  "type",
  ")",
  "{",
  "if",
  "(",
  "!",
  "$",
  "this",
  "->",
  "hasLazy",
  "(",
  "$",
  "type",
  ")",
  ")",
  "{",
  "throw",
  "new",
  "LazyServiceNotFoundException",
  "(",
  "sprintf",
  "(",
  "'The lazy service \"%s\" could not be found.'",
  ",",
  "$",
  "type",
  ")",
  ")",
  ";",
  "}",
  "return",
  "$",
  "this",
  "->",
  "services",
  "[",
  "$",
  "type",
  "]",
  ";",
  "}"
]  | 
	{@inheritdoc} 
 | 
	[
  "{"
]  | 
	train 
 | 
	https://github.com/php-lug/lug/blob/81c109f187eba0a60f17e8cc59984ebb31841db7/src/Bundle/RegistryBundle/Model/LazyRegistry.php#L65-L72 
 | 
					
			Subsets and Splits
				
	
				
			
				
No community queries yet
The top public SQL queries from the community will appear here once available.