repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
Assasz/yggdrasil
src/Yggdrasil/Core/Controller/ApiController.php
ApiController.parseBody
protected function parseBody(): array { if ($this->getRequest()->headers->get('Content-Type') === 'application/json') { $dataCollection = json_decode($this->getRequest()->getContent(), true); } else { if ($this->getRequest()->isMethod('POST')) { $dataCollection = array_merge( $this->getRequest()->request->all(), $this->getRequest()->files->all() ); } else { parse_str($this->getRequest()->getContent(), $dataCollection); } } return $dataCollection; }
php
protected function parseBody(): array { if ($this->getRequest()->headers->get('Content-Type') === 'application/json') { $dataCollection = json_decode($this->getRequest()->getContent(), true); } else { if ($this->getRequest()->isMethod('POST')) { $dataCollection = array_merge( $this->getRequest()->request->all(), $this->getRequest()->files->all() ); } else { parse_str($this->getRequest()->getContent(), $dataCollection); } } return $dataCollection; }
[ "protected", "function", "parseBody", "(", ")", ":", "array", "{", "if", "(", "$", "this", "->", "getRequest", "(", ")", "->", "headers", "->", "get", "(", "'Content-Type'", ")", "===", "'application/json'", ")", "{", "$", "dataCollection", "=", "json_deco...
Parses request body into array @return array
[ "Parses", "request", "body", "into", "array" ]
bee9bef7713b85799cdd3e9b23dccae33154f3b3
https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Core/Controller/ApiController.php#L90-L106
train
Assasz/yggdrasil
src/Yggdrasil/Core/Controller/ApiController.php
ApiController.renderPartial
protected function renderPartial(string $view, array $params = []): string { $this->getTemplateEngine()->addGlobal('_request', $this->getRequest()); return $this->getTemplateEngine()->render($view, $params); }
php
protected function renderPartial(string $view, array $params = []): string { $this->getTemplateEngine()->addGlobal('_request', $this->getRequest()); return $this->getTemplateEngine()->render($view, $params); }
[ "protected", "function", "renderPartial", "(", "string", "$", "view", ",", "array", "$", "params", "=", "[", "]", ")", ":", "string", "{", "$", "this", "->", "getTemplateEngine", "(", ")", "->", "addGlobal", "(", "'_request'", ",", "$", "this", "->", "...
Renders partial view @param string $view Name of view file @param array $params Parameters supposed to be passed to the view @return string
[ "Renders", "partial", "view" ]
bee9bef7713b85799cdd3e9b23dccae33154f3b3
https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Core/Controller/ApiController.php#L115-L120
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.RadioLabel
public static function RadioLabel( $name, $label, $value, $checked = NULL, $class = NULL, $readOnly = NULL ) { $radio = UI_HTML_Elements::Radio( $name, $value, $checked, $class, $readOnly ); $field = UI_HTML_Elements::FieldCell( '', $radio ); $label = UI_HTML_Elements::LabelCell( '', $label, $class ); $content = '<tr>'.$field.$label.'</tr>'; $code = UI_HTML_Elements::Table( $content, false, false ); return $code; }
php
public static function RadioLabel( $name, $label, $value, $checked = NULL, $class = NULL, $readOnly = NULL ) { $radio = UI_HTML_Elements::Radio( $name, $value, $checked, $class, $readOnly ); $field = UI_HTML_Elements::FieldCell( '', $radio ); $label = UI_HTML_Elements::LabelCell( '', $label, $class ); $content = '<tr>'.$field.$label.'</tr>'; $code = UI_HTML_Elements::Table( $content, false, false ); return $code; }
[ "public", "static", "function", "RadioLabel", "(", "$", "name", ",", "$", "label", ",", "$", "value", ",", "$", "checked", "=", "NULL", ",", "$", "class", "=", "NULL", ",", "$", "readOnly", "=", "NULL", ")", "{", "$", "radio", "=", "UI_HTML_Elements"...
Builds HTML Code for a Radio Button with a Label. @access public @static @param string $name Field Name @param string $label Field Label @param string $value Field Value @param string $checked Auswahl-Status @param string $class CSS Class @param mixed $readOnly Field is not writable, JavaScript Alert if String is given @return string
[ "Builds", "HTML", "Code", "for", "a", "Radio", "Button", "with", "a", "Label", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L106-L114
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.Acronym
public static function Acronym( $text, $description, $class = "" ) { $ins_title = " title=\"".$description."\""; $ins_class = $class ? " class=\"".$class."\"" : ""; $code = "<acronym".$ins_title.$ins_class.">".$text."</acronym>"; return $code; }
php
public static function Acronym( $text, $description, $class = "" ) { $ins_title = " title=\"".$description."\""; $ins_class = $class ? " class=\"".$class."\"" : ""; $code = "<acronym".$ins_title.$ins_class.">".$text."</acronym>"; return $code; }
[ "public", "static", "function", "Acronym", "(", "$", "text", ",", "$", "description", ",", "$", "class", "=", "\"\"", ")", "{", "$", "ins_title", "=", "\" title=\\\"\"", ".", "$", "description", ".", "\"\\\"\"", ";", "$", "ins_class", "=", "$", "class", ...
Erzeugt HTML-Code eines Acronyms. @access public @static @param string $text Text des Acronyms @param string $description Beschreibung des Acronyms @param string $class CSS-Klasse des Acronyms @return string
[ "Erzeugt", "HTML", "-", "Code", "eines", "Acronyms", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L245-L251
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.Field
public static function Field( $field_id, $field_element, $class = "field", $suffix = "", $colspan = 1 ) { $ins_id = $field_id ? " id=\"fld_".$field_id."\"" : ""; $ins_class = $class ? " class=\"".$class."\"" : ""; $ins_colspan = ( $colspan > 1 ) ? " colspan=\"".$colspan."\"" : ""; if( $suffix ) { $code = "<td".$ins_colspan."> <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"> <tr><td".$ins_id.$ins_class.">".$field_element."</td><td class=\"suffix\">".$suffix."</td></tr></table></td>"; } else $code = "<td".$ins_class.$ins_colspan.$ins_id.">".$field_element."</td>"; return $code; }
php
public static function Field( $field_id, $field_element, $class = "field", $suffix = "", $colspan = 1 ) { $ins_id = $field_id ? " id=\"fld_".$field_id."\"" : ""; $ins_class = $class ? " class=\"".$class."\"" : ""; $ins_colspan = ( $colspan > 1 ) ? " colspan=\"".$colspan."\"" : ""; if( $suffix ) { $code = "<td".$ins_colspan."> <table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"> <tr><td".$ins_id.$ins_class.">".$field_element."</td><td class=\"suffix\">".$suffix."</td></tr></table></td>"; } else $code = "<td".$ins_class.$ins_colspan.$ins_id.">".$field_element."</td>"; return $code; }
[ "public", "static", "function", "Field", "(", "$", "field_id", ",", "$", "field_element", ",", "$", "class", "=", "\"field\"", ",", "$", "suffix", "=", "\"\"", ",", "$", "colspan", "=", "1", ")", "{", "$", "ins_id", "=", "$", "field_id", "?", "\" id=...
Erzeugt HTML-Code eines Eingabefeldes. @access public @static @param string $field_id interner Name des Eingabefeldes @param string $field_element HTML-Code des Eingabeelements @param string $class CSS-Klasse @param string $suffix Textausgabe hinter dem Eingabefeld @param string $colspan Anzahl der überstreckten Spalten @return string
[ "Erzeugt", "HTML", "-", "Code", "eines", "Eingabefeldes", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L289-L302
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.Image
public static function Image( $url, $title, $class = "", $width = NULL, $height = NULL ) { $attributes = array( 'src' => $url, 'class' => $class ? $class : NULL, 'width' => $width ? $width : NULL, 'height' => $height ? $height : NULL, 'alt' => $title ? $title : NULL, 'title' => $title ? $title : NULL, 'hspace' => 0, 'vspace' => 0, ); $code = UI_HTML_Tag::create( "img", NULL, $attributes ); return $code; }
php
public static function Image( $url, $title, $class = "", $width = NULL, $height = NULL ) { $attributes = array( 'src' => $url, 'class' => $class ? $class : NULL, 'width' => $width ? $width : NULL, 'height' => $height ? $height : NULL, 'alt' => $title ? $title : NULL, 'title' => $title ? $title : NULL, 'hspace' => 0, 'vspace' => 0, ); $code = UI_HTML_Tag::create( "img", NULL, $attributes ); return $code; }
[ "public", "static", "function", "Image", "(", "$", "url", ",", "$", "title", ",", "$", "class", "=", "\"\"", ",", "$", "width", "=", "NULL", ",", "$", "height", "=", "NULL", ")", "{", "$", "attributes", "=", "array", "(", "'src'", "=>", "$", "url...
Erzeugt HTML-Code einer Grafik. @access public @static @param string $url URL der Grafik @param string $title Alternativ-Text @param string $class CSS-Klasse des Eingabefeldes @return string
[ "Erzeugt", "HTML", "-", "Code", "einer", "Grafik", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L318-L332
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.Label
public static function Label( $label_name, $label_text, $class = 'label', $icons = array() ) { if( !is_array( $icons ) ) { if( $icons ) $icons = array( $icons ); else $icons = array(); } if( sizeof( $icons ) && $label_name ) { $ins_icons = ""; foreach( $icons as $icon ) if( trim( $icon ) ) $ins_icons .= "<td>".$icon."</td>"; $code = "<td".$ins_width."> <table cellpadding='0' cellspacing='0' border='0' width='100%'> <tr> <td class='label' id='lbl_".$label_name."'><label for='".$label_name."'>".$label_text."</label></td> <td class='prefix' id='ico_".$label_name."' align='right' valign='middle'> <table cellpadding='0' cellspacing='0' border='0'><tr>".$ins_icons."</tr></table></td> </tr> </table>"; } else { $ins_id = $label_name ? " id=\"lbl_".$label_name."\"" : ""; $ins_class = $class ? " class=\"".$class."\"" : ""; $label = $label_name ? "<label for='".$label_name."'>".$label_text."</label>" : $label_text; $code = "<td".$ins_id.$ins_class.">".$label."</td>"; } return $code; }
php
public static function Label( $label_name, $label_text, $class = 'label', $icons = array() ) { if( !is_array( $icons ) ) { if( $icons ) $icons = array( $icons ); else $icons = array(); } if( sizeof( $icons ) && $label_name ) { $ins_icons = ""; foreach( $icons as $icon ) if( trim( $icon ) ) $ins_icons .= "<td>".$icon."</td>"; $code = "<td".$ins_width."> <table cellpadding='0' cellspacing='0' border='0' width='100%'> <tr> <td class='label' id='lbl_".$label_name."'><label for='".$label_name."'>".$label_text."</label></td> <td class='prefix' id='ico_".$label_name."' align='right' valign='middle'> <table cellpadding='0' cellspacing='0' border='0'><tr>".$ins_icons."</tr></table></td> </tr> </table>"; } else { $ins_id = $label_name ? " id=\"lbl_".$label_name."\"" : ""; $ins_class = $class ? " class=\"".$class."\"" : ""; $label = $label_name ? "<label for='".$label_name."'>".$label_text."</label>" : $label_text; $code = "<td".$ins_id.$ins_class.">".$label."</td>"; } return $code; }
[ "public", "static", "function", "Label", "(", "$", "label_name", ",", "$", "label_text", ",", "$", "class", "=", "'label'", ",", "$", "icons", "=", "array", "(", ")", ")", "{", "if", "(", "!", "is_array", "(", "$", "icons", ")", ")", "{", "if", "...
Erzeugt HTML-Code einer Feldbeschriftung. @access public @static @param string $label_name interner Name des Beschrifungsfeldes @param string $label_name Inhalt des Beschriftungsfeldes @param string $class CSS-Klasse @param string $icons Array mit Icons vor den Eingabefeld @param string $width Weitenangabe @return string
[ "Erzeugt", "HTML", "-", "Code", "einer", "Feldbeschriftung", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L345-L377
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.Link
public static function Link( $url, $name, $class = NULL, $target = NULL, $confirm = NULL, $tabindex = NULL, $key = NULL, $relation = NULL ) { $url = str_replace( '"', "'", $url ); $url = str_replace( "&", "&amp;", $url ); $attributes = array( 'href' => $url, 'class' => $class ? $class : NULL, 'accesskey' => $key ? $key : NULL, 'tabindex' => $tabindex ? $tabindex : NULL, 'target' => $target ? $target : NULL, 'rel' => $relation ? $relation : NULL, 'onclick' => $confirm ? "return confirm('".$confirm."')" : NULL, ); $link = UI_HTML_Tag::create( "a", $name, $attributes ); return $link; }
php
public static function Link( $url, $name, $class = NULL, $target = NULL, $confirm = NULL, $tabindex = NULL, $key = NULL, $relation = NULL ) { $url = str_replace( '"', "'", $url ); $url = str_replace( "&", "&amp;", $url ); $attributes = array( 'href' => $url, 'class' => $class ? $class : NULL, 'accesskey' => $key ? $key : NULL, 'tabindex' => $tabindex ? $tabindex : NULL, 'target' => $target ? $target : NULL, 'rel' => $relation ? $relation : NULL, 'onclick' => $confirm ? "return confirm('".$confirm."')" : NULL, ); $link = UI_HTML_Tag::create( "a", $name, $attributes ); return $link; }
[ "public", "static", "function", "Link", "(", "$", "url", ",", "$", "name", ",", "$", "class", "=", "NULL", ",", "$", "target", "=", "NULL", ",", "$", "confirm", "=", "NULL", ",", "$", "tabindex", "=", "NULL", ",", "$", "key", "=", "NULL", ",", ...
Erzeugt HTML-Code eines Links. @access public @static @param string $url URL des Links @param string $name Name des Links @param string $class CSS-Klasse des Links @param string $target Zielframe des Links @param string $confirm Bestätigungstext des Links @param int $tabindex Tabulatur-Index @param string $key Access Key (eindeutiger Buchstabe) @param bool $relation Relation (nofollow,licence,...) @return string
[ "Erzeugt", "HTML", "-", "Code", "eines", "Links", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L393-L408
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.ListItem
public static function ListItem( $content, $level = 0, $attributes = array() ) { $depth = 2 * abs( (int) $level ) + 1; $indent = str_repeat( " ", $depth ); $tag = UI_HTML_Tag::create( "li", $content, $attributes ); $code = $indent.$tag; return $code; }
php
public static function ListItem( $content, $level = 0, $attributes = array() ) { $depth = 2 * abs( (int) $level ) + 1; $indent = str_repeat( " ", $depth ); $tag = UI_HTML_Tag::create( "li", $content, $attributes ); $code = $indent.$tag; return $code; }
[ "public", "static", "function", "ListItem", "(", "$", "content", ",", "$", "level", "=", "0", ",", "$", "attributes", "=", "array", "(", ")", ")", "{", "$", "depth", "=", "2", "*", "abs", "(", "(", "int", ")", "$", "level", ")", "+", "1", ";", ...
Build List Item. @access public @static @param string $content Content of List Item @param int $level Level of Indenting @param array $attributes Array of HTML Attributes @return string
[ "Build", "List", "Item", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L419-L426
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.orderedList
public static function orderedList( $items, $level = 0, $attributes = array() ) { $content = "\n".implode( "\n", $items )."\n"; $indent = str_repeat( " ", 2 * abs( (int) $level ) ); $tag = UI_HTML_Tag::create( "ol", $content, $attributes ); $code = $indent.$tag; return $code; }
php
public static function orderedList( $items, $level = 0, $attributes = array() ) { $content = "\n".implode( "\n", $items )."\n"; $indent = str_repeat( " ", 2 * abs( (int) $level ) ); $tag = UI_HTML_Tag::create( "ol", $content, $attributes ); $code = $indent.$tag; return $code; }
[ "public", "static", "function", "orderedList", "(", "$", "items", ",", "$", "level", "=", "0", ",", "$", "attributes", "=", "array", "(", ")", ")", "{", "$", "content", "=", "\"\\n\"", ".", "implode", "(", "\"\\n\"", ",", "$", "items", ")", ".", "\...
Build ordered List from List Items. @access public @static @param string $content Content of List Item @param int $level Level of Indenting @param array $attributes Array of HTML Attributes @return string
[ "Build", "ordered", "List", "from", "List", "Items", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L437-L444
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.Separator
public static function Separator( $colspan = 3, $rowspan = 1, $class = "inline" ) { $ins_class = $class ? " class=\"".$class."\"" : ""; $ins_colspan = $colspan ? " colspan=\"".$colspan."\"" : ""; $ins_rowspan = $rowspan ? " rowspan=\"".$rowspan."\"" : ""; $code = "<tr><td".$ins_colspan.$ins_rowspan.$ins_class."></td></tr>"; return $code; }
php
public static function Separator( $colspan = 3, $rowspan = 1, $class = "inline" ) { $ins_class = $class ? " class=\"".$class."\"" : ""; $ins_colspan = $colspan ? " colspan=\"".$colspan."\"" : ""; $ins_rowspan = $rowspan ? " rowspan=\"".$rowspan."\"" : ""; $code = "<tr><td".$ins_colspan.$ins_rowspan.$ins_class."></td></tr>"; return $code; }
[ "public", "static", "function", "Separator", "(", "$", "colspan", "=", "3", ",", "$", "rowspan", "=", "1", ",", "$", "class", "=", "\"inline\"", ")", "{", "$", "ins_class", "=", "$", "class", "?", "\" class=\\\"\"", ".", "$", "class", ".", "\"\\\"\"", ...
Erzeugt HTML-Code einer horizontale und vertikale Trennzeile. @access public @static @param int $colspan Name des Formulars @param int $rowspan URL der Aktion @param int $strength Stärke der Linie @param string $class CSS-Klasse @return string
[ "Erzeugt", "HTML", "-", "Code", "einer", "horizontale", "und", "vertikale", "Trennzeile", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L473-L480
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.Table
public static function Table( $content, $class = "filledframe", $width = "100%", $border = 0, $padding = 0, $spacing = 0 ) { $ins_class = $class ? " class=\"".$class."\"" : ""; $ins_width = $width ? " width=\"".$width."\"" : ""; $ins_border = $border ? " border=\"".$border."\"" : ""; $ins_padding = " cellpadding=\"".$padding."\""; $ins_spacing = " cellspacing=\"".$spacing."\""; $code = "<table".$ins_class.$ins_width.$ins_border.$ins_padding.$ins_spacing.">".$content."</table>\n"; return $code; }
php
public static function Table( $content, $class = "filledframe", $width = "100%", $border = 0, $padding = 0, $spacing = 0 ) { $ins_class = $class ? " class=\"".$class."\"" : ""; $ins_width = $width ? " width=\"".$width."\"" : ""; $ins_border = $border ? " border=\"".$border."\"" : ""; $ins_padding = " cellpadding=\"".$padding."\""; $ins_spacing = " cellspacing=\"".$spacing."\""; $code = "<table".$ins_class.$ins_width.$ins_border.$ins_padding.$ins_spacing.">".$content."</table>\n"; return $code; }
[ "public", "static", "function", "Table", "(", "$", "content", ",", "$", "class", "=", "\"filledframe\"", ",", "$", "width", "=", "\"100%\"", ",", "$", "border", "=", "0", ",", "$", "padding", "=", "0", ",", "$", "spacing", "=", "0", ")", "{", "$", ...
Erzeugt HTML-Code einer Tabelle. @access public @static @param string $content Inhalt der Tabelle @param string $class CSS Style Klasse @param int $width Breite der Tabelle @param int $border Rahmendicke der Tabelle @param int $padding Innenabstand der Tabelle @param int $spacing Zellenabstand @return string
[ "Erzeugt", "HTML", "-", "Code", "einer", "Tabelle", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L494-L503
train
CeusMedia/Common
src/UI/HTML/Elements.php
UI_HTML_Elements.unorderedList
public static function unorderedList( $items, $level = 0, $attributes = array() ) { $depth1 = 2 * abs( (int) $level ); $depth2 = $level ? 2 * abs( (int) $level - 1 ) + 1 : 0; $indent1 = str_repeat( " ", $depth1 ); $indent2 = str_repeat( " ", $depth2 ); $content = "\n".implode( "\n", $items )."\n".$indent1; $tag = UI_HTML_Tag::create( "ul", $content, $attributes ); $code = $indent1.$tag."\n".$indent2; return $code; }
php
public static function unorderedList( $items, $level = 0, $attributes = array() ) { $depth1 = 2 * abs( (int) $level ); $depth2 = $level ? 2 * abs( (int) $level - 1 ) + 1 : 0; $indent1 = str_repeat( " ", $depth1 ); $indent2 = str_repeat( " ", $depth2 ); $content = "\n".implode( "\n", $items )."\n".$indent1; $tag = UI_HTML_Tag::create( "ul", $content, $attributes ); $code = $indent1.$tag."\n".$indent2; return $code; }
[ "public", "static", "function", "unorderedList", "(", "$", "items", ",", "$", "level", "=", "0", ",", "$", "attributes", "=", "array", "(", ")", ")", "{", "$", "depth1", "=", "2", "*", "abs", "(", "(", "int", ")", "$", "level", ")", ";", "$", "...
Build unordered List from List Items. @access public @static @param string $content Content of List Item @param int $level Level of Indenting @param array $attributes Array of HTML Attributes @return string
[ "Build", "unordered", "List", "from", "List", "Items", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Elements.php#L572-L582
train
CeusMedia/Common
src/XML/Parser.php
XML_Parser.handleTagOpenForArray
protected function handleTagOpenForArray( $parser, $tag, $attributes ) { $count = count( $this->last ) - 1; $this->last[$count][] = array( "tag" => $tag, "attributes" => $attributes, "content" => '', "children" => array() ); $index = count( $this->last[$count] ) - 1; $this->last[] = &$this->last[$count][$index]['children']; }
php
protected function handleTagOpenForArray( $parser, $tag, $attributes ) { $count = count( $this->last ) - 1; $this->last[$count][] = array( "tag" => $tag, "attributes" => $attributes, "content" => '', "children" => array() ); $index = count( $this->last[$count] ) - 1; $this->last[] = &$this->last[$count][$index]['children']; }
[ "protected", "function", "handleTagOpenForArray", "(", "$", "parser", ",", "$", "tag", ",", "$", "attributes", ")", "{", "$", "count", "=", "count", "(", "$", "this", "->", "last", ")", "-", "1", ";", "$", "this", "->", "last", "[", "$", "count", "...
Callback Method for opening Tags on Array Collection. @access protected @param resource $parser Resource of XML Parser @param string $tag Name of parsed Tag @param array $attributes Array of parsed Attributes @return void
[ "Callback", "Method", "for", "opening", "Tags", "on", "Array", "Collection", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/Parser.php#L119-L130
train
CeusMedia/Common
src/XML/Parser.php
XML_Parser.handleTagOpenForObject
protected function handleTagOpenForObject( $parser, $tag, $attributes ) { $count = count( $this->last ) - 1; $parentNode =& $this->last[$count]; $childNode = new XML_DOM_Node( $tag, "", $attributes ); $parentNode->addChild( $childNode ); $this->last[] =& $childNode; }
php
protected function handleTagOpenForObject( $parser, $tag, $attributes ) { $count = count( $this->last ) - 1; $parentNode =& $this->last[$count]; $childNode = new XML_DOM_Node( $tag, "", $attributes ); $parentNode->addChild( $childNode ); $this->last[] =& $childNode; }
[ "protected", "function", "handleTagOpenForObject", "(", "$", "parser", ",", "$", "tag", ",", "$", "attributes", ")", "{", "$", "count", "=", "count", "(", "$", "this", "->", "last", ")", "-", "1", ";", "$", "parentNode", "=", "&", "$", "this", "->", ...
Callback Method for opening Tags on Object Collection. @access protected @param resource $parser Resource of XML Parser @param string $tag Name of parsed Tag @param array $attributes Array of parsed Attributes @return void
[ "Callback", "Method", "for", "opening", "Tags", "on", "Object", "Collection", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/Parser.php#L140-L151
train
CeusMedia/Common
src/XML/Parser.php
XML_Parser.toArray
public function toArray( $xml ) { $this->data = array(); $this->xml = xml_parser_create(); xml_set_object( $this->xml, $this ); xml_set_element_handler( $this->xml, 'handleTagOpenForArray', 'handleTagCloseForArray' ); xml_set_character_data_handler( $this->xml, 'handleCDataForArray' ); $this->last = array( &$this->data ); if( !xml_parse( $this->xml, $xml ) ) { $msg = "XML error: %s at line %d"; $error = xml_error_string( xml_get_error_code( $this->xml ) ); $line = xml_get_current_line_number( $this->xml ); throw new RuntimeException( sprintf( $msg, $error, $line ) ); } xml_parser_free( $this->xml ); return $this->data; }
php
public function toArray( $xml ) { $this->data = array(); $this->xml = xml_parser_create(); xml_set_object( $this->xml, $this ); xml_set_element_handler( $this->xml, 'handleTagOpenForArray', 'handleTagCloseForArray' ); xml_set_character_data_handler( $this->xml, 'handleCDataForArray' ); $this->last = array( &$this->data ); if( !xml_parse( $this->xml, $xml ) ) { $msg = "XML error: %s at line %d"; $error = xml_error_string( xml_get_error_code( $this->xml ) ); $line = xml_get_current_line_number( $this->xml ); throw new RuntimeException( sprintf( $msg, $error, $line ) ); } xml_parser_free( $this->xml ); return $this->data; }
[ "public", "function", "toArray", "(", "$", "xml", ")", "{", "$", "this", "->", "data", "=", "array", "(", ")", ";", "$", "this", "->", "xml", "=", "xml_parser_create", "(", ")", ";", "xml_set_object", "(", "$", "this", "->", "xml", ",", "$", "this"...
Returns an Array Structure from XML String. @access public @return array
[ "Returns", "an", "Array", "Structure", "from", "XML", "String", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/Parser.php#L158-L175
train
ncou/Chiron
src/Chiron/Http/Session/Session.php
Session.resumeSession
private function resumeSession(): bool { if ($this->manager->isStarted() || $this->manager->resume()) { return true; } return false; }
php
private function resumeSession(): bool { if ($this->manager->isStarted() || $this->manager->resume()) { return true; } return false; }
[ "private", "function", "resumeSession", "(", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "manager", "->", "isStarted", "(", ")", "||", "$", "this", "->", "manager", "->", "resume", "(", ")", ")", "{", "return", "true", ";", "}", "return", ...
If the session has already been started, or if a session is available, we try to resumes it. @return bool
[ "If", "the", "session", "has", "already", "been", "started", "or", "if", "a", "session", "is", "available", "we", "try", "to", "resumes", "it", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Session/Session.php#L93-L100
train
CeusMedia/Common
src/FS/File/PHP/Parser/Regular.php
FS_File_PHP_Parser_Regular.parseClassOrInterface
protected function parseClassOrInterface( ADT_PHP_File $parent, $matches ) { switch( strtolower( trim( $matches[3] ) ) ) { case 'interface': $artefact = new ADT_PHP_Interface( $matches[4] ); if( isset( $matches[5] ) ) $artefact->setExtendedInterfaceName( $matches[6] ); $artefact->setFinal( (bool) $matches[2] ); break; default: $artefact = new ADT_PHP_Class( $matches[4] ); if( isset( $matches[5] ) ) $artefact->setExtendedClassName( $matches[6] ); $artefact->setFinal( (bool) $matches[2] ); $artefact->setAbstract( (bool) $matches[1] ); if( isset( $matches[7] ) ) foreach( array_slice( $matches, 8 ) as $match ) if( trim( $match ) && !preg_match( "@^,|{@", trim( $match ) ) ) $artefact->setImplementedInterfaceName( trim( $match ) ); break; } $artefact->setParent( $parent ); $artefact->setLine( $this->lineNumber ); $artefact->type = $matches[3]; if( $this->openBlocks ) { $this->decorateCodeDataWithDocData( $artefact, array_pop( $this->openBlocks ) ); $this->openBlocks = array(); } if( !$artefact->getCategory() && $parent->getCategory() ) $artefact->setCategory( $parent->getCategory() ); if( !$artefact->getPackage() && $parent->getPackage() ) $artefact->setPackage( $parent->getPackage() ); return $artefact; }
php
protected function parseClassOrInterface( ADT_PHP_File $parent, $matches ) { switch( strtolower( trim( $matches[3] ) ) ) { case 'interface': $artefact = new ADT_PHP_Interface( $matches[4] ); if( isset( $matches[5] ) ) $artefact->setExtendedInterfaceName( $matches[6] ); $artefact->setFinal( (bool) $matches[2] ); break; default: $artefact = new ADT_PHP_Class( $matches[4] ); if( isset( $matches[5] ) ) $artefact->setExtendedClassName( $matches[6] ); $artefact->setFinal( (bool) $matches[2] ); $artefact->setAbstract( (bool) $matches[1] ); if( isset( $matches[7] ) ) foreach( array_slice( $matches, 8 ) as $match ) if( trim( $match ) && !preg_match( "@^,|{@", trim( $match ) ) ) $artefact->setImplementedInterfaceName( trim( $match ) ); break; } $artefact->setParent( $parent ); $artefact->setLine( $this->lineNumber ); $artefact->type = $matches[3]; if( $this->openBlocks ) { $this->decorateCodeDataWithDocData( $artefact, array_pop( $this->openBlocks ) ); $this->openBlocks = array(); } if( !$artefact->getCategory() && $parent->getCategory() ) $artefact->setCategory( $parent->getCategory() ); if( !$artefact->getPackage() && $parent->getPackage() ) $artefact->setPackage( $parent->getPackage() ); return $artefact; }
[ "protected", "function", "parseClassOrInterface", "(", "ADT_PHP_File", "$", "parent", ",", "$", "matches", ")", "{", "switch", "(", "strtolower", "(", "trim", "(", "$", "matches", "[", "3", "]", ")", ")", ")", "{", "case", "'interface'", ":", "$", "artef...
Parses a Class Signature and returns collected Information. @access protected @param ADT_PHP_File $parent File Object of current Class @param array $matches Matches of RegEx @return ADT_PHP_Interface|ADT_PHP_Class
[ "Parses", "a", "Class", "Signature", "and", "returns", "collected", "Information", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/PHP/Parser/Regular.php#L190-L225
train
CeusMedia/Common
src/FS/File/PHP/Parser/Regular.php
FS_File_PHP_Parser_Regular.parseFunction
protected function parseFunction( ADT_PHP_File $parent, $matches ) { $function = new ADT_PHP_Function( $matches[6] ); $function->setParent( $parent ); $function->setLine( $this->lineNumber ); if( trim( $matches[7] ) ) { $paramList = array(); foreach( explode( ",", $matches[7] ) as $param ) { $param = trim( $param ); if( !preg_match( $this->regexParam, $param, $matches ) ) continue; $function->setParameter( $this->parseParameter( $function, $matches ) ); } } if( $this->openBlocks ) { $methodBlock = array_pop( $this->openBlocks ); $this->decorateCodeDataWithDocData( $function, $methodBlock ); $this->openBlocks = array(); } return $function; }
php
protected function parseFunction( ADT_PHP_File $parent, $matches ) { $function = new ADT_PHP_Function( $matches[6] ); $function->setParent( $parent ); $function->setLine( $this->lineNumber ); if( trim( $matches[7] ) ) { $paramList = array(); foreach( explode( ",", $matches[7] ) as $param ) { $param = trim( $param ); if( !preg_match( $this->regexParam, $param, $matches ) ) continue; $function->setParameter( $this->parseParameter( $function, $matches ) ); } } if( $this->openBlocks ) { $methodBlock = array_pop( $this->openBlocks ); $this->decorateCodeDataWithDocData( $function, $methodBlock ); $this->openBlocks = array(); } return $function; }
[ "protected", "function", "parseFunction", "(", "ADT_PHP_File", "$", "parent", ",", "$", "matches", ")", "{", "$", "function", "=", "new", "ADT_PHP_Function", "(", "$", "matches", "[", "6", "]", ")", ";", "$", "function", "->", "setParent", "(", "$", "par...
Parses a Function Signature and returns collected Information. @access protected @param ADT_PHP_File $parent Parent File Data Object @param array $matches Matches of RegEx @return ADT_PHP_Function
[ "Parses", "a", "Function", "Signature", "and", "returns", "collected", "Information", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/PHP/Parser/Regular.php#L569-L593
train
CeusMedia/Common
src/FS/File/PHP/Parser/Regular.php
FS_File_PHP_Parser_Regular.parseMember
protected function parseMember( $parent, $matches, $docBlock = NULL ) { $variable = new ADT_PHP_Member( $matches[4], NULL, NULL ); $variable->setParent( $parent ); $variable->setLine( $this->lineNumber ); if( isset( $matches[5] ) ) $variable->setDefault( preg_replace( "@;$@", "", $matches[6] ) ); if( !empty( $matches[2] ) ) $variable->setAccess( $matches[2] == "var" ? NULL : $matches[2] ); $variable->setStatic( (bool) trim( $matches[3] ) ); if( $docBlock ) if( $docBlock instanceof ADT_PHP_Variable ) if( $docBlock->getName() == $variable->getName() ) $variable->merge( $docBlock ); return $variable; }
php
protected function parseMember( $parent, $matches, $docBlock = NULL ) { $variable = new ADT_PHP_Member( $matches[4], NULL, NULL ); $variable->setParent( $parent ); $variable->setLine( $this->lineNumber ); if( isset( $matches[5] ) ) $variable->setDefault( preg_replace( "@;$@", "", $matches[6] ) ); if( !empty( $matches[2] ) ) $variable->setAccess( $matches[2] == "var" ? NULL : $matches[2] ); $variable->setStatic( (bool) trim( $matches[3] ) ); if( $docBlock ) if( $docBlock instanceof ADT_PHP_Variable ) if( $docBlock->getName() == $variable->getName() ) $variable->merge( $docBlock ); return $variable; }
[ "protected", "function", "parseMember", "(", "$", "parent", ",", "$", "matches", ",", "$", "docBlock", "=", "NULL", ")", "{", "$", "variable", "=", "new", "ADT_PHP_Member", "(", "$", "matches", "[", "4", "]", ",", "NULL", ",", "NULL", ")", ";", "$", ...
Parses a Class Member Signature and returns collected Information. @access protected @param ADT_PHP_Class $parent Parent Class Data Object @param array $matches Matches of RegEx @param array $docBlock Variable data object from Doc Parser @return ADT_PHP_Member
[ "Parses", "a", "Class", "Member", "Signature", "and", "returns", "collected", "Information", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/PHP/Parser/Regular.php#L603-L619
train
CeusMedia/Common
src/FS/File/PHP/Parser/Regular.php
FS_File_PHP_Parser_Regular.parseMethod
protected function parseMethod( ADT_PHP_Interface $parent, $matches ) { $method = new ADT_PHP_Method( $matches[6] ); $method->setParent( $parent ); $method->setLine( $this->lineNumber ); if( !empty( $matches[4] ) ) $method->setAccess( trim( $matches[4] ) ); $method->setAbstract( (bool) $matches[1] ); $method->setFinal( (bool) $matches[2] ); $method->setStatic( (bool) $matches[3] || (bool) $matches[5] ); $return = new ADT_PHP_Return( "unknown" ); $return->setParent( $method ); $method->setReturn( $return ); if( trim( $matches[7] ) ) { $paramList = array(); foreach( explode( ",", $matches[7] ) as $param ) { $param = trim( $param ); if( !preg_match( $this->regexParam, $param, $matches ) ) continue; $method->setParameter( $this->parseParameter( $method, $matches ) ); } } if( $this->openBlocks ) { $methodBlock = array_pop( $this->openBlocks ); $this->decorateCodeDataWithDocData( $method, $methodBlock ); $this->openBlocks = array(); } # if( !$method->getAccess() ) # $method->setAccess( 'public' ); return $method; }
php
protected function parseMethod( ADT_PHP_Interface $parent, $matches ) { $method = new ADT_PHP_Method( $matches[6] ); $method->setParent( $parent ); $method->setLine( $this->lineNumber ); if( !empty( $matches[4] ) ) $method->setAccess( trim( $matches[4] ) ); $method->setAbstract( (bool) $matches[1] ); $method->setFinal( (bool) $matches[2] ); $method->setStatic( (bool) $matches[3] || (bool) $matches[5] ); $return = new ADT_PHP_Return( "unknown" ); $return->setParent( $method ); $method->setReturn( $return ); if( trim( $matches[7] ) ) { $paramList = array(); foreach( explode( ",", $matches[7] ) as $param ) { $param = trim( $param ); if( !preg_match( $this->regexParam, $param, $matches ) ) continue; $method->setParameter( $this->parseParameter( $method, $matches ) ); } } if( $this->openBlocks ) { $methodBlock = array_pop( $this->openBlocks ); $this->decorateCodeDataWithDocData( $method, $methodBlock ); $this->openBlocks = array(); } # if( !$method->getAccess() ) # $method->setAccess( 'public' ); return $method; }
[ "protected", "function", "parseMethod", "(", "ADT_PHP_Interface", "$", "parent", ",", "$", "matches", ")", "{", "$", "method", "=", "new", "ADT_PHP_Method", "(", "$", "matches", "[", "6", "]", ")", ";", "$", "method", "->", "setParent", "(", "$", "parent...
Parses a Method Signature and returns collected Information. @access protected @param ADT_PHP_Interface $parent Parent Class Data Object @param array $matches Matches of RegEx @return ADT_PHP_Method
[ "Parses", "a", "Method", "Signature", "and", "returns", "collected", "Information", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/PHP/Parser/Regular.php#L628-L663
train
Assasz/yggdrasil
src/Yggdrasil/Core/Driver/DriverAccessorTrait.php
DriverAccessorTrait.getRouter
protected function getRouter(): RouterDriver { if (!$this->drivers->get('router') instanceof RouterDriver) { throw new DriverNotSupportedException('Provided router driver is not supported.'); } return $this->drivers->get('router'); }
php
protected function getRouter(): RouterDriver { if (!$this->drivers->get('router') instanceof RouterDriver) { throw new DriverNotSupportedException('Provided router driver is not supported.'); } return $this->drivers->get('router'); }
[ "protected", "function", "getRouter", "(", ")", ":", "RouterDriver", "{", "if", "(", "!", "$", "this", "->", "drivers", "->", "get", "(", "'router'", ")", "instanceof", "RouterDriver", ")", "{", "throw", "new", "DriverNotSupportedException", "(", "'Provided ro...
Returns router driver instance @return RouterDriver @throws DriverNotSupportedException
[ "Returns", "router", "driver", "instance" ]
bee9bef7713b85799cdd3e9b23dccae33154f3b3
https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Core/Driver/DriverAccessorTrait.php#L55-L62
train
Assasz/yggdrasil
src/Yggdrasil/Core/Driver/DriverAccessorTrait.php
DriverAccessorTrait.getTemplateEngine
protected function getTemplateEngine(): TemplateEngineDriver { if (!$this->drivers->get('templateEngine') instanceof TemplateEngineDriver) { throw new DriverNotSupportedException('Provided template engine driver is not supported.'); } return $this->drivers->get('templateEngine'); }
php
protected function getTemplateEngine(): TemplateEngineDriver { if (!$this->drivers->get('templateEngine') instanceof TemplateEngineDriver) { throw new DriverNotSupportedException('Provided template engine driver is not supported.'); } return $this->drivers->get('templateEngine'); }
[ "protected", "function", "getTemplateEngine", "(", ")", ":", "TemplateEngineDriver", "{", "if", "(", "!", "$", "this", "->", "drivers", "->", "get", "(", "'templateEngine'", ")", "instanceof", "TemplateEngineDriver", ")", "{", "throw", "new", "DriverNotSupportedEx...
Returns template engine driver instance @return TemplateEngineDriver @throws DriverNotSupportedException
[ "Returns", "template", "engine", "driver", "instance" ]
bee9bef7713b85799cdd3e9b23dccae33154f3b3
https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Core/Driver/DriverAccessorTrait.php#L70-L77
train
CeusMedia/Common
src/ADT/List/LevelMap.php
ADT_List_LevelMap.has
public function has( $key ) { if( empty( $key ) ) // no Key given throw new InvalidArgumentException( 'Key must not be empty.' ); // throw Exception if( isset( $this->pairs[$key] ) ) // Key is set on its own return TRUE; else // Key has not been found { $key .= $this->divider; // prepare Prefix Key to seach for foreach( $this->pairs as $pairKey => $pairValue ) // iterate all stores Pairs { if( $pairKey[0] !== $key[0] ) // precheck for Performance continue; // skip Pair if( strpos( $pairKey, $key ) === 0 ) // Prefix Key is found return TRUE; } } return FALSE; }
php
public function has( $key ) { if( empty( $key ) ) // no Key given throw new InvalidArgumentException( 'Key must not be empty.' ); // throw Exception if( isset( $this->pairs[$key] ) ) // Key is set on its own return TRUE; else // Key has not been found { $key .= $this->divider; // prepare Prefix Key to seach for foreach( $this->pairs as $pairKey => $pairValue ) // iterate all stores Pairs { if( $pairKey[0] !== $key[0] ) // precheck for Performance continue; // skip Pair if( strpos( $pairKey, $key ) === 0 ) // Prefix Key is found return TRUE; } } return FALSE; }
[ "public", "function", "has", "(", "$", "key", ")", "{", "if", "(", "empty", "(", "$", "key", ")", ")", "// no Key given", "throw", "new", "InvalidArgumentException", "(", "'Key must not be empty.'", ")", ";", "// throw Exception", "if", "(", "isset", "(", ...
Indicates whether a Key or Key Prefix is existing. @access public @param string $key Key in Dictionary @return bool
[ "Indicates", "whether", "a", "Key", "or", "Key", "Prefix", "is", "existing", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/List/LevelMap.php#L115-L133
train
CeusMedia/Common
src/ADT/List/LevelMap.php
ADT_List_LevelMap.remove
public function remove( $key ) { if( empty( $key ) ) // no Key given throw new InvalidArgumentException( 'Key must not be empty.' ); // throw Exception if( isset( $this->pairs[$key] ) ) // Key is set on its own unset( $this->pairs[$key] ); // remove Pair else // Key has not been found { $key .= $this->divider; // prepare Prefix Key to seach for foreach( $this->pairs as $pairKey => $pairValue ) // iterate all stores Pairs { if( $pairKey[0] !== $key[0] ) // precheck for Performance continue; // skip Pair if( strpos( $pairKey, $key ) === 0 ) // Prefix Key is found unset( $this->pairs[$pairKey] ); // remove Pair } } }
php
public function remove( $key ) { if( empty( $key ) ) // no Key given throw new InvalidArgumentException( 'Key must not be empty.' ); // throw Exception if( isset( $this->pairs[$key] ) ) // Key is set on its own unset( $this->pairs[$key] ); // remove Pair else // Key has not been found { $key .= $this->divider; // prepare Prefix Key to seach for foreach( $this->pairs as $pairKey => $pairValue ) // iterate all stores Pairs { if( $pairKey[0] !== $key[0] ) // precheck for Performance continue; // skip Pair if( strpos( $pairKey, $key ) === 0 ) // Prefix Key is found unset( $this->pairs[$pairKey] ); // remove Pair } } }
[ "public", "function", "remove", "(", "$", "key", ")", "{", "if", "(", "empty", "(", "$", "key", ")", ")", "// no Key given", "throw", "new", "InvalidArgumentException", "(", "'Key must not be empty.'", ")", ";", "// throw Exception", "if", "(", "isset", "(",...
Removes a Value or Pair Map from Dictionary by its Key. @access public @param string $key Key in Dictionary @return void
[ "Removes", "a", "Value", "or", "Pair", "Map", "from", "Dictionary", "by", "its", "Key", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/List/LevelMap.php#L141-L158
train
CeusMedia/Common
src/XML/Atom/Validator.php
XML_Atom_Validator.getErrors
public static function getErrors() { $list = array(); foreach( $this->errors as $errorKey ) $list[$errorKey] = self::$rules[$errorKey]; return $list; }
php
public static function getErrors() { $list = array(); foreach( $this->errors as $errorKey ) $list[$errorKey] = self::$rules[$errorKey]; return $list; }
[ "public", "static", "function", "getErrors", "(", ")", "{", "$", "list", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "errors", "as", "$", "errorKey", ")", "$", "list", "[", "$", "errorKey", "]", "=", "self", "::", "$", "rules", ...
Returns Error Messages of all Atom Rules hurt by Validation. Call Method 'validate'. @access public @static @return array
[ "Returns", "Error", "Messages", "of", "all", "Atom", "Rules", "hurt", "by", "Validation", ".", "Call", "Method", "validate", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/Atom/Validator.php#L79-L85
train
CeusMedia/Common
src/XML/Atom/Validator.php
XML_Atom_Validator.getFirstError
public function getFirstError() { if( !$this->errors ) return ""; $error = array_pop( array_slice( $this->errors, 0, 1 ) ); return $this->rules[$error]; }
php
public function getFirstError() { if( !$this->errors ) return ""; $error = array_pop( array_slice( $this->errors, 0, 1 ) ); return $this->rules[$error]; }
[ "public", "function", "getFirstError", "(", ")", "{", "if", "(", "!", "$", "this", "->", "errors", ")", "return", "\"\"", ";", "$", "error", "=", "array_pop", "(", "array_slice", "(", "$", "this", "->", "errors", ",", "0", ",", "1", ")", ")", ";", ...
Returns first Error Message from Validation. @access public @return string
[ "Returns", "first", "Error", "Message", "from", "Validation", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/Atom/Validator.php#L92-L98
train
CeusMedia/Common
src/Net/API/Dyn.php
Net_API_Dyn.getIp
public function getIp(){ if( (int) $this->lastCheck > 0 && time() - $this->lastCheck < 10 * 60 ) return $this->lastIp; $this->reader->setUrl( 'http://checkip.dyndns.org' ); $html = $this->reader->read(); $parts = explode( ": ", strip_tags( $html ) ); $ip = trim( array_pop( $parts ) ); $this->save( array( 'ip' => $ip, 'timestamp' => time() ) ); return $ip; }
php
public function getIp(){ if( (int) $this->lastCheck > 0 && time() - $this->lastCheck < 10 * 60 ) return $this->lastIp; $this->reader->setUrl( 'http://checkip.dyndns.org' ); $html = $this->reader->read(); $parts = explode( ": ", strip_tags( $html ) ); $ip = trim( array_pop( $parts ) ); $this->save( array( 'ip' => $ip, 'timestamp' => time() ) ); return $ip; }
[ "public", "function", "getIp", "(", ")", "{", "if", "(", "(", "int", ")", "$", "this", "->", "lastCheck", ">", "0", "&&", "time", "(", ")", "-", "$", "this", "->", "lastCheck", "<", "10", "*", "60", ")", "return", "$", "this", "->", "lastIp", "...
Returns external IP of this server identified by Dyn service. @access public @return string IP address to be identified
[ "Returns", "external", "IP", "of", "this", "server", "identified", "by", "Dyn", "service", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/API/Dyn.php#L73-L82
train
CeusMedia/Common
src/Net/API/Dyn.php
Net_API_Dyn.save
protected function save( $data ){ if( !$this->cacheFile ) return; $last = array( 'ip' => $this->lastIp, 'timestamp' => $this->lastCheck ); $data = array_merge( $last, $data ); return FS_File_Writer::save( $this->cacheFile, json_encode( $data ) ); }
php
protected function save( $data ){ if( !$this->cacheFile ) return; $last = array( 'ip' => $this->lastIp, 'timestamp' => $this->lastCheck ); $data = array_merge( $last, $data ); return FS_File_Writer::save( $this->cacheFile, json_encode( $data ) ); }
[ "protected", "function", "save", "(", "$", "data", ")", "{", "if", "(", "!", "$", "this", "->", "cacheFile", ")", "return", ";", "$", "last", "=", "array", "(", "'ip'", "=>", "$", "this", "->", "lastIp", ",", "'timestamp'", "=>", "$", "this", "->",...
Save cache. @access protected @param array $data Map of IP and timestamp @return integer Number of bytes written to cache file
[ "Save", "cache", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/API/Dyn.php#L90-L99
train
CeusMedia/Common
src/Net/API/Dyn.php
Net_API_Dyn.update
public function update( $username, $password, $host, $ip ){ if( (int) $this->lastCheck > 0 && time() - $this->lastCheck < 10 * 60 ) return "noop"; $url = "http://%s:%s@members.dyndns.org/nic/update?hostname=%s&myip=%s&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"; $url = sprintf( $url, $username, $password, $host, $ip ); $this->reader->setUrl( $url ); $parts = explode( " ", $this->reader->read() ); return array_shift( $parts ); }
php
public function update( $username, $password, $host, $ip ){ if( (int) $this->lastCheck > 0 && time() - $this->lastCheck < 10 * 60 ) return "noop"; $url = "http://%s:%s@members.dyndns.org/nic/update?hostname=%s&myip=%s&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG"; $url = sprintf( $url, $username, $password, $host, $ip ); $this->reader->setUrl( $url ); $parts = explode( " ", $this->reader->read() ); return array_shift( $parts ); }
[ "public", "function", "update", "(", "$", "username", ",", "$", "password", ",", "$", "host", ",", "$", "ip", ")", "{", "if", "(", "(", "int", ")", "$", "this", "->", "lastCheck", ">", "0", "&&", "time", "(", ")", "-", "$", "this", "->", "lastC...
Updates IP of host registered by Dyn. @access public @param string $username Dyn user name @param string $password Dyn user password @param string $host Dyn registered host @param string $ip Ip address to set for host @return string Update code string returned by Dyn service
[ "Updates", "IP", "of", "host", "registered", "by", "Dyn", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/API/Dyn.php#L110-L118
train
CeusMedia/Common
src/FS/File/Configuration/Reader.php
FS_File_Configuration_Reader.loadIniFile
protected function loadIniFile( $fileName ) { if( self::$iniQuickLoad ) { $array = parse_ini_file( $fileName, TRUE ); foreach( $array as $sectionName => $sectionData ) foreach( $sectionData as $key => $value ) $this->pairs[$sectionName.".".$key] = $value; } else { $pattern = '@^(string|integer|int|double|boolean|bool).*$@'; $reader = new FS_File_INI_Reader( $fileName, TRUE ); $comments = $reader->getComments(); foreach( $reader->getProperties() as $sectionName => $sectionData ) { foreach( $sectionData as $key => $value ) { if( isset( $comments[$sectionName][$key] ) ) { $matches = array(); if( preg_match_all( $pattern, $comments[$sectionName][$key], $matches ) ) { $type = $matches[1][0]; settype( $value, $type ); } } $this->pairs[$sectionName.".".$key] = $value; } } } }
php
protected function loadIniFile( $fileName ) { if( self::$iniQuickLoad ) { $array = parse_ini_file( $fileName, TRUE ); foreach( $array as $sectionName => $sectionData ) foreach( $sectionData as $key => $value ) $this->pairs[$sectionName.".".$key] = $value; } else { $pattern = '@^(string|integer|int|double|boolean|bool).*$@'; $reader = new FS_File_INI_Reader( $fileName, TRUE ); $comments = $reader->getComments(); foreach( $reader->getProperties() as $sectionName => $sectionData ) { foreach( $sectionData as $key => $value ) { if( isset( $comments[$sectionName][$key] ) ) { $matches = array(); if( preg_match_all( $pattern, $comments[$sectionName][$key], $matches ) ) { $type = $matches[1][0]; settype( $value, $type ); } } $this->pairs[$sectionName.".".$key] = $value; } } } }
[ "protected", "function", "loadIniFile", "(", "$", "fileName", ")", "{", "if", "(", "self", "::", "$", "iniQuickLoad", ")", "{", "$", "array", "=", "parse_ini_file", "(", "$", "fileName", ",", "TRUE", ")", ";", "foreach", "(", "$", "array", "as", "$", ...
Loads Configuration from INI File. @access protected @param string $fileName File Name of Configuration File @return void
[ "Loads", "Configuration", "from", "INI", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Reader.php#L156-L187
train
CeusMedia/Common
src/FS/File/Configuration/Reader.php
FS_File_Configuration_Reader.loadJsonFile
protected function loadJsonFile( $fileName ) { $json = FS_File_Reader::load( $fileName ); $array = ADT_JSON_Converter::convertToArray( $json ); foreach( $array as $sectionName => $sectionData ) foreach( $sectionData as $key => $item ) $this->pairs[$sectionName.".".$key] = $item['value']; }
php
protected function loadJsonFile( $fileName ) { $json = FS_File_Reader::load( $fileName ); $array = ADT_JSON_Converter::convertToArray( $json ); foreach( $array as $sectionName => $sectionData ) foreach( $sectionData as $key => $item ) $this->pairs[$sectionName.".".$key] = $item['value']; }
[ "protected", "function", "loadJsonFile", "(", "$", "fileName", ")", "{", "$", "json", "=", "FS_File_Reader", "::", "load", "(", "$", "fileName", ")", ";", "$", "array", "=", "ADT_JSON_Converter", "::", "convertToArray", "(", "$", "json", ")", ";", "foreach...
Loads Configuration from JSON File. @access protected @param string $fileName File Name of Configuration File @return void
[ "Loads", "Configuration", "from", "JSON", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Reader.php#L195-L202
train
CeusMedia/Common
src/FS/File/Configuration/Reader.php
FS_File_Configuration_Reader.loadWddxFile
protected function loadWddxFile( $fileName ) { $array = XML_WDDX_FileReader::load( $fileName ); foreach( $array as $sectionName => $sectionData ) foreach( $sectionData as $key => $value ) $this->pairs[$sectionName.".".$key] = $value; }
php
protected function loadWddxFile( $fileName ) { $array = XML_WDDX_FileReader::load( $fileName ); foreach( $array as $sectionName => $sectionData ) foreach( $sectionData as $key => $value ) $this->pairs[$sectionName.".".$key] = $value; }
[ "protected", "function", "loadWddxFile", "(", "$", "fileName", ")", "{", "$", "array", "=", "XML_WDDX_FileReader", "::", "load", "(", "$", "fileName", ")", ";", "foreach", "(", "$", "array", "as", "$", "sectionName", "=>", "$", "sectionData", ")", "foreach...
Loads Configuration from WDDX File. @access protected @param string $fileName File Name of Configuration File @return void
[ "Loads", "Configuration", "from", "WDDX", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Reader.php#L210-L216
train
CeusMedia/Common
src/FS/File/Configuration/Reader.php
FS_File_Configuration_Reader.loadXmlFile
protected function loadXmlFile( $fileName ) { $root = XML_ElementReader::readFile( $fileName ); // get root element of XML file $this->pairs = array(); foreach( $root as $sectionNode ) // iterate sections { $sectionName = $sectionNode->getAttribute( 'name' ); // get section name $this->loadXmlSection( $sectionNode, $sectionName ); // read section } ksort( $this->pairs ); // sort resulting pairs by key }
php
protected function loadXmlFile( $fileName ) { $root = XML_ElementReader::readFile( $fileName ); // get root element of XML file $this->pairs = array(); foreach( $root as $sectionNode ) // iterate sections { $sectionName = $sectionNode->getAttribute( 'name' ); // get section name $this->loadXmlSection( $sectionNode, $sectionName ); // read section } ksort( $this->pairs ); // sort resulting pairs by key }
[ "protected", "function", "loadXmlFile", "(", "$", "fileName", ")", "{", "$", "root", "=", "XML_ElementReader", "::", "readFile", "(", "$", "fileName", ")", ";", "// get root element of XML file", "$", "this", "->", "pairs", "=", "array", "(", ")", ";", "for...
Loads Configuration from XML File. @access protected @param string $fileName File Name of Configuration File @return void
[ "Loads", "Configuration", "from", "XML", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Reader.php#L224-L234
train
CeusMedia/Common
src/FS/File/Configuration/Reader.php
FS_File_Configuration_Reader.loadXmlSection
protected function loadXmlSection( $node, $path = NULL ) { $path .= $path ? '.' : ''; // extend path by delimiter foreach( $node as $child ) // iterate node children { $name = $child->getAttribute( 'name' ); // get node name of child switch( $child->getName() ){ // dispatch on node name case 'section': // section node $this->loadXmlSection( $child, $path.$name ); // load child section break; case 'value': // pair node $type = 'string'; // default type: string if( $child->hasAttribute( 'type' ) ) // type attribute is set $type = $child->getAttribute( 'type' ); // realize type attribute $value = (string) $child; // convert node content to value string settype( $value, $type ); // apply type to value $this->pairs[$path.$name] = $value; // register pair break; } } }
php
protected function loadXmlSection( $node, $path = NULL ) { $path .= $path ? '.' : ''; // extend path by delimiter foreach( $node as $child ) // iterate node children { $name = $child->getAttribute( 'name' ); // get node name of child switch( $child->getName() ){ // dispatch on node name case 'section': // section node $this->loadXmlSection( $child, $path.$name ); // load child section break; case 'value': // pair node $type = 'string'; // default type: string if( $child->hasAttribute( 'type' ) ) // type attribute is set $type = $child->getAttribute( 'type' ); // realize type attribute $value = (string) $child; // convert node content to value string settype( $value, $type ); // apply type to value $this->pairs[$path.$name] = $value; // register pair break; } } }
[ "protected", "function", "loadXmlSection", "(", "$", "node", ",", "$", "path", "=", "NULL", ")", "{", "$", "path", ".=", "$", "path", "?", "'.'", ":", "''", ";", "// extend path by delimiter", "foreach", "(", "$", "node", "as", "$", "child", ")", "// ...
Reads sections and values of a XML file node, recursivly, and stores pairs in-situ. @access protected @param XML_Element $node Section XML node to read @param string $path Path to this section @return void
[ "Reads", "sections", "and", "values", "of", "a", "XML", "file", "node", "recursivly", "and", "stores", "pairs", "in", "-", "situ", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Reader.php#L243-L263
train
CeusMedia/Common
src/FS/File/Configuration/Reader.php
FS_File_Configuration_Reader.loadYamlFile
protected function loadYamlFile( $fileName ) { $array = FS_File_YAML_Reader::load( $fileName ); foreach( $array as $sectionName => $sectionData ) foreach( $sectionData as $key => $value ) $this->pairs[$sectionName.".".$key] = $value; }
php
protected function loadYamlFile( $fileName ) { $array = FS_File_YAML_Reader::load( $fileName ); foreach( $array as $sectionName => $sectionData ) foreach( $sectionData as $key => $value ) $this->pairs[$sectionName.".".$key] = $value; }
[ "protected", "function", "loadYamlFile", "(", "$", "fileName", ")", "{", "$", "array", "=", "FS_File_YAML_Reader", "::", "load", "(", "$", "fileName", ")", ";", "foreach", "(", "$", "array", "as", "$", "sectionName", "=>", "$", "sectionData", ")", "foreach...
Loads Configuration from YAML File. @access protected @param string $fileName File Name of Configuration File @return void
[ "Loads", "Configuration", "from", "YAML", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Reader.php#L271-L277
train
CeusMedia/Common
src/FS/File/Configuration/Reader.php
FS_File_Configuration_Reader.tryToLoadFromCache
protected function tryToLoadFromCache( $cacheFile, $lastChange ) { if( !file_exists( $cacheFile ) ) return FALSE; $lastCache = @filemtime( $cacheFile ); if( $lastCache && $lastChange <= $lastCache ) { $content = file_get_contents( $cacheFile ); $array = @unserialize( $content ); if( is_array( $array ) ) { $this->pairs = $array; return TRUE; } } return FALSE; }
php
protected function tryToLoadFromCache( $cacheFile, $lastChange ) { if( !file_exists( $cacheFile ) ) return FALSE; $lastCache = @filemtime( $cacheFile ); if( $lastCache && $lastChange <= $lastCache ) { $content = file_get_contents( $cacheFile ); $array = @unserialize( $content ); if( is_array( $array ) ) { $this->pairs = $array; return TRUE; } } return FALSE; }
[ "protected", "function", "tryToLoadFromCache", "(", "$", "cacheFile", ",", "$", "lastChange", ")", "{", "if", "(", "!", "file_exists", "(", "$", "cacheFile", ")", ")", "return", "FALSE", ";", "$", "lastCache", "=", "@", "filemtime", "(", "$", "cacheFile", ...
Gernates Cache File Name and tries to load Configuration from Cache File. @access protected @param string $cacheFile File Name of Cache File @param int $lastChange Last Change of Configuration File @return bool
[ "Gernates", "Cache", "File", "Name", "and", "tries", "to", "load", "Configuration", "from", "Cache", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Reader.php#L316-L333
train
spiral/models
src/AbstractEntity.php
AbstractEntity.packValue
public function packValue(): array { $result = []; foreach ($this->fields as $field => $value) { if ($value instanceof AccessorInterface) { $result[$field] = $value->packValue(); } else { $result[$field] = $value; } } return $result; }
php
public function packValue(): array { $result = []; foreach ($this->fields as $field => $value) { if ($value instanceof AccessorInterface) { $result[$field] = $value->packValue(); } else { $result[$field] = $value; } } return $result; }
[ "public", "function", "packValue", "(", ")", ":", "array", "{", "$", "result", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "field", "=>", "$", "value", ")", "{", "if", "(", "$", "value", "instanceof", "AccessorInterfac...
Pack entity fields into plain array. @return array @throws \Spiral\Models\Exception\AccessException
[ "Pack", "entity", "fields", "into", "plain", "array", "." ]
7ad86808c938354dfc2aaaee824d72ee8a15b6fd
https://github.com/spiral/models/blob/7ad86808c938354dfc2aaaee824d72ee8a15b6fd/src/AbstractEntity.php#L268-L280
train
spiral/models
src/AbstractEntity.php
AbstractEntity.createAccessor
protected function createAccessor( $accessor, string $name, $value, array $context = [] ): AccessorInterface { if (!is_string($accessor) || !class_exists($accessor)) { throw new EntityException( "Unable to create accessor for field `{$name}` in " . static::class ); } //Field as a context return new $accessor($value, $context + ['field' => $name, 'entity' => $this]); }
php
protected function createAccessor( $accessor, string $name, $value, array $context = [] ): AccessorInterface { if (!is_string($accessor) || !class_exists($accessor)) { throw new EntityException( "Unable to create accessor for field `{$name}` in " . static::class ); } //Field as a context return new $accessor($value, $context + ['field' => $name, 'entity' => $this]); }
[ "protected", "function", "createAccessor", "(", "$", "accessor", ",", "string", "$", "name", ",", "$", "value", ",", "array", "$", "context", "=", "[", "]", ")", ":", "AccessorInterface", "{", "if", "(", "!", "is_string", "(", "$", "accessor", ")", "||...
Create instance of field accessor. @param mixed|string $accessor Might be entity implementation specific. @param string $name @param mixed $value @param array $context Custom accessor context. @return AccessorInterface|null @throws \Spiral\Models\Exception\AccessException @throws EntityException
[ "Create", "instance", "of", "field", "accessor", "." ]
7ad86808c938354dfc2aaaee824d72ee8a15b6fd
https://github.com/spiral/models/blob/7ad86808c938354dfc2aaaee824d72ee8a15b6fd/src/AbstractEntity.php#L362-L376
train
spiral/models
src/AbstractEntity.php
AbstractEntity.getMutated
private function getMutated(string $name, bool $filter, $value) { $getter = $this->getMutator($name, self::MUTATOR_GETTER); if ($filter && !empty($getter)) { try { return call_user_func($getter, $value); } catch (\Exception $e) { //Trying to filter null value, every filter must support it return call_user_func($getter, null); } } return $value; }
php
private function getMutated(string $name, bool $filter, $value) { $getter = $this->getMutator($name, self::MUTATOR_GETTER); if ($filter && !empty($getter)) { try { return call_user_func($getter, $value); } catch (\Exception $e) { //Trying to filter null value, every filter must support it return call_user_func($getter, null); } } return $value; }
[ "private", "function", "getMutated", "(", "string", "$", "name", ",", "bool", "$", "filter", ",", "$", "value", ")", "{", "$", "getter", "=", "$", "this", "->", "getMutator", "(", "$", "name", ",", "self", "::", "MUTATOR_GETTER", ")", ";", "if", "(",...
Get value thought associated mutator. @param string $name @param bool $filter @param mixed $value @return mixed
[ "Get", "value", "thought", "associated", "mutator", "." ]
7ad86808c938354dfc2aaaee824d72ee8a15b6fd
https://github.com/spiral/models/blob/7ad86808c938354dfc2aaaee824d72ee8a15b6fd/src/AbstractEntity.php#L387-L401
train
spiral/models
src/AbstractEntity.php
AbstractEntity.setMutated
private function setMutated(string $name, $value) { $setter = $this->getMutator($name, self::MUTATOR_SETTER); if (!empty($setter)) { try { $this->fields[$name] = call_user_func($setter, $value); } catch (\Exception $e) { //Exceptional situation, we are choosing to keep original field value } } else { $this->fields[$name] = $value; } }
php
private function setMutated(string $name, $value) { $setter = $this->getMutator($name, self::MUTATOR_SETTER); if (!empty($setter)) { try { $this->fields[$name] = call_user_func($setter, $value); } catch (\Exception $e) { //Exceptional situation, we are choosing to keep original field value } } else { $this->fields[$name] = $value; } }
[ "private", "function", "setMutated", "(", "string", "$", "name", ",", "$", "value", ")", "{", "$", "setter", "=", "$", "this", "->", "getMutator", "(", "$", "name", ",", "self", "::", "MUTATOR_SETTER", ")", ";", "if", "(", "!", "empty", "(", "$", "...
Set value thought associated mutator. @param string $name @param mixed $value
[ "Set", "value", "thought", "associated", "mutator", "." ]
7ad86808c938354dfc2aaaee824d72ee8a15b6fd
https://github.com/spiral/models/blob/7ad86808c938354dfc2aaaee824d72ee8a15b6fd/src/AbstractEntity.php#L409-L422
train
theodorejb/peachy-sql
lib/Mysql.php
Mysql.query
public function query(string $sql, array $params = []): Statement { $this->usedPrepare = false; $stmt = $this->prepare($sql, $params); $this->usedPrepare = true; $stmt->execute(); return $stmt; }
php
public function query(string $sql, array $params = []): Statement { $this->usedPrepare = false; $stmt = $this->prepare($sql, $params); $this->usedPrepare = true; $stmt->execute(); return $stmt; }
[ "public", "function", "query", "(", "string", "$", "sql", ",", "array", "$", "params", "=", "[", "]", ")", ":", "Statement", "{", "$", "this", "->", "usedPrepare", "=", "false", ";", "$", "stmt", "=", "$", "this", "->", "prepare", "(", "$", "sql", ...
Prepares and executes a single MySQL query with bound parameters
[ "Prepares", "and", "executes", "a", "single", "MySQL", "query", "with", "bound", "parameters" ]
f179c6fa6c4293c2713b6b59022f3cfc90890a98
https://github.com/theodorejb/peachy-sql/blob/f179c6fa6c4293c2713b6b59022f3cfc90890a98/lib/Mysql.php#L103-L110
train
theodorejb/peachy-sql
lib/Mysql.php
Mysql.insertBatch
protected function insertBatch(string $table, array $colVals, int $identityIncrement = 1): BulkInsertResult { $sqlParams = (new Insert($this->options))->buildQuery($table, $colVals); $result = $this->query($sqlParams->getSql(), $sqlParams->getParams()); $firstId = $result->getInsertId(); // ID of first inserted row, or zero if no insert ID if ($firstId) { $lastId = $firstId + $identityIncrement * (count($colVals) - 1); $ids = range($firstId, $lastId, $identityIncrement); } else { $ids = []; } return new BulkInsertResult($ids, $result->getAffected()); }
php
protected function insertBatch(string $table, array $colVals, int $identityIncrement = 1): BulkInsertResult { $sqlParams = (new Insert($this->options))->buildQuery($table, $colVals); $result = $this->query($sqlParams->getSql(), $sqlParams->getParams()); $firstId = $result->getInsertId(); // ID of first inserted row, or zero if no insert ID if ($firstId) { $lastId = $firstId + $identityIncrement * (count($colVals) - 1); $ids = range($firstId, $lastId, $identityIncrement); } else { $ids = []; } return new BulkInsertResult($ids, $result->getAffected()); }
[ "protected", "function", "insertBatch", "(", "string", "$", "table", ",", "array", "$", "colVals", ",", "int", "$", "identityIncrement", "=", "1", ")", ":", "BulkInsertResult", "{", "$", "sqlParams", "=", "(", "new", "Insert", "(", "$", "this", "->", "op...
Performs a single bulk insert query
[ "Performs", "a", "single", "bulk", "insert", "query" ]
f179c6fa6c4293c2713b6b59022f3cfc90890a98
https://github.com/theodorejb/peachy-sql/blob/f179c6fa6c4293c2713b6b59022f3cfc90890a98/lib/Mysql.php#L115-L129
train
CeusMedia/Common
src/ADT/Graph/NodeSet.php
ADT_Graph_NodeSet.addNode
public function addNode( $nodeName, $nodeValue = false ) { $newNode = new ADT_Graph_Node( $nodeName, $nodeValue ); if( !$this->isNode( $newNode ) ) { $this->nodes[] = $newNode; return $newNode; } else return $this->getNode( $nodeName ); }
php
public function addNode( $nodeName, $nodeValue = false ) { $newNode = new ADT_Graph_Node( $nodeName, $nodeValue ); if( !$this->isNode( $newNode ) ) { $this->nodes[] = $newNode; return $newNode; } else return $this->getNode( $nodeName ); }
[ "public", "function", "addNode", "(", "$", "nodeName", ",", "$", "nodeValue", "=", "false", ")", "{", "$", "newNode", "=", "new", "ADT_Graph_Node", "(", "$", "nodeName", ",", "$", "nodeValue", ")", ";", "if", "(", "!", "$", "this", "->", "isNode", "(...
Adds a new Node and returns reference of this Node. @access public @param string $nodeName Name of the new Node @param string $nodeValue Value of the new Node @return ADT_Graph_Node
[ "Adds", "a", "new", "Node", "and", "returns", "reference", "of", "this", "Node", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/Graph/NodeSet.php#L51-L61
train
CeusMedia/Common
src/ADT/Graph/NodeSet.php
ADT_Graph_NodeSet.getNode
public function getNode( $node ) { for( $i=0; $i<$this->count(); $i++ ) if( $this->nodes[$i]->getNodeName() == $node ) return $this->nodes[$i]; return NULL; }
php
public function getNode( $node ) { for( $i=0; $i<$this->count(); $i++ ) if( $this->nodes[$i]->getNodeName() == $node ) return $this->nodes[$i]; return NULL; }
[ "public", "function", "getNode", "(", "$", "node", ")", "{", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "this", "->", "count", "(", ")", ";", "$", "i", "++", ")", "if", "(", "$", "this", "->", "nodes", "[", "$", "i", "]", "-...
Returns a Node of this NodeSet. @access public @param string $node Name of the new Node @return ADT_Graph_Node
[ "Returns", "a", "Node", "of", "this", "NodeSet", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/Graph/NodeSet.php#L101-L107
train
CeusMedia/Common
src/ADT/Graph/NodeSet.php
ADT_Graph_NodeSet.getNodeIndex
private function getNodeIndex( $node ) { for( $i=0; $i<$this->count(); $i++ ) if( $this->nodes[$i] == $node ) return $i; return NULL; }
php
private function getNodeIndex( $node ) { for( $i=0; $i<$this->count(); $i++ ) if( $this->nodes[$i] == $node ) return $i; return NULL; }
[ "private", "function", "getNodeIndex", "(", "$", "node", ")", "{", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "$", "this", "->", "count", "(", ")", ";", "$", "i", "++", ")", "if", "(", "$", "this", "->", "nodes", "[", "$", "i", "]"...
Returns index of a node in this NodeSet. @access private @param ADT_Graph_Node $node Node to get index for @return int
[ "Returns", "index", "of", "a", "node", "in", "this", "NodeSet", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/Graph/NodeSet.php#L115-L121
train
CeusMedia/Common
src/ADT/Graph/NodeSet.php
ADT_Graph_NodeSet.removeNode
public function removeNode( $node ) { if( !$this->isNode( $node ) ) throw new Exception( 'Edge is not existing.' ); $index = $this->getNodeIndex( $node ); unset( $this->nodes[$index] ); sort( $this->nodes ); }
php
public function removeNode( $node ) { if( !$this->isNode( $node ) ) throw new Exception( 'Edge is not existing.' ); $index = $this->getNodeIndex( $node ); unset( $this->nodes[$index] ); sort( $this->nodes ); }
[ "public", "function", "removeNode", "(", "$", "node", ")", "{", "if", "(", "!", "$", "this", "->", "isNode", "(", "$", "node", ")", ")", "throw", "new", "Exception", "(", "'Edge is not existing.'", ")", ";", "$", "index", "=", "$", "this", "->", "get...
Removing a node. @access public @param ADT_Graph_Node $node Node to be removed @return void
[ "Removing", "a", "node", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/Graph/NodeSet.php#L153-L160
train
ncou/Chiron
src/Chiron/Http/Middleware/RequestLimitationsMiddleware.php
RequestLimitationsMiddleware.process
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { // *** Check limitation for the request uri length if (mb_strlen($request->getServerParam('REQUEST_URI'), '8bit') > 2048) { throw new UriTooLongHttpException(); } // *** Check limitation for the maximum number of headers in the request if (count($request->getHeaders()) > 100) { throw new RequestHeaderFieldsTooLargeHttpException(); } // *** Check limitation for the maximum size for all the headers if (mb_strlen(serialize((array) $request->getHeaders()), '8bit') > 4096) { throw new RequestHeaderFieldsTooLargeHttpException(); } // *** Check limitations for each header maximum size (on the 'Name' and 'Value' header fields) foreach ($request->getHeaders() as $name => $values) { // Max allowed length for the header value. if (mb_strlen(serialize((array) $values), '8bit') > 2048) { throw new RequestHeaderFieldsTooLargeHttpException(); } // Max allowed length for the header name if (mb_strlen($name, '8bit') > 64) { throw new RequestHeaderFieldsTooLargeHttpException(); } } return $handler->handle($request); }
php
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { // *** Check limitation for the request uri length if (mb_strlen($request->getServerParam('REQUEST_URI'), '8bit') > 2048) { throw new UriTooLongHttpException(); } // *** Check limitation for the maximum number of headers in the request if (count($request->getHeaders()) > 100) { throw new RequestHeaderFieldsTooLargeHttpException(); } // *** Check limitation for the maximum size for all the headers if (mb_strlen(serialize((array) $request->getHeaders()), '8bit') > 4096) { throw new RequestHeaderFieldsTooLargeHttpException(); } // *** Check limitations for each header maximum size (on the 'Name' and 'Value' header fields) foreach ($request->getHeaders() as $name => $values) { // Max allowed length for the header value. if (mb_strlen(serialize((array) $values), '8bit') > 2048) { throw new RequestHeaderFieldsTooLargeHttpException(); } // Max allowed length for the header name if (mb_strlen($name, '8bit') > 64) { throw new RequestHeaderFieldsTooLargeHttpException(); } } return $handler->handle($request); }
[ "public", "function", "process", "(", "ServerRequestInterface", "$", "request", ",", "RequestHandlerInterface", "$", "handler", ")", ":", "ResponseInterface", "{", "// *** Check limitation for the request uri length", "if", "(", "mb_strlen", "(", "$", "request", "->", "...
Throw an HTTP 414 Exception if the URI is too long. Throw an HTTP 431 Exception if the headers fields are too large. @param ServerRequestInterface $request request @param RequestHandlerInterface $handler @return object ResponseInterface
[ "Throw", "an", "HTTP", "414", "Exception", "if", "the", "URI", "is", "too", "long", ".", "Throw", "an", "HTTP", "431", "Exception", "if", "the", "headers", "fields", "are", "too", "large", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Middleware/RequestLimitationsMiddleware.php#L27-L58
train
CeusMedia/Common
src/FS/File/Log/Reader.php
FS_File_Log_Reader.load
public static function load( $fileName, $offset = NULL, $limit = NULL ) { $file = new FS_File_Reader( $fileName ); $lines = $file->readArray(); if( $offset !== NULL && $limit !== NULL && (int) $limit !== 0 ) $lines = array_slice( $lines, abs( (int) $offset ), (int) $limit ); else if( $offset !== NULL && (int) $offset !== 0 ) $lines = array_slice( $lines, (int) $offset ); return $lines; }
php
public static function load( $fileName, $offset = NULL, $limit = NULL ) { $file = new FS_File_Reader( $fileName ); $lines = $file->readArray(); if( $offset !== NULL && $limit !== NULL && (int) $limit !== 0 ) $lines = array_slice( $lines, abs( (int) $offset ), (int) $limit ); else if( $offset !== NULL && (int) $offset !== 0 ) $lines = array_slice( $lines, (int) $offset ); return $lines; }
[ "public", "static", "function", "load", "(", "$", "fileName", ",", "$", "offset", "=", "NULL", ",", "$", "limit", "=", "NULL", ")", "{", "$", "file", "=", "new", "FS_File_Reader", "(", "$", "fileName", ")", ";", "$", "lines", "=", "$", "file", "->"...
Reads a Log File and returns Lines. @access public @static @param string $uri URI of Log File @param int $offset Offset from Start or End @param int $limit Amount of Entries to return @return array
[ "Reads", "a", "Log", "File", "and", "returns", "Lines", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Log/Reader.php#L66-L75
train
CeusMedia/Common
src/FS/File/Log/Reader.php
FS_File_Log_Reader.read
public function read( $offset = NULL, $limit = NULL ) { return $this->load( $this->fileName, $offset, $limit ); }
php
public function read( $offset = NULL, $limit = NULL ) { return $this->load( $this->fileName, $offset, $limit ); }
[ "public", "function", "read", "(", "$", "offset", "=", "NULL", ",", "$", "limit", "=", "NULL", ")", "{", "return", "$", "this", "->", "load", "(", "$", "this", "->", "fileName", ",", "$", "offset", ",", "$", "limit", ")", ";", "}" ]
Reads Log File and returns Lines. @access public @param int $offset Offset from Start or End @param int $limit Amount of Entries to return @return array
[ "Reads", "Log", "File", "and", "returns", "Lines", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Log/Reader.php#L84-L87
train
meritoo/common-library
src/ValueObject/Template.php
Template.isValid
private static function isValid(string $content): bool { if ('' === $content) { return false; } return (bool)preg_match_all(static::getPlaceholderPattern(), $content); }
php
private static function isValid(string $content): bool { if ('' === $content) { return false; } return (bool)preg_match_all(static::getPlaceholderPattern(), $content); }
[ "private", "static", "function", "isValid", "(", "string", "$", "content", ")", ":", "bool", "{", "if", "(", "''", "===", "$", "content", ")", "{", "return", "false", ";", "}", "return", "(", "bool", ")", "preg_match_all", "(", "static", "::", "getPlac...
Returns information if given template is valid @param string $content Raw string with placeholders to validate (content of the template) @return bool
[ "Returns", "information", "if", "given", "template", "is", "valid" ]
b166b8b805ae97c15688d27323cae8976bd0f6dc
https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/ValueObject/Template.php#L91-L98
train
meritoo/common-library
src/ValueObject/Template.php
Template.getPlaceholders
private static function getPlaceholders(string $content): array { $result = []; $matchCount = preg_match_all(static::getPlaceholderPattern(), $content, $result); if (false !== $matchCount && 0 < $matchCount) { foreach ($result as $index => $placeholders) { $result[$index] = array_unique($placeholders); } } return $result; }
php
private static function getPlaceholders(string $content): array { $result = []; $matchCount = preg_match_all(static::getPlaceholderPattern(), $content, $result); if (false !== $matchCount && 0 < $matchCount) { foreach ($result as $index => $placeholders) { $result[$index] = array_unique($placeholders); } } return $result; }
[ "private", "static", "function", "getPlaceholders", "(", "string", "$", "content", ")", ":", "array", "{", "$", "result", "=", "[", "]", ";", "$", "matchCount", "=", "preg_match_all", "(", "static", "::", "getPlaceholderPattern", "(", ")", ",", "$", "conte...
Returns placeholders of given template @param string $content Content of template @return array
[ "Returns", "placeholders", "of", "given", "template" ]
b166b8b805ae97c15688d27323cae8976bd0f6dc
https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/ValueObject/Template.php#L106-L118
train
CeusMedia/Common
src/UI/ClassParser.php
ClassParser.getClassData
public function getClassData() { $data = array( "class" => $this->classData, "imports" => $this->imports, "methods" => $this->methods, "vars" => $this->vars, ); return $data; }
php
public function getClassData() { $data = array( "class" => $this->classData, "imports" => $this->imports, "methods" => $this->methods, "vars" => $this->vars, ); return $data; }
[ "public", "function", "getClassData", "(", ")", "{", "$", "data", "=", "array", "(", "\"class\"", "=>", "$", "this", "->", "classData", ",", "\"imports\"", "=>", "$", "this", "->", "imports", ",", "\"methods\"", "=>", "$", "this", "->", "methods", ",", ...
Returns an Array of all Properties of the Class. @access public @return array
[ "Returns", "an", "Array", "of", "all", "Properties", "of", "the", "Class", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/ClassParser.php#L143-L152
train
CeusMedia/Common
src/UI/ClassParser.php
ClassParser.getValueOfDocLine
protected function getValueOfDocLine( $line, $pattern ) { $parts = explode( $this->patterns[$pattern], $line ); $value = trim( $parts[1] ); return $value; }
php
protected function getValueOfDocLine( $line, $pattern ) { $parts = explode( $this->patterns[$pattern], $line ); $value = trim( $parts[1] ); return $value; }
[ "protected", "function", "getValueOfDocLine", "(", "$", "line", ",", "$", "pattern", ")", "{", "$", "parts", "=", "explode", "(", "$", "this", "->", "patterns", "[", "$", "pattern", "]", ",", "$", "line", ")", ";", "$", "value", "=", "trim", "(", "...
Returns the Value of a Documentation Line determined by a pattern. @access protected @param string $line Documentation Line @param string $pattern Pattern to read Docuementation Line @return string
[ "Returns", "the", "Value", "of", "a", "Documentation", "Line", "determined", "by", "a", "pattern", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/ClassParser.php#L192-L197
train
CeusMedia/Common
src/Alg/Parcel/Factory.php
Alg_Parcel_Factory.produce
public function produce( $packetName, $articles ) { if( !in_array( $packetName, $this->packets ) ) throw new InvalidArgumentException( 'Packet "'.$packetName.'" is not a valid Packet.' ); try { $packet = new Alg_Parcel_Packet( $packetName ); foreach( $articles as $articleName => $articleQuantity ) { if( !in_array( $articleName, $this->articles ) ) throw new InvalidArgumentException( 'Article "'.$articleName.'" is not a valid Article.' ); for( $i=0; $i<$articleQuantity; $i++ ) { $volume = $this->volumes[$packetName][$articleName]; $packet->addArticle( $articleName, $volume ); } } return $packet; } catch( OutOfRangeException $e ) { throw new OutOfRangeException( 'To much Articles for Packet.' ); } }
php
public function produce( $packetName, $articles ) { if( !in_array( $packetName, $this->packets ) ) throw new InvalidArgumentException( 'Packet "'.$packetName.'" is not a valid Packet.' ); try { $packet = new Alg_Parcel_Packet( $packetName ); foreach( $articles as $articleName => $articleQuantity ) { if( !in_array( $articleName, $this->articles ) ) throw new InvalidArgumentException( 'Article "'.$articleName.'" is not a valid Article.' ); for( $i=0; $i<$articleQuantity; $i++ ) { $volume = $this->volumes[$packetName][$articleName]; $packet->addArticle( $articleName, $volume ); } } return $packet; } catch( OutOfRangeException $e ) { throw new OutOfRangeException( 'To much Articles for Packet.' ); } }
[ "public", "function", "produce", "(", "$", "packetName", ",", "$", "articles", ")", "{", "if", "(", "!", "in_array", "(", "$", "packetName", ",", "$", "this", "->", "packets", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Packet \"'", ".", ...
Produces a new Packet, filled with given Articles and returns it. @access public @param string $packetName Name of Packet Size @param array $articles Articles to put into Packet @return Alg_Parcel_Packet
[ "Produces", "a", "new", "Packet", "filled", "with", "given", "Articles", "and", "returns", "it", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Parcel/Factory.php#L73-L96
train
ncou/Chiron
src/Chiron/Routing/RouteResult.php
RouteResult.fromRoute
public static function fromRoute(Route $route, array $params = []): self { $result = new self(); $result->success = true; $result->route = $route; $result->matchedParams = $params; return $result; }
php
public static function fromRoute(Route $route, array $params = []): self { $result = new self(); $result->success = true; $result->route = $route; $result->matchedParams = $params; return $result; }
[ "public", "static", "function", "fromRoute", "(", "Route", "$", "route", ",", "array", "$", "params", "=", "[", "]", ")", ":", "self", "{", "$", "result", "=", "new", "self", "(", ")", ";", "$", "result", "->", "success", "=", "true", ";", "$", "...
Create an instance representing a route succes from the matching route. @param array $params parameters associated with the matched route, if any
[ "Create", "an", "instance", "representing", "a", "route", "succes", "from", "the", "matching", "route", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Routing/RouteResult.php#L85-L93
train
ncou/Chiron
src/Chiron/Routing/RouteResult.php
RouteResult.fromRouteFailure
public static function fromRouteFailure(?array $methods): self { $result = new self(); $result->success = false; $result->allowedMethods = $methods; return $result; }
php
public static function fromRouteFailure(?array $methods): self { $result = new self(); $result->success = false; $result->allowedMethods = $methods; return $result; }
[ "public", "static", "function", "fromRouteFailure", "(", "?", "array", "$", "methods", ")", ":", "self", "{", "$", "result", "=", "new", "self", "(", ")", ";", "$", "result", "->", "success", "=", "false", ";", "$", "result", "->", "allowedMethods", "=...
Create an instance representing a route failure. @param null|array $methods HTTP methods allowed for the current URI, if any. null is equivalent to allowing any HTTP method; empty array means none.
[ "Create", "an", "instance", "representing", "a", "route", "failure", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Routing/RouteResult.php#L101-L108
train
ncou/Chiron
src/Chiron/Routing/RouteResult.php
RouteResult.isMethodFailure
public function isMethodFailure(): bool { if ($this->isSuccess() || $this->allowedMethods === self::HTTP_METHOD_ANY) { return false; } return true; }
php
public function isMethodFailure(): bool { if ($this->isSuccess() || $this->allowedMethods === self::HTTP_METHOD_ANY) { return false; } return true; }
[ "public", "function", "isMethodFailure", "(", ")", ":", "bool", "{", "if", "(", "$", "this", "->", "isSuccess", "(", ")", "||", "$", "this", "->", "allowedMethods", "===", "self", "::", "HTTP_METHOD_ANY", ")", "{", "return", "false", ";", "}", "return", ...
Does the result represent failure to route due to HTTP method?
[ "Does", "the", "result", "represent", "failure", "to", "route", "due", "to", "HTTP", "method?" ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Routing/RouteResult.php#L129-L136
train
ncou/Chiron
src/Chiron/Routing/RouteResult.php
RouteResult.getMatchedRouteMiddlewareStack
public function getMatchedRouteMiddlewareStack() { if ($this->isFailure()) { return false; } if (! $this->matchedRouteMiddlewareStack && $this->route) { $this->matchedRouteMiddlewareStack = $this->route->gatherMiddlewareStack(); } return $this->matchedRouteMiddlewareStack; }
php
public function getMatchedRouteMiddlewareStack() { if ($this->isFailure()) { return false; } if (! $this->matchedRouteMiddlewareStack && $this->route) { $this->matchedRouteMiddlewareStack = $this->route->gatherMiddlewareStack(); } return $this->matchedRouteMiddlewareStack; }
[ "public", "function", "getMatchedRouteMiddlewareStack", "(", ")", "{", "if", "(", "$", "this", "->", "isFailure", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "$", "this", "->", "matchedRouteMiddlewareStack", "&&", "$", "this", "->", ...
Retrieve all the middlewares, if possible. If this result represents a failure, return false; otherwise, return the middleware of the Route + middleware of the RouteGroup. @return false|array
[ "Retrieve", "all", "the", "middlewares", "if", "possible", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Routing/RouteResult.php#L178-L189
train
ncou/Chiron
src/Chiron/Routing/RouteResult.php
RouteResult.getAllowedMethods
public function getAllowedMethods(): ?array { if ($this->isSuccess()) { return $this->route ? $this->route->getAllowedMethods() : []; } return $this->allowedMethods; }
php
public function getAllowedMethods(): ?array { if ($this->isSuccess()) { return $this->route ? $this->route->getAllowedMethods() : []; } return $this->allowedMethods; }
[ "public", "function", "getAllowedMethods", "(", ")", ":", "?", "array", "{", "if", "(", "$", "this", "->", "isSuccess", "(", ")", ")", "{", "return", "$", "this", "->", "route", "?", "$", "this", "->", "route", "->", "getAllowedMethods", "(", ")", ":...
Retrieve the allowed methods for the route failure. @return null|string[] HTTP methods allowed
[ "Retrieve", "the", "allowed", "methods", "for", "the", "route", "failure", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Routing/RouteResult.php#L207-L216
train
CeusMedia/Common
src/UI/HTML/Exception/Trace.php
UI_HTML_Exception_Trace.renderFromTrace
public static function renderFromTrace( $trace ) { if( !is_array( $trace ) ) throw new InvalidArgumentException( "Trace must be an array" ); if( !count( $trace ) ) return ''; $i = 0; $j = 0; $list = array(); foreach( $trace as $key => $trace ) { $step = self::renderTraceStep( $trace, $i++, $j ); if( !$step ) continue; $list[] = UI_HTML_Tag::create( 'li', $step ); $j++; } return UI_HTML_Tag::create( 'ol', implode( $list ), array( 'class' => 'trace' ) ); }
php
public static function renderFromTrace( $trace ) { if( !is_array( $trace ) ) throw new InvalidArgumentException( "Trace must be an array" ); if( !count( $trace ) ) return ''; $i = 0; $j = 0; $list = array(); foreach( $trace as $key => $trace ) { $step = self::renderTraceStep( $trace, $i++, $j ); if( !$step ) continue; $list[] = UI_HTML_Tag::create( 'li', $step ); $j++; } return UI_HTML_Tag::create( 'ol', implode( $list ), array( 'class' => 'trace' ) ); }
[ "public", "static", "function", "renderFromTrace", "(", "$", "trace", ")", "{", "if", "(", "!", "is_array", "(", "$", "trace", ")", ")", "throw", "new", "InvalidArgumentException", "(", "\"Trace must be an array\"", ")", ";", "if", "(", "!", "count", "(", ...
Renders exception trace HTML code from exception trace array. @access public @param array $trace Trace of exception @return string
[ "Renders", "exception", "trace", "HTML", "code", "from", "exception", "trace", "array", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Exception/Trace.php#L60-L78
train
CeusMedia/Common
src/UI/HTML/Exception/Trace.php
UI_HTML_Exception_Trace.renderArgumentArray
protected static function renderArgumentArray( $array ) { $list = array(); foreach( $array as $key => $value ) { $type = self::renderArgumentType( $value ); $string = self::renderArgument( $value ); $list[] = UI_HTML_Tag::create( 'dt', $type." ".$key ); $list[] = UI_HTML_Tag::create( 'dd', $string ); } $list = UI_HTML_Tag::create( 'dl', implode( $list ) ); $block = UI_HTML_Tag::create( 'blockquote', $list ); return '{'.$block.'}'; }
php
protected static function renderArgumentArray( $array ) { $list = array(); foreach( $array as $key => $value ) { $type = self::renderArgumentType( $value ); $string = self::renderArgument( $value ); $list[] = UI_HTML_Tag::create( 'dt', $type." ".$key ); $list[] = UI_HTML_Tag::create( 'dd', $string ); } $list = UI_HTML_Tag::create( 'dl', implode( $list ) ); $block = UI_HTML_Tag::create( 'blockquote', $list ); return '{'.$block.'}'; }
[ "protected", "static", "function", "renderArgumentArray", "(", "$", "array", ")", "{", "$", "list", "=", "array", "(", ")", ";", "foreach", "(", "$", "array", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "type", "=", "self", "::", "renderArgu...
Renders an argument array. @access protected @static @param array $array Array to render @return string
[ "Renders", "an", "argument", "array", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Exception/Trace.php#L123-L136
train
CeusMedia/Common
src/UI/HTML/Exception/Trace.php
UI_HTML_Exception_Trace.renderArgumentType
protected static function renderArgumentType( $argument ) { $type = gettype( $argument ); $length = ''; if( $type == 'string' ) $length = '('.strlen( $argument ).')'; else if( $type == 'array' || $argument instanceof Countable ) $length = '('.count( $argument ).')'; $type = ucFirst( strtolower( gettype( $argument ) ) ); return UI_HTML_Tag::create( 'span', $type.$length, array( 'class' => 'type' ) ); }
php
protected static function renderArgumentType( $argument ) { $type = gettype( $argument ); $length = ''; if( $type == 'string' ) $length = '('.strlen( $argument ).')'; else if( $type == 'array' || $argument instanceof Countable ) $length = '('.count( $argument ).')'; $type = ucFirst( strtolower( gettype( $argument ) ) ); return UI_HTML_Tag::create( 'span', $type.$length, array( 'class' => 'type' ) ); }
[ "protected", "static", "function", "renderArgumentType", "(", "$", "argument", ")", "{", "$", "type", "=", "gettype", "(", "$", "argument", ")", ";", "$", "length", "=", "''", ";", "if", "(", "$", "type", "==", "'string'", ")", "$", "length", "=", "'...
Renders formatted argument type. @access protected @static @param string $argument Argument to render type for @return string
[ "Renders", "formatted", "argument", "type", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Exception/Trace.php#L145-L155
train
CeusMedia/Common
src/UI/HTML/Exception/Trace.php
UI_HTML_Exception_Trace.secureString
protected static function secureString( $string, $maxLength = 0, $mask = '&hellip;' ) { if( $maxLength && strlen( $string ) > $maxLength ) $value = Alg_Text_Trimmer::trimCentric( $string, $maxLength, $mask ); // $string = addslashes( $string ); $string = htmlentities( $string, ENT_QUOTES, 'UTF-8' ); $string = nl2br( $string ); return $string; }
php
protected static function secureString( $string, $maxLength = 0, $mask = '&hellip;' ) { if( $maxLength && strlen( $string ) > $maxLength ) $value = Alg_Text_Trimmer::trimCentric( $string, $maxLength, $mask ); // $string = addslashes( $string ); $string = htmlentities( $string, ENT_QUOTES, 'UTF-8' ); $string = nl2br( $string ); return $string; }
[ "protected", "static", "function", "secureString", "(", "$", "string", ",", "$", "maxLength", "=", "0", ",", "$", "mask", "=", "'&hellip;'", ")", "{", "if", "(", "$", "maxLength", "&&", "strlen", "(", "$", "string", ")", ">", "$", "maxLength", ")", "...
Applies filters on content string to avoid injections. @access public @static @param string $string String to secure @param integer $maxLength Number of characters to show at most @param string $mask Mask to show for cutted content @return string
[ "Applies", "filters", "on", "content", "string", "to", "avoid", "injections", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Exception/Trace.php#L223-L231
train
CeusMedia/Common
src/UI/HTML/Image.php
UI_HTML_Image.render
public function render() { $attributes = $this->getAttributes(); if( empty( $this->url ) ) throw new InvalidArgumentException( 'Image URL is empty' ); $attributes['title'] = (string) $this->title; $attributes['alt'] = (string) $this->title; $attributes['src'] = $this->url; return UI_HTML_Tag::create( 'img', NULL, $attributes ); }
php
public function render() { $attributes = $this->getAttributes(); if( empty( $this->url ) ) throw new InvalidArgumentException( 'Image URL is empty' ); $attributes['title'] = (string) $this->title; $attributes['alt'] = (string) $this->title; $attributes['src'] = $this->url; return UI_HTML_Tag::create( 'img', NULL, $attributes ); }
[ "public", "function", "render", "(", ")", "{", "$", "attributes", "=", "$", "this", "->", "getAttributes", "(", ")", ";", "if", "(", "empty", "(", "$", "this", "->", "url", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'Image URL is empty'", ...
Returns rendered HTML Element. @access public @return string
[ "Returns", "rendered", "HTML", "Element", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Image.php#L68-L77
train
CeusMedia/Common
src/Alg/Search/Strange.php
Alg_Search_Strange.search
public function search( $array, $key, $left = FALSE, $right = FALSE ) { if( !$right ) { $left = 0; $right = sizeof( $array ) - 1; $this->counter = 0; } $this->counter++; $index1 = round( $left + ( $right - $left ) / 3, 0 ); $index2 = round( $left + ( ( $right-$left ) / 3 ) * 2, 0 ); //echo "searching from $left to $right [$index1 - $index2]<br>"; if( $key == $array[$index1] ) return ":".$index1; if( $key == $array[$index2] ) return ":".$index2; if( $left == $right ) return false; if( $key < $array[$index1] ) return $this->search( $array, $key, $left, $index1 ); else if( $key >= $array[$index2] ) return $this->search( $array, $key, $index2, $right ); else return $this->search( $array, $key, $index1 + 1, $index2 - 1 ); }
php
public function search( $array, $key, $left = FALSE, $right = FALSE ) { if( !$right ) { $left = 0; $right = sizeof( $array ) - 1; $this->counter = 0; } $this->counter++; $index1 = round( $left + ( $right - $left ) / 3, 0 ); $index2 = round( $left + ( ( $right-$left ) / 3 ) * 2, 0 ); //echo "searching from $left to $right [$index1 - $index2]<br>"; if( $key == $array[$index1] ) return ":".$index1; if( $key == $array[$index2] ) return ":".$index2; if( $left == $right ) return false; if( $key < $array[$index1] ) return $this->search( $array, $key, $left, $index1 ); else if( $key >= $array[$index2] ) return $this->search( $array, $key, $index2, $right ); else return $this->search( $array, $key, $index1 + 1, $index2 - 1 ); }
[ "public", "function", "search", "(", "$", "array", ",", "$", "key", ",", "$", "left", "=", "FALSE", ",", "$", "right", "=", "FALSE", ")", "{", "if", "(", "!", "$", "right", ")", "{", "$", "left", "=", "0", ";", "$", "right", "=", "sizeof", "(...
Searches in List and returns position if found. @access public @param array $ist List to search in @param mixed $search Element to search @param int $left Left bound @param int $right Right bound @return int
[ "Searches", "in", "List", "and", "returns", "position", "if", "found", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Search/Strange.php#L52-L76
train
ncou/Chiron
src/Chiron/Handler/Formatter/ViewFormatter.php
ViewFormatter.format
public function format(ServerRequestInterface $request, Throwable $e): string { // This class doesn't show debug information, so by default we hide the php exception behind a neutral http 500 error. if (! $e instanceof HttpException) { $e = new \Chiron\Http\Exception\Server\InternalServerErrorHttpException(); } $info = $e->toArray(); // TODO : ajouter plus d'information dans ce tableau qui va être passé à la vue pour pouvoir utiliser ces informations => https://github.com/cakephp/cakephp/blob/dc63c2f0d8a1e9d5f336ab81b587a54929d9e1cf/src/Error/ExceptionRenderer.php#L218 /* Arguments à passer à la vue : $templateData = [ 'response' => $response, 'request' => $request, 'uri' => (string) $request->getUri(), 'status' => $response->getStatusCode(), 'reason' => $response->getReasonPhrase(), 'debug' => $this->debug, ]; if ($this->debug) { $templateData['error'] = $e; } ]*/ $info = array_merge($info, ['exception' => $e]); // TODO : vérifier qu'on accéde bien aux informations ajoutées en attribut !!!!!!!!!!!!! $statusCode = $info['status']; // TODO : gérer le cas des PDOException pour la BDD, avec un template spécial => https://github.com/cakephp/cakephp/blob/dc63c2f0d8a1e9d5f336ab81b587a54929d9e1cf/src/Error/ExceptionRenderer.php#L335 //https://github.com/cakephp/cakephp/blob/2341c3cd7c32e315c2d54b625313ef55a86ca9cc/src/Template/Error/pdo_error.ctp return $this->renderer->render("errors/{$statusCode}", $info); }
php
public function format(ServerRequestInterface $request, Throwable $e): string { // This class doesn't show debug information, so by default we hide the php exception behind a neutral http 500 error. if (! $e instanceof HttpException) { $e = new \Chiron\Http\Exception\Server\InternalServerErrorHttpException(); } $info = $e->toArray(); // TODO : ajouter plus d'information dans ce tableau qui va être passé à la vue pour pouvoir utiliser ces informations => https://github.com/cakephp/cakephp/blob/dc63c2f0d8a1e9d5f336ab81b587a54929d9e1cf/src/Error/ExceptionRenderer.php#L218 /* Arguments à passer à la vue : $templateData = [ 'response' => $response, 'request' => $request, 'uri' => (string) $request->getUri(), 'status' => $response->getStatusCode(), 'reason' => $response->getReasonPhrase(), 'debug' => $this->debug, ]; if ($this->debug) { $templateData['error'] = $e; } ]*/ $info = array_merge($info, ['exception' => $e]); // TODO : vérifier qu'on accéde bien aux informations ajoutées en attribut !!!!!!!!!!!!! $statusCode = $info['status']; // TODO : gérer le cas des PDOException pour la BDD, avec un template spécial => https://github.com/cakephp/cakephp/blob/dc63c2f0d8a1e9d5f336ab81b587a54929d9e1cf/src/Error/ExceptionRenderer.php#L335 //https://github.com/cakephp/cakephp/blob/2341c3cd7c32e315c2d54b625313ef55a86ca9cc/src/Template/Error/pdo_error.ctp return $this->renderer->render("errors/{$statusCode}", $info); }
[ "public", "function", "format", "(", "ServerRequestInterface", "$", "request", ",", "Throwable", "$", "e", ")", ":", "string", "{", "// This class doesn't show debug information, so by default we hide the php exception behind a neutral http 500 error.", "if", "(", "!", "$", "...
Render JSON error. @param \Throwable $e @return string
[ "Render", "JSON", "error", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Handler/Formatter/ViewFormatter.php#L38-L69
train
ncou/Chiron
src/Chiron/Handler/Formatter/ViewFormatter.php
ViewFormatter.canFormat
public function canFormat(Throwable $e): bool { $statusCode = $e instanceof HttpException ? $e->getStatusCode() : 500; return $this->renderer->exists("errors/{$statusCode}"); }
php
public function canFormat(Throwable $e): bool { $statusCode = $e instanceof HttpException ? $e->getStatusCode() : 500; return $this->renderer->exists("errors/{$statusCode}"); }
[ "public", "function", "canFormat", "(", "Throwable", "$", "e", ")", ":", "bool", "{", "$", "statusCode", "=", "$", "e", "instanceof", "HttpException", "?", "$", "e", "->", "getStatusCode", "(", ")", ":", "500", ";", "return", "$", "this", "->", "render...
Can we format the exception? @param \Throwable $e @return bool
[ "Can", "we", "format", "the", "exception?" ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Handler/Formatter/ViewFormatter.php#L98-L103
train
Assasz/yggdrasil
src/Yggdrasil/Utils/Service/ServiceDTOGenerator.php
ServiceDTOGenerator.generateClass
private function generateClass(): ServiceDTOGenerator { $this->DTOFile = (new PhpFile()) ->addComment('This file is auto-generated.'); $namespace = $this->inputData['namespace'] . '\\' . $this->inputData['module'] . 'Module\\' . $this->inputData['type']; $this->DTOClass = $this->DTOFile ->addNamespace($namespace) ->addClass($this->inputData['class'] . $this->inputData['type']) ->addComment($this->inputData['class'] . ' service ' . strtolower($this->inputData['type']) . PHP_EOL) ->addComment('@package ' . $namespace); return $this; }
php
private function generateClass(): ServiceDTOGenerator { $this->DTOFile = (new PhpFile()) ->addComment('This file is auto-generated.'); $namespace = $this->inputData['namespace'] . '\\' . $this->inputData['module'] . 'Module\\' . $this->inputData['type']; $this->DTOClass = $this->DTOFile ->addNamespace($namespace) ->addClass($this->inputData['class'] . $this->inputData['type']) ->addComment($this->inputData['class'] . ' service ' . strtolower($this->inputData['type']) . PHP_EOL) ->addComment('@package ' . $namespace); return $this; }
[ "private", "function", "generateClass", "(", ")", ":", "ServiceDTOGenerator", "{", "$", "this", "->", "DTOFile", "=", "(", "new", "PhpFile", "(", ")", ")", "->", "addComment", "(", "'This file is auto-generated.'", ")", ";", "$", "namespace", "=", "$", "this...
Generates service DTO class @return ServiceDTOGenerator
[ "Generates", "service", "DTO", "class" ]
bee9bef7713b85799cdd3e9b23dccae33154f3b3
https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Utils/Service/ServiceDTOGenerator.php#L67-L81
train
Assasz/yggdrasil
src/Yggdrasil/Utils/Service/ServiceDTOGenerator.php
ServiceDTOGenerator.generateProperties
private function generateProperties(): ServiceDTOGenerator { foreach ($this->inputData['properties'] as $name => $type) { if ('datetime' === $type) { $type = '\DateTime'; } $this->DTOClass ->addProperty($name) ->setVisibility('private') ->addComment($this->inputData['class'] . ' ' . $name . PHP_EOL) ->addComment('@var ' . $type . ' $' . $name); } return $this; }
php
private function generateProperties(): ServiceDTOGenerator { foreach ($this->inputData['properties'] as $name => $type) { if ('datetime' === $type) { $type = '\DateTime'; } $this->DTOClass ->addProperty($name) ->setVisibility('private') ->addComment($this->inputData['class'] . ' ' . $name . PHP_EOL) ->addComment('@var ' . $type . ' $' . $name); } return $this; }
[ "private", "function", "generateProperties", "(", ")", ":", "ServiceDTOGenerator", "{", "foreach", "(", "$", "this", "->", "inputData", "[", "'properties'", "]", "as", "$", "name", "=>", "$", "type", ")", "{", "if", "(", "'datetime'", "===", "$", "type", ...
Generates service DTO properties @return ServiceDTOGenerator
[ "Generates", "service", "DTO", "properties" ]
bee9bef7713b85799cdd3e9b23dccae33154f3b3
https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Utils/Service/ServiceDTOGenerator.php#L88-L103
train
Assasz/yggdrasil
src/Yggdrasil/Utils/Service/ServiceDTOGenerator.php
ServiceDTOGenerator.generateMethods
private function generateMethods(): ServiceDTOGenerator { foreach ($this->inputData['properties'] as $name => $type) { $this ->generateGetter($name, $type) ->generateSetter($name, $type); } return $this; }
php
private function generateMethods(): ServiceDTOGenerator { foreach ($this->inputData['properties'] as $name => $type) { $this ->generateGetter($name, $type) ->generateSetter($name, $type); } return $this; }
[ "private", "function", "generateMethods", "(", ")", ":", "ServiceDTOGenerator", "{", "foreach", "(", "$", "this", "->", "inputData", "[", "'properties'", "]", "as", "$", "name", "=>", "$", "type", ")", "{", "$", "this", "->", "generateGetter", "(", "$", ...
Generates service DTO methods @return ServiceDTOGenerator
[ "Generates", "service", "DTO", "methods" ]
bee9bef7713b85799cdd3e9b23dccae33154f3b3
https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Utils/Service/ServiceDTOGenerator.php#L110-L119
train
Assasz/yggdrasil
src/Yggdrasil/Utils/Service/ServiceDTOGenerator.php
ServiceDTOGenerator.saveFile
private function saveFile(): void { $sourceCode = Helpers::tabsToSpaces((string) $this->DTOFile); $fullPath = implode('/', [ dirname(__DIR__, 7) . '/src', $this->inputData['namespace'], $this->inputData['module'] . 'Module', $this->inputData['type'], $this->inputData['class'] . $this->inputData['type'] . '.php' ]); $dirname = dirname($fullPath); if (!is_dir($dirname)) { mkdir($dirname, 0755, true); } $handle = fopen($fullPath, 'w'); fwrite($handle, $sourceCode); fclose($handle); }
php
private function saveFile(): void { $sourceCode = Helpers::tabsToSpaces((string) $this->DTOFile); $fullPath = implode('/', [ dirname(__DIR__, 7) . '/src', $this->inputData['namespace'], $this->inputData['module'] . 'Module', $this->inputData['type'], $this->inputData['class'] . $this->inputData['type'] . '.php' ]); $dirname = dirname($fullPath); if (!is_dir($dirname)) { mkdir($dirname, 0755, true); } $handle = fopen($fullPath, 'w'); fwrite($handle, $sourceCode); fclose($handle); }
[ "private", "function", "saveFile", "(", ")", ":", "void", "{", "$", "sourceCode", "=", "Helpers", "::", "tabsToSpaces", "(", "(", "string", ")", "$", "this", "->", "DTOFile", ")", ";", "$", "fullPath", "=", "implode", "(", "'/'", ",", "[", "dirname", ...
Saves service DTO file in given path
[ "Saves", "service", "DTO", "file", "in", "given", "path" ]
bee9bef7713b85799cdd3e9b23dccae33154f3b3
https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Utils/Service/ServiceDTOGenerator.php#L186-L207
train
CeusMedia/Common
src/Net/API/DDNSS.php
Net_API_DDNSS.update
static public function update( $key, $hosts ){ if( is_array( $hosts ) ) $hosts = implode( ",", $hosts ); $url = sprintf( self::$urlUpdate, $key, $hosts ); try{ $reader = new Net_Reader( $url ); $reader->setUserAgent( "cURL" ); $response = strip_tags( $reader->read() ); if( !preg_match( "/Updated [0-9]+ /", $response ) ) return 0; $number = preg_replace( "/^.+Updated ([0-9]+) host.+$/s", "\\1", $response ); return (int) $number; } catch( Exception $e ){ die( $e->getMessage() ); } }
php
static public function update( $key, $hosts ){ if( is_array( $hosts ) ) $hosts = implode( ",", $hosts ); $url = sprintf( self::$urlUpdate, $key, $hosts ); try{ $reader = new Net_Reader( $url ); $reader->setUserAgent( "cURL" ); $response = strip_tags( $reader->read() ); if( !preg_match( "/Updated [0-9]+ /", $response ) ) return 0; $number = preg_replace( "/^.+Updated ([0-9]+) host.+$/s", "\\1", $response ); return (int) $number; } catch( Exception $e ){ die( $e->getMessage() ); } }
[ "static", "public", "function", "update", "(", "$", "key", ",", "$", "hosts", ")", "{", "if", "(", "is_array", "(", "$", "hosts", ")", ")", "$", "hosts", "=", "implode", "(", "\",\"", ",", "$", "hosts", ")", ";", "$", "url", "=", "sprintf", "(", ...
Updated host or hosts. @static @param string $key Auth key from DDNSS @param string|array $hosts Host or list of hosts @return integer Number of updated hosts @todo parse response header DDNSS-Response @todo and handle update errors
[ "Updated", "host", "or", "hosts", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/API/DDNSS.php#L55-L71
train
CeusMedia/Common
src/XML/DOM/Formater.php
XML_DOM_Formater.format
public static function format( $xml, $leadingTabs = FALSE ) { $validator = new XML_DOM_SyntaxValidator(); if( !$validator->validate( $xml ) ) throw new InvalidArgumentException( 'String is no valid XML' ); $document = new DOMDocument(); $document->preserveWhiteSpace = FALSE; $document->loadXml( $xml ); $document->formatOutput = TRUE; $xml = $document->saveXml(); if( $leadingTabs ){ $lines = explode( "\n", $xml ); foreach( $lines as $nr => $line ) while( preg_match( "/^\t* /", $lines[$nr] ) ) $lines[$nr] = preg_replace( "/^(\t*) /", "\\1\t", $lines[$nr] ); $xml = implode( "\n", $lines ); } return $xml; }
php
public static function format( $xml, $leadingTabs = FALSE ) { $validator = new XML_DOM_SyntaxValidator(); if( !$validator->validate( $xml ) ) throw new InvalidArgumentException( 'String is no valid XML' ); $document = new DOMDocument(); $document->preserveWhiteSpace = FALSE; $document->loadXml( $xml ); $document->formatOutput = TRUE; $xml = $document->saveXml(); if( $leadingTabs ){ $lines = explode( "\n", $xml ); foreach( $lines as $nr => $line ) while( preg_match( "/^\t* /", $lines[$nr] ) ) $lines[$nr] = preg_replace( "/^(\t*) /", "\\1\t", $lines[$nr] ); $xml = implode( "\n", $lines ); } return $xml; }
[ "public", "static", "function", "format", "(", "$", "xml", ",", "$", "leadingTabs", "=", "FALSE", ")", "{", "$", "validator", "=", "new", "XML_DOM_SyntaxValidator", "(", ")", ";", "if", "(", "!", "$", "validator", "->", "validate", "(", "$", "xml", ")"...
Formats a XML String with Line Breaks and Indention and returns it. @access public @static @param string $xml XML String to format @param boolean $leadingTabs Flag: replace leading spaces by tabs @return string
[ "Formats", "a", "XML", "String", "with", "Line", "Breaks", "and", "Indention", "and", "returns", "it", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/DOM/Formater.php#L52-L72
train
CeusMedia/Common
src/XML/DOM/Formater.php
XML_DOM_Formater.recode
public static function recode( $xml, $encodeTo = "UTF-8" ) { $validator = new XML_DOM_SyntaxValidator(); if( !$validator->validate( $xml ) ) throw new InvalidArgumentException( 'String is no valid XML' ); $encodeTo = strtoupper( $encodeTo ); $document = new DOMDocument(); $document->loadXml( $xml ); $encoding = strtoupper( $document->actualEncoding ); # remark( "Encoding: ".$encoding ); if( $encoding == $encodeTo ) return $xml; $pattern = '@<\?(.*) encoding=(\'|")'.$encoding.'(\'|")(.*)\?>@i'; $replacement = '<?\\1 encoding="'.$encodeTo.'"\\4?>'; $xml = iconv( $encoding, $encodeTo, $xml ); $xml = preg_replace( $pattern, $replacement, $xml ); return $xml; }
php
public static function recode( $xml, $encodeTo = "UTF-8" ) { $validator = new XML_DOM_SyntaxValidator(); if( !$validator->validate( $xml ) ) throw new InvalidArgumentException( 'String is no valid XML' ); $encodeTo = strtoupper( $encodeTo ); $document = new DOMDocument(); $document->loadXml( $xml ); $encoding = strtoupper( $document->actualEncoding ); # remark( "Encoding: ".$encoding ); if( $encoding == $encodeTo ) return $xml; $pattern = '@<\?(.*) encoding=(\'|")'.$encoding.'(\'|")(.*)\?>@i'; $replacement = '<?\\1 encoding="'.$encodeTo.'"\\4?>'; $xml = iconv( $encoding, $encodeTo, $xml ); $xml = preg_replace( $pattern, $replacement, $xml ); return $xml; }
[ "public", "static", "function", "recode", "(", "$", "xml", ",", "$", "encodeTo", "=", "\"UTF-8\"", ")", "{", "$", "validator", "=", "new", "XML_DOM_SyntaxValidator", "(", ")", ";", "if", "(", "!", "$", "validator", "->", "validate", "(", "$", "xml", ")...
Recodes a XML String to another Character Set. @access public @static @param string $xml XML String to format @param string $encodeTo Character Set to encode to @see http://www.iana.org/assignments/character-sets @return string
[ "Recodes", "a", "XML", "String", "to", "another", "Character", "Set", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/XML/DOM/Formater.php#L83-L103
train
CeusMedia/Common
src/UI/HTML/CountryFlagIcon.php
UI_HTML_CountryFlagIcon.build
public static function build( $languageCode, $title = NULL, $class = NULL ) { if( !$languageCode ) throw new InvalidArgumentException( 'No country language code given' ); $languageCode = self::transformCode( $languageCode ); $url = self::$imageBaseUri.$languageCode.".".self::$imageExtension; $code = UI_HTML_Elements::Image( $url, $title, $class ); return $code; }
php
public static function build( $languageCode, $title = NULL, $class = NULL ) { if( !$languageCode ) throw new InvalidArgumentException( 'No country language code given' ); $languageCode = self::transformCode( $languageCode ); $url = self::$imageBaseUri.$languageCode.".".self::$imageExtension; $code = UI_HTML_Elements::Image( $url, $title, $class ); return $code; }
[ "public", "static", "function", "build", "(", "$", "languageCode", ",", "$", "title", "=", "NULL", ",", "$", "class", "=", "NULL", ")", "{", "if", "(", "!", "$", "languageCode", ")", "throw", "new", "InvalidArgumentException", "(", "'No country language code...
Builds HTML Code of Country Flag Icon statically. @access public @param string $languageCode Language Code or ISO Code of Country @param string $title Title and alternative Text of Image (needed for valid XHTML) @param string $class CSS Class @return string HTML Code of Country Flag Icon
[ "Builds", "HTML", "Code", "of", "Country", "Flag", "Icon", "statically", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/CountryFlagIcon.php#L62-L70
train
CeusMedia/Common
src/UI/HTML/CountryFlagIcon.php
UI_HTML_CountryFlagIcon.transformCode
protected static function transformCode( $languageCode ) { $isoCode = $languageCode; if( $languageCode == "en" || $languageCode == "uk" ) $isoCode = "gb"; if( $languageCode == "cs" ) $isoCode = "cz"; return $isoCode; }
php
protected static function transformCode( $languageCode ) { $isoCode = $languageCode; if( $languageCode == "en" || $languageCode == "uk" ) $isoCode = "gb"; if( $languageCode == "cs" ) $isoCode = "cz"; return $isoCode; }
[ "protected", "static", "function", "transformCode", "(", "$", "languageCode", ")", "{", "$", "isoCode", "=", "$", "languageCode", ";", "if", "(", "$", "languageCode", "==", "\"en\"", "||", "$", "languageCode", "==", "\"uk\"", ")", "$", "isoCode", "=", "\"g...
Transforms special Language Codes to ISO Codes. To be overwritten. @access protected @param string $languageCode Language Code @return string
[ "Transforms", "special", "Language", "Codes", "to", "ISO", "Codes", ".", "To", "be", "overwritten", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/CountryFlagIcon.php#L78-L86
train
meritoo/common-library
src/Utilities/Xml.php
Xml.mergeNodes
public static function mergeNodes(SimpleXMLElement $element1, SimpleXMLElement $element2) { $document1 = new DOMDocument(); $document2 = new DOMDocument(); $document1->loadXML($element1->asXML()); $document2->loadXML($element2->asXML()); $path = new DOMXPath($document2); $query = $path->query('/*/*'); $nodesCount = $query->length; if (0 === $nodesCount) { return $element1; } for ($i = 0; $i < $nodesCount; ++$i) { $node = $document1->importNode($query->item($i), true); $document1->documentElement->appendChild($node); } return simplexml_import_dom($document1); }
php
public static function mergeNodes(SimpleXMLElement $element1, SimpleXMLElement $element2) { $document1 = new DOMDocument(); $document2 = new DOMDocument(); $document1->loadXML($element1->asXML()); $document2->loadXML($element2->asXML()); $path = new DOMXPath($document2); $query = $path->query('/*/*'); $nodesCount = $query->length; if (0 === $nodesCount) { return $element1; } for ($i = 0; $i < $nodesCount; ++$i) { $node = $document1->importNode($query->item($i), true); $document1->documentElement->appendChild($node); } return simplexml_import_dom($document1); }
[ "public", "static", "function", "mergeNodes", "(", "SimpleXMLElement", "$", "element1", ",", "SimpleXMLElement", "$", "element2", ")", "{", "$", "document1", "=", "new", "DOMDocument", "(", ")", ";", "$", "document2", "=", "new", "DOMDocument", "(", ")", ";"...
Merges nodes of given elements. Returns merged instance of SimpleXMLElement. @param SimpleXMLElement $element1 First element to merge @param SimpleXMLElement $element2 Second element to merge @return SimpleXMLElement
[ "Merges", "nodes", "of", "given", "elements", ".", "Returns", "merged", "instance", "of", "SimpleXMLElement", "." ]
b166b8b805ae97c15688d27323cae8976bd0f6dc
https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Utilities/Xml.php#L31-L53
train
CeusMedia/Common
src/Alg/SgmlTagReader.php
Alg_SgmlTagReader.getNodeName
public static function getNodeName( $string, $transform = 0 ) { $data = self::getTagData( $string ); switch( $transform ) { case self::TRANSFORM_LOWERCASE: return strtolower( $data['nodename'] ); case self::TRANSFORM_UPPERCASE: return strtoupper( $data['nodename'] ); default: return $data['nodename']; } }
php
public static function getNodeName( $string, $transform = 0 ) { $data = self::getTagData( $string ); switch( $transform ) { case self::TRANSFORM_LOWERCASE: return strtolower( $data['nodename'] ); case self::TRANSFORM_UPPERCASE: return strtoupper( $data['nodename'] ); default: return $data['nodename']; } }
[ "public", "static", "function", "getNodeName", "(", "$", "string", ",", "$", "transform", "=", "0", ")", "{", "$", "data", "=", "self", "::", "getTagData", "(", "$", "string", ")", ";", "switch", "(", "$", "transform", ")", "{", "case", "self", "::",...
Returns Node Name from Tag. @access public @static @param string $string String containing exactly 1 SGML based Tag @return string
[ "Returns", "Node", "Name", "from", "Tag", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/SgmlTagReader.php#L78-L87
train
CeusMedia/Common
src/Alg/SgmlTagReader.php
Alg_SgmlTagReader.getTagData
public static function getTagData( $string, $transformKeys = 0 ) { $string = trim( $string ); $attributes = array(); $content = ""; $nodename = ""; if( preg_match( "@^<([a-z]+)@", $string, $results ) ) $nodename = $results[1]; if( preg_match( "@>([^<]*)<@", $string, $results ) ) $content = $results[1]; if( preg_match_all( '@ (\S+)="([^"]+)"@', $string, $results ) ) { $array = array_combine( $results[1], $results[2] ); foreach( $array as $key => $value ) { if( $transformKeys == self::TRANSFORM_LOWERCASE ) $key = strtolower( $key ); else if( $transformKeys == self::TRANSFORM_UPPERCASE ) $key = strtoupper( $key ); $attributes[$key] = $value; } } if( preg_match_all( "@ (\S+)='([^']+)'@", $string, $results ) ) { $array = array_combine( $results[1], $results[2] ); foreach( $array as $key => $value ) { if( $transformKeys == self::TRANSFORM_LOWERCASE ) $key = strtolower( $key ); else if( $transformKeys == self::TRANSFORM_UPPERCASE ) $key = strtoupper( $key ); $attributes[$key] = $value; } } return array( 'nodename' => $nodename, 'content' => $content, 'attributes' => $attributes ); }
php
public static function getTagData( $string, $transformKeys = 0 ) { $string = trim( $string ); $attributes = array(); $content = ""; $nodename = ""; if( preg_match( "@^<([a-z]+)@", $string, $results ) ) $nodename = $results[1]; if( preg_match( "@>([^<]*)<@", $string, $results ) ) $content = $results[1]; if( preg_match_all( '@ (\S+)="([^"]+)"@', $string, $results ) ) { $array = array_combine( $results[1], $results[2] ); foreach( $array as $key => $value ) { if( $transformKeys == self::TRANSFORM_LOWERCASE ) $key = strtolower( $key ); else if( $transformKeys == self::TRANSFORM_UPPERCASE ) $key = strtoupper( $key ); $attributes[$key] = $value; } } if( preg_match_all( "@ (\S+)='([^']+)'@", $string, $results ) ) { $array = array_combine( $results[1], $results[2] ); foreach( $array as $key => $value ) { if( $transformKeys == self::TRANSFORM_LOWERCASE ) $key = strtolower( $key ); else if( $transformKeys == self::TRANSFORM_UPPERCASE ) $key = strtoupper( $key ); $attributes[$key] = $value; } } return array( 'nodename' => $nodename, 'content' => $content, 'attributes' => $attributes ); }
[ "public", "static", "function", "getTagData", "(", "$", "string", ",", "$", "transformKeys", "=", "0", ")", "{", "$", "string", "=", "trim", "(", "$", "string", ")", ";", "$", "attributes", "=", "array", "(", ")", ";", "$", "content", "=", "\"\"", ...
Returns all Information from a Tag. @access public @static @param string $string String containing exactly 1 SGML based Tag @return array
[ "Returns", "all", "Information", "from", "a", "Tag", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/SgmlTagReader.php#L96-L136
train
CeusMedia/Common
src/UI/HTML/EventMonthCalendar.php
UI_HTML_EventMonthCalendar.modifyDay
protected function modifyDay( $day ) { $classes = array(); if( (int)$this->getOption( 'show_day' ) == $day ) $classes[] = 'shown'; if( in_array( $day, $this->events ) ) { $url = $this->getOption( 'url' ); $url .= "&".$this->getOption( 'carrier_year' )."=".$this->getOption( 'show_year' ); $url .= "&".$this->getOption( 'carrier_month' )."=".$this->getOption( 'show_month' ); $url .= "&".$this->getOption( 'carrier_day' )."=".$day; $day = $this->html->Link( $url, $day ); $classes[] = 'event'; } $class = implode( ' ', $classes ); return $data = array( 'day' => $day, 'class' => $class ); }
php
protected function modifyDay( $day ) { $classes = array(); if( (int)$this->getOption( 'show_day' ) == $day ) $classes[] = 'shown'; if( in_array( $day, $this->events ) ) { $url = $this->getOption( 'url' ); $url .= "&".$this->getOption( 'carrier_year' )."=".$this->getOption( 'show_year' ); $url .= "&".$this->getOption( 'carrier_month' )."=".$this->getOption( 'show_month' ); $url .= "&".$this->getOption( 'carrier_day' )."=".$day; $day = $this->html->Link( $url, $day ); $classes[] = 'event'; } $class = implode( ' ', $classes ); return $data = array( 'day' => $day, 'class' => $class ); }
[ "protected", "function", "modifyDay", "(", "$", "day", ")", "{", "$", "classes", "=", "array", "(", ")", ";", "if", "(", "(", "int", ")", "$", "this", "->", "getOption", "(", "'show_day'", ")", "==", "$", "day", ")", "$", "classes", "[", "]", "="...
Modification of Cell Content of Days - to be overwritten. @access protected @param string $day Number of Day to modify @return string
[ "Modification", "of", "Cell", "Content", "of", "Days", "-", "to", "be", "overwritten", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/EventMonthCalendar.php#L65-L81
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.convertIniToJson
public static function convertIniToJson( $sourceFile, $targetFile ) { $data = self::loadIni( $sourceFile ); return self::saveJson( $targetFile, $data ); }
php
public static function convertIniToJson( $sourceFile, $targetFile ) { $data = self::loadIni( $sourceFile ); return self::saveJson( $targetFile, $data ); }
[ "public", "static", "function", "convertIniToJson", "(", "$", "sourceFile", ",", "$", "targetFile", ")", "{", "$", "data", "=", "self", "::", "loadIni", "(", "$", "sourceFile", ")", ";", "return", "self", "::", "saveJson", "(", "$", "targetFile", ",", "$...
Converts Configuration File from INI to JSON and returns Length of Target File. @access public @static @param string $sourceFile File Name of Source File @param string $targetFile File Name of Target File @return int
[ "Converts", "Configuration", "File", "from", "INI", "to", "JSON", "and", "returns", "Length", "of", "Target", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L63-L67
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.convertIniToXml
public static function convertIniToXml( $sourceFile, $targetFile ) { $data = self::loadIni( $sourceFile ); return self::saveXml( $targetFile, $data ); }
php
public static function convertIniToXml( $sourceFile, $targetFile ) { $data = self::loadIni( $sourceFile ); return self::saveXml( $targetFile, $data ); }
[ "public", "static", "function", "convertIniToXml", "(", "$", "sourceFile", ",", "$", "targetFile", ")", "{", "$", "data", "=", "self", "::", "loadIni", "(", "$", "sourceFile", ")", ";", "return", "self", "::", "saveXml", "(", "$", "targetFile", ",", "$",...
Converts Configuration File from INI to XML and returns Length of Target File. @access public @static @param string $sourceFile File Name of Source File @param string $targetFile File Name of Target File @return int
[ "Converts", "Configuration", "File", "from", "INI", "to", "XML", "and", "returns", "Length", "of", "Target", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L77-L81
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.convertJsonToIni
public static function convertJsonToIni( $sourceFile, $targetFile ) { $data = self::loadJson( $sourceFile ); return self::saveIni( $targetFile, $data ); }
php
public static function convertJsonToIni( $sourceFile, $targetFile ) { $data = self::loadJson( $sourceFile ); return self::saveIni( $targetFile, $data ); }
[ "public", "static", "function", "convertJsonToIni", "(", "$", "sourceFile", ",", "$", "targetFile", ")", "{", "$", "data", "=", "self", "::", "loadJson", "(", "$", "sourceFile", ")", ";", "return", "self", "::", "saveIni", "(", "$", "targetFile", ",", "$...
Converts Configuration File from JSON to INI and returns Length of Target File. @access public @static @param string $sourceFile File Name of Source File @param string $targetFile File Name of Target File @return int
[ "Converts", "Configuration", "File", "from", "JSON", "to", "INI", "and", "returns", "Length", "of", "Target", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L91-L95
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.convertJsonToXml
public static function convertJsonToXml( $sourceFile, $targetFile ) { $data = self::loadJson( $sourceFile ); return self::saveXml( $targetFile, $data ); }
php
public static function convertJsonToXml( $sourceFile, $targetFile ) { $data = self::loadJson( $sourceFile ); return self::saveXml( $targetFile, $data ); }
[ "public", "static", "function", "convertJsonToXml", "(", "$", "sourceFile", ",", "$", "targetFile", ")", "{", "$", "data", "=", "self", "::", "loadJson", "(", "$", "sourceFile", ")", ";", "return", "self", "::", "saveXml", "(", "$", "targetFile", ",", "$...
Converts Configuration File from JSON to XML and returns Length of Target File. @access public @static @param string $sourceFile File Name of Source File @param string $targetFile File Name of Target File @return int
[ "Converts", "Configuration", "File", "from", "JSON", "to", "XML", "and", "returns", "Length", "of", "Target", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L105-L109
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.convertXmlToIni
public static function convertXmlToIni( $sourceFile, $targetFile ) { $data = self::loadXml( $sourceFile ); return self::saveIni( $targetFile, $data ); }
php
public static function convertXmlToIni( $sourceFile, $targetFile ) { $data = self::loadXml( $sourceFile ); return self::saveIni( $targetFile, $data ); }
[ "public", "static", "function", "convertXmlToIni", "(", "$", "sourceFile", ",", "$", "targetFile", ")", "{", "$", "data", "=", "self", "::", "loadXml", "(", "$", "sourceFile", ")", ";", "return", "self", "::", "saveIni", "(", "$", "targetFile", ",", "$",...
Converts Configuration File from XML to INI and returns Length of Target File. @access public @static @param string $sourceFile File Name of Source File @param string $targetFile File Name of Target File @return int
[ "Converts", "Configuration", "File", "from", "XML", "to", "INI", "and", "returns", "Length", "of", "Target", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L119-L123
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.convertXmlToJson
public static function convertXmlToJson( $sourceFile, $targetFile ) { $data = self::loadXml( $sourceFile ); return self::saveJson( $targetFile, $data ); }
php
public static function convertXmlToJson( $sourceFile, $targetFile ) { $data = self::loadXml( $sourceFile ); return self::saveJson( $targetFile, $data ); }
[ "public", "static", "function", "convertXmlToJson", "(", "$", "sourceFile", ",", "$", "targetFile", ")", "{", "$", "data", "=", "self", "::", "loadXml", "(", "$", "sourceFile", ")", ";", "return", "self", "::", "saveJson", "(", "$", "targetFile", ",", "$...
Converts Configuration File from XML to JSON and returns Length of Target File. @access public @static @param string $sourceFile File Name of Source File @param string $targetFile File Name of Target File @return int
[ "Converts", "Configuration", "File", "from", "XML", "to", "JSON", "and", "returns", "Length", "of", "Target", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L133-L137
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.loadIni
protected static function loadIni( $fileName ) { $reader = new FS_File_INI_Reader( $fileName, TRUE ); $ini = $reader->getCommentedProperties(); foreach( $ini as $sectionName => $sectionData ) { foreach( $sectionData as $pair ) { $item = array( 'key' => $pair['key'], 'value' => $pair['value'], 'type' => "string", ); if( isset( $pair['comment'] ) ) { $matches = array(); if( preg_match_all( self::$iniTypePattern, $pair['comment'], $matches ) ) { $item['type'] = $matches[1][0]; if( $matches[2][0] ) $item['comment'] = $matches[2][0]; settype( $item['value'], $item['type'] ); } else $item['comment'] = $pair['comment']; } $data[$sectionName][] = $item; } } return $data; }
php
protected static function loadIni( $fileName ) { $reader = new FS_File_INI_Reader( $fileName, TRUE ); $ini = $reader->getCommentedProperties(); foreach( $ini as $sectionName => $sectionData ) { foreach( $sectionData as $pair ) { $item = array( 'key' => $pair['key'], 'value' => $pair['value'], 'type' => "string", ); if( isset( $pair['comment'] ) ) { $matches = array(); if( preg_match_all( self::$iniTypePattern, $pair['comment'], $matches ) ) { $item['type'] = $matches[1][0]; if( $matches[2][0] ) $item['comment'] = $matches[2][0]; settype( $item['value'], $item['type'] ); } else $item['comment'] = $pair['comment']; } $data[$sectionName][] = $item; } } return $data; }
[ "protected", "static", "function", "loadIni", "(", "$", "fileName", ")", "{", "$", "reader", "=", "new", "FS_File_INI_Reader", "(", "$", "fileName", ",", "TRUE", ")", ";", "$", "ini", "=", "$", "reader", "->", "getCommentedProperties", "(", ")", ";", "fo...
Loads Configuration Data from INI File. @access protected @static @param string $fileName File Name of INI File. @return array
[ "Loads", "Configuration", "Data", "from", "INI", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L146-L176
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.loadJson
protected static function loadJson( $fileName ) { $json = FS_File_Reader::load( $fileName ); $json = ADT_JSON_Converter::convertToArray( $json ); foreach( $json as $sectionName => $sectionData ) { foreach( $sectionData as $pairKey => $pairData ) { $pairData = array_merge( array( 'key' => $pairKey ), $pairData ); $data[$sectionName][] = $pairData; } } return $data; }
php
protected static function loadJson( $fileName ) { $json = FS_File_Reader::load( $fileName ); $json = ADT_JSON_Converter::convertToArray( $json ); foreach( $json as $sectionName => $sectionData ) { foreach( $sectionData as $pairKey => $pairData ) { $pairData = array_merge( array( 'key' => $pairKey ), $pairData ); $data[$sectionName][] = $pairData; } } return $data; }
[ "protected", "static", "function", "loadJson", "(", "$", "fileName", ")", "{", "$", "json", "=", "FS_File_Reader", "::", "load", "(", "$", "fileName", ")", ";", "$", "json", "=", "ADT_JSON_Converter", "::", "convertToArray", "(", "$", "json", ")", ";", "...
Loads Configuration Data from JSON File. @access protected @static @param string $fileName File Name of JSON File. @return array
[ "Loads", "Configuration", "Data", "from", "JSON", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L185-L198
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.loadXml
protected static function loadXml( $fileName ) { $xml = XML_ElementReader::readFile( $fileName ); foreach( $xml as $sectionNode ) { $sectionName = $sectionNode->getAttribute( 'name' ); foreach( $sectionNode as $valueNode ) { $item = array( 'key' => $valueNode->getAttribute( 'name' ), 'value' => (string) $valueNode, 'type' => $valueNode->getAttribute( 'type' ), ); if( $valueNode->hasAttribute( 'comment' ) ) $item['comment'] = $valueNode->getAttribute( 'comment' ); settype( $item['value'], $item['type'] ); $data[$sectionName][] = $item; } } return $data; }
php
protected static function loadXml( $fileName ) { $xml = XML_ElementReader::readFile( $fileName ); foreach( $xml as $sectionNode ) { $sectionName = $sectionNode->getAttribute( 'name' ); foreach( $sectionNode as $valueNode ) { $item = array( 'key' => $valueNode->getAttribute( 'name' ), 'value' => (string) $valueNode, 'type' => $valueNode->getAttribute( 'type' ), ); if( $valueNode->hasAttribute( 'comment' ) ) $item['comment'] = $valueNode->getAttribute( 'comment' ); settype( $item['value'], $item['type'] ); $data[$sectionName][] = $item; } } return $data; }
[ "protected", "static", "function", "loadXml", "(", "$", "fileName", ")", "{", "$", "xml", "=", "XML_ElementReader", "::", "readFile", "(", "$", "fileName", ")", ";", "foreach", "(", "$", "xml", "as", "$", "sectionNode", ")", "{", "$", "sectionName", "=",...
Loads Configuration Data from XML File. @access protected @static @param string $fileName File Name of XML File. @return array
[ "Loads", "Configuration", "Data", "from", "XML", "File", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L207-L228
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.saveIni
protected static function saveIni( $fileName, $data ) { $creator = new FS_File_INI_Creator( TRUE ); foreach( $data as $sectionName => $sectionData ) { $creator->addSection( $sectionName ); foreach( $sectionData as $pair ) { switch( $pair['type'] ) { case 'string': $pair['value'] = '"'.addslashes( $pair['value'] ).'"'; break; case 'bool': case 'boolean': $pair['value'] = $pair['value'] ? "yes" : "no"; break; } $pair['comment'] = isset( $pair['comment'] ) ? $pair['type'].": ".$pair['comment'] : $pair['type']; $creator->addProperty( $pair['key'], $pair['value'], $pair['comment'] ); } } return $creator->write( $fileName ); }
php
protected static function saveIni( $fileName, $data ) { $creator = new FS_File_INI_Creator( TRUE ); foreach( $data as $sectionName => $sectionData ) { $creator->addSection( $sectionName ); foreach( $sectionData as $pair ) { switch( $pair['type'] ) { case 'string': $pair['value'] = '"'.addslashes( $pair['value'] ).'"'; break; case 'bool': case 'boolean': $pair['value'] = $pair['value'] ? "yes" : "no"; break; } $pair['comment'] = isset( $pair['comment'] ) ? $pair['type'].": ".$pair['comment'] : $pair['type']; $creator->addProperty( $pair['key'], $pair['value'], $pair['comment'] ); } } return $creator->write( $fileName ); }
[ "protected", "static", "function", "saveIni", "(", "$", "fileName", ",", "$", "data", ")", "{", "$", "creator", "=", "new", "FS_File_INI_Creator", "(", "TRUE", ")", ";", "foreach", "(", "$", "data", "as", "$", "sectionName", "=>", "$", "sectionData", ")"...
Saves Configuration Data as INI File and returns Number of written Bytes. @access protected @static @param string $fileName File Name of INI File @param array $data Configuration Data as Array @return int
[ "Saves", "Configuration", "Data", "as", "INI", "File", "and", "returns", "Number", "of", "written", "Bytes", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L238-L261
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.saveJson
protected static function saveJson( $fileName, $data ) { $json = array(); foreach( $data as $sectionName => $sectionData ) { foreach( $sectionData as $pair ) { $key = $pair['key']; unset( $pair['key'] ); $json[$sectionName][$key] = $pair; } } $json = ADT_JSON_Formater::format( $json, TRUE ); return FS_File_Writer::save( $fileName, $json ); }
php
protected static function saveJson( $fileName, $data ) { $json = array(); foreach( $data as $sectionName => $sectionData ) { foreach( $sectionData as $pair ) { $key = $pair['key']; unset( $pair['key'] ); $json[$sectionName][$key] = $pair; } } $json = ADT_JSON_Formater::format( $json, TRUE ); return FS_File_Writer::save( $fileName, $json ); }
[ "protected", "static", "function", "saveJson", "(", "$", "fileName", ",", "$", "data", ")", "{", "$", "json", "=", "array", "(", ")", ";", "foreach", "(", "$", "data", "as", "$", "sectionName", "=>", "$", "sectionData", ")", "{", "foreach", "(", "$",...
Saves Configuration Data as JSON File and returns Number of written Bytes. @access protected @static @param string $fileName File Name of JSON File @param array $data Configuration Data as Array @return int
[ "Saves", "Configuration", "Data", "as", "JSON", "File", "and", "returns", "Number", "of", "written", "Bytes", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L271-L285
train
CeusMedia/Common
src/FS/File/Configuration/Converter.php
FS_File_Configuration_Converter.saveXml
protected static function saveXml( $fileName, $data ) { $root = new XML_DOM_Node( "configuration" ); foreach( $data as $sectionName => $sectionData ) { $sectionNode = new XML_DOM_Node( "section" ); $sectionNode->setAttribute( 'name', $sectionName ); foreach( $sectionData as $pair ) { $comment = isset( $pair['comment'] ) ? $pair['comment'] : NULL; $valueNode = new XML_DOM_Node( "value", $pair['value'] ); $valueNode->setAttribute( 'type', $pair['type'] ); $valueNode->setAttribute( 'name', $pair['key'] ); if( isset( $pair['comment'] ) ) $valueNode->setAttribute( 'comment', $comment ); $sectionNode->addChild( $valueNode ); } $root->addChild( $sectionNode ); } return XML_DOM_FileWriter::save( $fileName, $root ); }
php
protected static function saveXml( $fileName, $data ) { $root = new XML_DOM_Node( "configuration" ); foreach( $data as $sectionName => $sectionData ) { $sectionNode = new XML_DOM_Node( "section" ); $sectionNode->setAttribute( 'name', $sectionName ); foreach( $sectionData as $pair ) { $comment = isset( $pair['comment'] ) ? $pair['comment'] : NULL; $valueNode = new XML_DOM_Node( "value", $pair['value'] ); $valueNode->setAttribute( 'type', $pair['type'] ); $valueNode->setAttribute( 'name', $pair['key'] ); if( isset( $pair['comment'] ) ) $valueNode->setAttribute( 'comment', $comment ); $sectionNode->addChild( $valueNode ); } $root->addChild( $sectionNode ); } return XML_DOM_FileWriter::save( $fileName, $root ); }
[ "protected", "static", "function", "saveXml", "(", "$", "fileName", ",", "$", "data", ")", "{", "$", "root", "=", "new", "XML_DOM_Node", "(", "\"configuration\"", ")", ";", "foreach", "(", "$", "data", "as", "$", "sectionName", "=>", "$", "sectionData", ...
Saves Configuration Data as XML File and returns Number of written Bytes. @access protected @static @param string $fileName File Name of XML File @param array $data Configuration Data as Array @return int
[ "Saves", "Configuration", "Data", "as", "XML", "File", "and", "returns", "Number", "of", "written", "Bytes", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/Configuration/Converter.php#L295-L315
train
CeusMedia/Common
src/FS/File/JSON/Reader.php
FS_File_JSON_Reader.load
public static function load( $filePath, $asArray = NULL ) { $reader = new FS_File_JSON_Reader( $filePath ); return $reader->read( $asArray ); }
php
public static function load( $filePath, $asArray = NULL ) { $reader = new FS_File_JSON_Reader( $filePath ); return $reader->read( $asArray ); }
[ "public", "static", "function", "load", "(", "$", "filePath", ",", "$", "asArray", "=", "NULL", ")", "{", "$", "reader", "=", "new", "FS_File_JSON_Reader", "(", "$", "filePath", ")", ";", "return", "$", "reader", "->", "read", "(", "$", "asArray", ")",...
Reads a JSON file to an object or array statically. @access public @param string $filePath Path to JSON file @param bool $asArray Flag: read into an array @return object|array
[ "Reads", "a", "JSON", "file", "to", "an", "object", "or", "array", "statically", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/JSON/Reader.php#L75-L79
train
CeusMedia/Common
src/FS/File/JSON/Reader.php
FS_File_JSON_Reader.read
public function read( $asArray = NULL ) { $json = FS_File_Reader::load( $this->filePath ); $data = json_decode( $json, $asArray ); if( json_last_error() !== JSON_ERROR_NONE ){ $message = 'Decoding JSON failed (%s): %s'; $message = vsprintf( $message, array( ADT_Constant::getKeyByValue( 'JSON_ERROR_', json_last_error() ), json_last_error_msg() ) ); throw new RuntimeException( $message, json_last_error() ); } return $data; }
php
public function read( $asArray = NULL ) { $json = FS_File_Reader::load( $this->filePath ); $data = json_decode( $json, $asArray ); if( json_last_error() !== JSON_ERROR_NONE ){ $message = 'Decoding JSON failed (%s): %s'; $message = vsprintf( $message, array( ADT_Constant::getKeyByValue( 'JSON_ERROR_', json_last_error() ), json_last_error_msg() ) ); throw new RuntimeException( $message, json_last_error() ); } return $data; }
[ "public", "function", "read", "(", "$", "asArray", "=", "NULL", ")", "{", "$", "json", "=", "FS_File_Reader", "::", "load", "(", "$", "this", "->", "filePath", ")", ";", "$", "data", "=", "json_decode", "(", "$", "json", ",", "$", "asArray", ")", "...
Reads the JSON file to an object or array. @access public @param bool $asArray Flag: read into an array @return object|array @throws RuntimeException if parsing failed
[ "Reads", "the", "JSON", "file", "to", "an", "object", "or", "array", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/FS/File/JSON/Reader.php#L96-L109
train
ncou/Chiron
src/Chiron/Http/Middleware/SecurityHeadersMiddleware.php
SecurityHeadersMiddleware.compileHeaders
private function compileHeaders(): array { return array_merge( $this->security['settings']['enable-hsts'] ? $this->hsts() : [], $this->security['settings']['enable-hpkp'] ? $this->hpkp() : [], $this->security['settings']['enable-ect'] ? $this->ect() : [], $this->security['settings']['enable-extras'] ? $this->extras() : [] ); }
php
private function compileHeaders(): array { return array_merge( $this->security['settings']['enable-hsts'] ? $this->hsts() : [], $this->security['settings']['enable-hpkp'] ? $this->hpkp() : [], $this->security['settings']['enable-ect'] ? $this->ect() : [], $this->security['settings']['enable-extras'] ? $this->extras() : [] ); }
[ "private", "function", "compileHeaders", "(", ")", ":", "array", "{", "return", "array_merge", "(", "$", "this", "->", "security", "[", "'settings'", "]", "[", "'enable-hsts'", "]", "?", "$", "this", "->", "hsts", "(", ")", ":", "[", "]", ",", "$", "...
Compile the security HTTP headers. @return array
[ "Compile", "the", "security", "HTTP", "headers", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Middleware/SecurityHeadersMiddleware.php#L91-L99
train
ncou/Chiron
src/Chiron/Http/Middleware/SecurityHeadersMiddleware.php
SecurityHeadersMiddleware.hpkp
private function hpkp(): array { // TODO : lever une exception si les champs hashes et max-age sont vide, car ils doivent tous les deux avoir une valeur chacun (cad un hash au minimum + un maxage) $values = []; foreach ($this->security['hpkp']['hashes'] as $hash) { $values[] = sprintf('pin-sha256="%s"', $hash); } $values[] = sprintf('max-age=%d', $this->security['hpkp']['max-age']); if ($this->security['hpkp']['include-sub-domains']) { $values[] = 'includeSubDomains'; } if (! empty($this->security['hpkp']['report-uri'])) { $values[] = sprintf('report-uri="%s"', $this->security['hpkp']['report-uri']); } $header = $this->security['hpkp']['report-only'] ? 'Public-Key-Pins-Report-Only' : 'Public-Key-Pins'; return [$header => implode('; ', $values)]; }
php
private function hpkp(): array { // TODO : lever une exception si les champs hashes et max-age sont vide, car ils doivent tous les deux avoir une valeur chacun (cad un hash au minimum + un maxage) $values = []; foreach ($this->security['hpkp']['hashes'] as $hash) { $values[] = sprintf('pin-sha256="%s"', $hash); } $values[] = sprintf('max-age=%d', $this->security['hpkp']['max-age']); if ($this->security['hpkp']['include-sub-domains']) { $values[] = 'includeSubDomains'; } if (! empty($this->security['hpkp']['report-uri'])) { $values[] = sprintf('report-uri="%s"', $this->security['hpkp']['report-uri']); } $header = $this->security['hpkp']['report-only'] ? 'Public-Key-Pins-Report-Only' : 'Public-Key-Pins'; return [$header => implode('; ', $values)]; }
[ "private", "function", "hpkp", "(", ")", ":", "array", "{", "// TODO : lever une exception si les champs hashes et max-age sont vide, car ils doivent tous les deux avoir une valeur chacun (cad un hash au minimum + un maxage)", "$", "values", "=", "[", "]", ";", "foreach", "(", "$",...
Get HPKP header. @see https://tools.ietf.org/html/rfc7469 @return array
[ "Get", "HPKP", "header", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Middleware/SecurityHeadersMiddleware.php#L129-L148
train
ncou/Chiron
src/Chiron/Http/Middleware/SecurityHeadersMiddleware.php
SecurityHeadersMiddleware.ect
private function ect(): array { $ect = "max-age={$this->security['ect']['max-age']}"; if ($this->security['ect']['enforce']) { $ect .= ', enforce'; } if (! empty($this->security['ect']['report-uri'])) { $ect .= sprintf(', report-uri="%s"', $this->security['ect']['report-uri']); } return ['Expect-CT' => $ect]; }
php
private function ect(): array { $ect = "max-age={$this->security['ect']['max-age']}"; if ($this->security['ect']['enforce']) { $ect .= ', enforce'; } if (! empty($this->security['ect']['report-uri'])) { $ect .= sprintf(', report-uri="%s"', $this->security['ect']['report-uri']); } return ['Expect-CT' => $ect]; }
[ "private", "function", "ect", "(", ")", ":", "array", "{", "$", "ect", "=", "\"max-age={$this->security['ect']['max-age']}\"", ";", "if", "(", "$", "this", "->", "security", "[", "'ect'", "]", "[", "'enforce'", "]", ")", "{", "$", "ect", ".=", "', enforce'...
Get Expect-CT header. @see https://tools.ietf.org/html/draft-ietf-httpbis-expect-ct-03 @return array
[ "Get", "Expect", "-", "CT", "header", "." ]
bfb6f85faba0e54005896b09a7c34e456d1a1bed
https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Middleware/SecurityHeadersMiddleware.php#L157-L169
train
CeusMedia/Common
src/UI/HTML/Tree/LayerMenu.php
UI_HTML_Tree_LayerMenu.buildMenuFromOpml
public function buildMenuFromOpml( $opml ) { $list = Alg_Tree_Menu_Converter::convertFromOpml( $opml, $this->rootLabel ); return $this->buildMenuFromMenuList( $list ); }
php
public function buildMenuFromOpml( $opml ) { $list = Alg_Tree_Menu_Converter::convertFromOpml( $opml, $this->rootLabel ); return $this->buildMenuFromMenuList( $list ); }
[ "public", "function", "buildMenuFromOpml", "(", "$", "opml", ")", "{", "$", "list", "=", "Alg_Tree_Menu_Converter", "::", "convertFromOpml", "(", "$", "opml", ",", "$", "this", "->", "rootLabel", ")", ";", "return", "$", "this", "->", "buildMenuFromMenuList", ...
Builds Layer Menu from OPML String. @access public @param string $opml OPML String @return
[ "Builds", "Layer", "Menu", "from", "OPML", "String", "." ]
1138adf9341782a6284c05884989f7497532bcf4
https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Tree/LayerMenu.php#L155-L159
train
Assasz/yggdrasil
src/Yggdrasil/Core/Controller/AbstractController.php
AbstractController.render
protected function render(string $view, array $params = []): Response { $this->getTemplateEngine()->addGlobal('_request', $this->getRequest()); $template = $this->getTemplateEngine()->render($view, $params); return $this->getResponse()->setContent($template); }
php
protected function render(string $view, array $params = []): Response { $this->getTemplateEngine()->addGlobal('_request', $this->getRequest()); $template = $this->getTemplateEngine()->render($view, $params); return $this->getResponse()->setContent($template); }
[ "protected", "function", "render", "(", "string", "$", "view", ",", "array", "$", "params", "=", "[", "]", ")", ":", "Response", "{", "$", "this", "->", "getTemplateEngine", "(", ")", "->", "addGlobal", "(", "'_request'", ",", "$", "this", "->", "getRe...
Renders given view as response @param string $view Name of view file @param array $params Parameters supposed to be passed to the view @return Response
[ "Renders", "given", "view", "as", "response" ]
bee9bef7713b85799cdd3e9b23dccae33154f3b3
https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Core/Controller/AbstractController.php#L63-L69
train