id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
36,200 | CeusMedia/Common | src/Net/HTTP/Reader.php | Net_HTTP_Reader.get | public function get( $url, $headers = array(), $curlOptions = array() )
{
$curl = clone( $this->curl );
$curl->setOption( CURLOPT_URL, $url );
if( $headers )
{
if( $headers instanceof Net_HTTP_Header_Section )
$headers = $headers->toArray();
$curlOptions[CURLOPT_HTTPHEADER] = $headers;
}
$this->applyCurlOptions( $curl, $curlOptions );
$response = $curl->exec( TRUE, FALSE );
$this->curlInfo = $curl->getInfo();
$response = Net_HTTP_Response_Parser::fromString( $response );
/* $encodings = $response->headers->getField( 'content-encoding' );
while( $encoding = array_pop( $encodings ) )
{
$decompressor = new Net_HTTP_Response_Decompressor;
$type = $encoding->getValue();
$body = $decompressor->decompressString( $response->getBody(), $type );
}
$response->setBody( $body );*/
return $response;
} | php | public function get( $url, $headers = array(), $curlOptions = array() )
{
$curl = clone( $this->curl );
$curl->setOption( CURLOPT_URL, $url );
if( $headers )
{
if( $headers instanceof Net_HTTP_Header_Section )
$headers = $headers->toArray();
$curlOptions[CURLOPT_HTTPHEADER] = $headers;
}
$this->applyCurlOptions( $curl, $curlOptions );
$response = $curl->exec( TRUE, FALSE );
$this->curlInfo = $curl->getInfo();
$response = Net_HTTP_Response_Parser::fromString( $response );
/* $encodings = $response->headers->getField( 'content-encoding' );
while( $encoding = array_pop( $encodings ) )
{
$decompressor = new Net_HTTP_Response_Decompressor;
$type = $encoding->getValue();
$body = $decompressor->decompressString( $response->getBody(), $type );
}
$response->setBody( $body );*/
return $response;
} | [
"public",
"function",
"get",
"(",
"$",
"url",
",",
"$",
"headers",
"=",
"array",
"(",
")",
",",
"$",
"curlOptions",
"=",
"array",
"(",
")",
")",
"{",
"$",
"curl",
"=",
"clone",
"(",
"$",
"this",
"->",
"curl",
")",
";",
"$",
"curl",
"->",
"setOption",
"(",
"CURLOPT_URL",
",",
"$",
"url",
")",
";",
"if",
"(",
"$",
"headers",
")",
"{",
"if",
"(",
"$",
"headers",
"instanceof",
"Net_HTTP_Header_Section",
")",
"$",
"headers",
"=",
"$",
"headers",
"->",
"toArray",
"(",
")",
";",
"$",
"curlOptions",
"[",
"CURLOPT_HTTPHEADER",
"]",
"=",
"$",
"headers",
";",
"}",
"$",
"this",
"->",
"applyCurlOptions",
"(",
"$",
"curl",
",",
"$",
"curlOptions",
")",
";",
"$",
"response",
"=",
"$",
"curl",
"->",
"exec",
"(",
"TRUE",
",",
"FALSE",
")",
";",
"$",
"this",
"->",
"curlInfo",
"=",
"$",
"curl",
"->",
"getInfo",
"(",
")",
";",
"$",
"response",
"=",
"Net_HTTP_Response_Parser",
"::",
"fromString",
"(",
"$",
"response",
")",
";",
"/*\t\t$encodings\t= $response->headers->getField( 'content-encoding' );\n\t\twhile( $encoding = array_pop( $encodings ) )\n\t\t{\n\t\t\t$decompressor\t= new Net_HTTP_Response_Decompressor;\n\t\t\t$type\t\t\t= $encoding->getValue();\n\t\t\t$body\t\t\t= $decompressor->decompressString( $response->getBody(), $type );\n\t\t}\n\t\t$response->setBody( $body );*/",
"return",
"$",
"response",
";",
"}"
] | Returns Resource Response.
@access public
@param string $url Resource URL
@param array|Net_HTTP_Header_Section $headers Map of HTTP Header Fields or Header Section Object
@param array $curlOptions Map of cURL Options
@return Net_HTTP_Response | [
"Returns",
"Resource",
"Response",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Reader.php#L96-L119 |
36,201 | CeusMedia/Common | src/Net/HTTP/Reader.php | Net_HTTP_Reader.getCurlInfo | public function getCurlInfo( $key = NULL )
{
if( !$this->curlInfo )
throw new RuntimeException( "No Request has been sent, yet." );
if( !$key )
return $this->curlInfo;
if( !array_key_exists( $key, $this->curlInfo ) )
throw new InvalidArgumentException( 'Status Key "'.$key.'" is invalid.' );
return $this->curlInfo[$key];
} | php | public function getCurlInfo( $key = NULL )
{
if( !$this->curlInfo )
throw new RuntimeException( "No Request has been sent, yet." );
if( !$key )
return $this->curlInfo;
if( !array_key_exists( $key, $this->curlInfo ) )
throw new InvalidArgumentException( 'Status Key "'.$key.'" is invalid.' );
return $this->curlInfo[$key];
} | [
"public",
"function",
"getCurlInfo",
"(",
"$",
"key",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"curlInfo",
")",
"throw",
"new",
"RuntimeException",
"(",
"\"No Request has been sent, yet.\"",
")",
";",
"if",
"(",
"!",
"$",
"key",
")",
"return",
"$",
"this",
"->",
"curlInfo",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"curlInfo",
")",
")",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Status Key \"'",
".",
"$",
"key",
".",
"'\" is invalid.'",
")",
";",
"return",
"$",
"this",
"->",
"curlInfo",
"[",
"$",
"key",
"]",
";",
"}"
] | Returns Info Array or single Information from last cURL Request.
@access public
@param string $key Information Key
@return mixed | [
"Returns",
"Info",
"Array",
"or",
"single",
"Information",
"from",
"last",
"cURL",
"Request",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Reader.php#L127-L136 |
36,202 | CeusMedia/Common | src/Net/HTTP/Reader.php | Net_HTTP_Reader.post | public function post( $url, $data, $headers = array(), $curlOptions = array() )
{
$curl = clone( $this->curl );
$curl->setOption( CURLOPT_URL, $url );
if( $headers )
{
if( $headers instanceof Net_HTTP_Header_Section )
$headers = $headers->toArray();
$curlOptions[CURLOPT_HTTPHEADER] = $headers;
}
$this->applyCurlOptions( $curl, $curlOptions );
if( is_array( $data ) )
{
foreach( $data as $key => $value ) // cURL hack (file upload identifier)
if( is_string( $value ) && substr( $value, 0, 1 ) == "@" ) // leading @ in field values
$data[$key] = "\\".$value; // need to be escaped
$data = http_build_query( $data, NULL, "&" );
}
$curl->setOption( CURLOPT_POST, TRUE );
$curl->setOption( CURLOPT_POSTFIELDS, (string) $data );
$response = $curl->exec( TRUE, FALSE );
$this->curlInfo = $curl->getInfo();
$response = Net_HTTP_Response_Parser::fromString( $response );
return $response;
} | php | public function post( $url, $data, $headers = array(), $curlOptions = array() )
{
$curl = clone( $this->curl );
$curl->setOption( CURLOPT_URL, $url );
if( $headers )
{
if( $headers instanceof Net_HTTP_Header_Section )
$headers = $headers->toArray();
$curlOptions[CURLOPT_HTTPHEADER] = $headers;
}
$this->applyCurlOptions( $curl, $curlOptions );
if( is_array( $data ) )
{
foreach( $data as $key => $value ) // cURL hack (file upload identifier)
if( is_string( $value ) && substr( $value, 0, 1 ) == "@" ) // leading @ in field values
$data[$key] = "\\".$value; // need to be escaped
$data = http_build_query( $data, NULL, "&" );
}
$curl->setOption( CURLOPT_POST, TRUE );
$curl->setOption( CURLOPT_POSTFIELDS, (string) $data );
$response = $curl->exec( TRUE, FALSE );
$this->curlInfo = $curl->getInfo();
$response = Net_HTTP_Response_Parser::fromString( $response );
return $response;
} | [
"public",
"function",
"post",
"(",
"$",
"url",
",",
"$",
"data",
",",
"$",
"headers",
"=",
"array",
"(",
")",
",",
"$",
"curlOptions",
"=",
"array",
"(",
")",
")",
"{",
"$",
"curl",
"=",
"clone",
"(",
"$",
"this",
"->",
"curl",
")",
";",
"$",
"curl",
"->",
"setOption",
"(",
"CURLOPT_URL",
",",
"$",
"url",
")",
";",
"if",
"(",
"$",
"headers",
")",
"{",
"if",
"(",
"$",
"headers",
"instanceof",
"Net_HTTP_Header_Section",
")",
"$",
"headers",
"=",
"$",
"headers",
"->",
"toArray",
"(",
")",
";",
"$",
"curlOptions",
"[",
"CURLOPT_HTTPHEADER",
"]",
"=",
"$",
"headers",
";",
"}",
"$",
"this",
"->",
"applyCurlOptions",
"(",
"$",
"curl",
",",
"$",
"curlOptions",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"// cURL hack (file upload identifier)",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"substr",
"(",
"$",
"value",
",",
"0",
",",
"1",
")",
"==",
"\"@\"",
")",
"// leading @ in field values",
"$",
"data",
"[",
"$",
"key",
"]",
"=",
"\"\\\\\"",
".",
"$",
"value",
";",
"// need to be escaped",
"$",
"data",
"=",
"http_build_query",
"(",
"$",
"data",
",",
"NULL",
",",
"\"&\"",
")",
";",
"}",
"$",
"curl",
"->",
"setOption",
"(",
"CURLOPT_POST",
",",
"TRUE",
")",
";",
"$",
"curl",
"->",
"setOption",
"(",
"CURLOPT_POSTFIELDS",
",",
"(",
"string",
")",
"$",
"data",
")",
";",
"$",
"response",
"=",
"$",
"curl",
"->",
"exec",
"(",
"TRUE",
",",
"FALSE",
")",
";",
"$",
"this",
"->",
"curlInfo",
"=",
"$",
"curl",
"->",
"getInfo",
"(",
")",
";",
"$",
"response",
"=",
"Net_HTTP_Response_Parser",
"::",
"fromString",
"(",
"$",
"response",
")",
";",
"return",
"$",
"response",
";",
"}"
] | Posts Data to Resource and returns Response.
@access public
@param string $url Resource URL
@param array $data Map of POST Data
@param array|Net_HTTP_Header_Section $headers Map of HTTP Header Fields or Header Section Object
@param array $curlOptions Map of cURL Options
@return Net_HTTP_Response | [
"Posts",
"Data",
"to",
"Resource",
"and",
"returns",
"Response",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Reader.php#L147-L173 |
36,203 | CeusMedia/Common | src/Net/HTTP/Reader.php | Net_HTTP_Reader.setBasicAuth | public function setBasicAuth( $username, $password )
{
$this->curl->setOption( CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
$this->curl->setOption( CURLOPT_USERPWD, $username.":".$password );
} | php | public function setBasicAuth( $username, $password )
{
$this->curl->setOption( CURLOPT_HTTPAUTH, CURLAUTH_BASIC );
$this->curl->setOption( CURLOPT_USERPWD, $username.":".$password );
} | [
"public",
"function",
"setBasicAuth",
"(",
"$",
"username",
",",
"$",
"password",
")",
"{",
"$",
"this",
"->",
"curl",
"->",
"setOption",
"(",
"CURLOPT_HTTPAUTH",
",",
"CURLAUTH_BASIC",
")",
";",
"$",
"this",
"->",
"curl",
"->",
"setOption",
"(",
"CURLOPT_USERPWD",
",",
"$",
"username",
".",
"\":\"",
".",
"$",
"password",
")",
";",
"}"
] | Set Username and Password for Basic Auth.
@access public
@param string $username Basic Auth Username
@param string $password Basic Auth Password
@return void | [
"Set",
"Username",
"and",
"Password",
"for",
"Basic",
"Auth",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Reader.php#L182-L186 |
36,204 | CeusMedia/Common | src/Net/HTTP/Reader.php | Net_HTTP_Reader.setUserAgent | public function setUserAgent( $string )
{
if( empty( $string ) )
throw new InvaligArgumentException( 'Must be set' );
$this->curl->setOption( CURLOPT_USERAGENT, $string );
} | php | public function setUserAgent( $string )
{
if( empty( $string ) )
throw new InvaligArgumentException( 'Must be set' );
$this->curl->setOption( CURLOPT_USERAGENT, $string );
} | [
"public",
"function",
"setUserAgent",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"string",
")",
")",
"throw",
"new",
"InvaligArgumentException",
"(",
"'Must be set'",
")",
";",
"$",
"this",
"->",
"curl",
"->",
"setOption",
"(",
"CURLOPT_USERAGENT",
",",
"$",
"string",
")",
";",
"}"
] | Sets User Agent.
@access public
@param string $string User Agent to set
@return void | [
"Sets",
"User",
"Agent",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Reader.php#L236-L241 |
36,205 | CeusMedia/Common | src/Net/HTTP/Reader.php | Net_HTTP_Reader.setVerify | public function setVerify( $host = FALSE, $peer = 0, $caPath = NULL, $caInfo = NULL )
{
$this->curl->setOption( CURLOPT_SSL_VERIFYHOST, $host );
$this->curl->setOption( CURLOPT_SSL_VERIFYPEER, $peer );
$this->curl->setOption( CURLOPT_CAPATH, $caPath );
$this->curl->setOption( CURLOPT_CAINFO, $caInfo );
} | php | public function setVerify( $host = FALSE, $peer = 0, $caPath = NULL, $caInfo = NULL )
{
$this->curl->setOption( CURLOPT_SSL_VERIFYHOST, $host );
$this->curl->setOption( CURLOPT_SSL_VERIFYPEER, $peer );
$this->curl->setOption( CURLOPT_CAPATH, $caPath );
$this->curl->setOption( CURLOPT_CAINFO, $caInfo );
} | [
"public",
"function",
"setVerify",
"(",
"$",
"host",
"=",
"FALSE",
",",
"$",
"peer",
"=",
"0",
",",
"$",
"caPath",
"=",
"NULL",
",",
"$",
"caInfo",
"=",
"NULL",
")",
"{",
"$",
"this",
"->",
"curl",
"->",
"setOption",
"(",
"CURLOPT_SSL_VERIFYHOST",
",",
"$",
"host",
")",
";",
"$",
"this",
"->",
"curl",
"->",
"setOption",
"(",
"CURLOPT_SSL_VERIFYPEER",
",",
"$",
"peer",
")",
";",
"$",
"this",
"->",
"curl",
"->",
"setOption",
"(",
"CURLOPT_CAPATH",
",",
"$",
"caPath",
")",
";",
"$",
"this",
"->",
"curl",
"->",
"setOption",
"(",
"CURLOPT_CAINFO",
",",
"$",
"caInfo",
")",
";",
"}"
] | Sets up SSL Verification.
@access public
@param boolean $host Flag: verify Host
@param integer $peer Flag: verify Peer
@param string $caPath Path to certificates
@param string $caInfo Certificate File Name
@return void | [
"Sets",
"up",
"SSL",
"Verification",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Reader.php#L252-L258 |
36,206 | CeusMedia/Common | src/UI/HTML/Link.php | UI_HTML_Link.render | public function render()
{
$attributes = $this->getAttributes();
if( is_array( $attributes['href'] ) )
$attributes['href'] = ADT_URL_Inference::buildStatic( $attributes['href'] );
$content = $this->renderInner( $this->content );
if( !is_string( $content ) )
throw new InvalidArgumentException( 'Link label is neither rendered nor renderable' );
return UI_HTML_Tag::create( "a", $content, $attributes );
} | php | public function render()
{
$attributes = $this->getAttributes();
if( is_array( $attributes['href'] ) )
$attributes['href'] = ADT_URL_Inference::buildStatic( $attributes['href'] );
$content = $this->renderInner( $this->content );
if( !is_string( $content ) )
throw new InvalidArgumentException( 'Link label is neither rendered nor renderable' );
return UI_HTML_Tag::create( "a", $content, $attributes );
} | [
"public",
"function",
"render",
"(",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"getAttributes",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"attributes",
"[",
"'href'",
"]",
")",
")",
"$",
"attributes",
"[",
"'href'",
"]",
"=",
"ADT_URL_Inference",
"::",
"buildStatic",
"(",
"$",
"attributes",
"[",
"'href'",
"]",
")",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"renderInner",
"(",
"$",
"this",
"->",
"content",
")",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"content",
")",
")",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Link label is neither rendered nor renderable'",
")",
";",
"return",
"UI_HTML_Tag",
"::",
"create",
"(",
"\"a\"",
",",
"$",
"content",
",",
"$",
"attributes",
")",
";",
"}"
] | Returns rendered Link Element
@access public
@return string | [
"Returns",
"rendered",
"Link",
"Element"
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Link.php#L67-L76 |
36,207 | CeusMedia/Common | src/CLI/Fork/Worker/Abstract.php | CLI_Fork_Worker_Abstract.handleSignal | protected function handleSignal( $signalNumber )
{
switch( $signalNumber )
{
case SIGHUP:
$this->handleHangupSignal();
break;
case SIGTERM:
$this->handleTerminationSignal();
break;
default:
$this->handleUnknownSignal();
}
} | php | protected function handleSignal( $signalNumber )
{
switch( $signalNumber )
{
case SIGHUP:
$this->handleHangupSignal();
break;
case SIGTERM:
$this->handleTerminationSignal();
break;
default:
$this->handleUnknownSignal();
}
} | [
"protected",
"function",
"handleSignal",
"(",
"$",
"signalNumber",
")",
"{",
"switch",
"(",
"$",
"signalNumber",
")",
"{",
"case",
"SIGHUP",
":",
"$",
"this",
"->",
"handleHangupSignal",
"(",
")",
";",
"break",
";",
"case",
"SIGTERM",
":",
"$",
"this",
"->",
"handleTerminationSignal",
"(",
")",
";",
"break",
";",
"default",
":",
"$",
"this",
"->",
"handleUnknownSignal",
"(",
")",
";",
"}",
"}"
] | Handle Process Signals.
@access protected
@param int $signalNumber
@return void | [
"Handle",
"Process",
"Signals",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/CLI/Fork/Worker/Abstract.php#L87-L100 |
36,208 | CeusMedia/Common | src/Alg/Object/MethodFactory.php | Alg_Object_MethodFactory.call | public static function call( $mixed, $methodName, $methodParameters = array(), $classParameters = array(), $checkMethod = TRUE, $allowProtected = FALSE )
{
if( is_object( $mixed ) )
return self::callObjectMethod( $mixed, $methodName, $methodParameters, $checkMethod, $allowProtected );
return self::callClassMethod( $mixed, $methodName, $classParameters, $methodParameters, $checkMethod, $allowProtected );
} | php | public static function call( $mixed, $methodName, $methodParameters = array(), $classParameters = array(), $checkMethod = TRUE, $allowProtected = FALSE )
{
if( is_object( $mixed ) )
return self::callObjectMethod( $mixed, $methodName, $methodParameters, $checkMethod, $allowProtected );
return self::callClassMethod( $mixed, $methodName, $classParameters, $methodParameters, $checkMethod, $allowProtected );
} | [
"public",
"static",
"function",
"call",
"(",
"$",
"mixed",
",",
"$",
"methodName",
",",
"$",
"methodParameters",
"=",
"array",
"(",
")",
",",
"$",
"classParameters",
"=",
"array",
"(",
")",
",",
"$",
"checkMethod",
"=",
"TRUE",
",",
"$",
"allowProtected",
"=",
"FALSE",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"mixed",
")",
")",
"return",
"self",
"::",
"callObjectMethod",
"(",
"$",
"mixed",
",",
"$",
"methodName",
",",
"$",
"methodParameters",
",",
"$",
"checkMethod",
",",
"$",
"allowProtected",
")",
";",
"return",
"self",
"::",
"callClassMethod",
"(",
"$",
"mixed",
",",
"$",
"methodName",
",",
"$",
"classParameters",
",",
"$",
"methodParameters",
",",
"$",
"checkMethod",
",",
"$",
"allowProtected",
")",
";",
"}"
] | Calls a Method from a Class or Object with Method Parameters and Object Parameters if a Class is given.
@access public
@static
@param string|object $mixed Class Name or Object
@param string $methodName Name of Method to call
@param array $methodParameters List of Parameters for Method Call
@param array $classParameters List of Parameters for Object Construction if Class is given
@param boolean $checkMethod Flag: check if methods exists by default, disable for classes using __call
@param boolean $allowProtected Flag: allow invoking protected and private methods (PHP 5.3.2+), default: no
@return mixed Result of called Method | [
"Calls",
"a",
"Method",
"from",
"a",
"Class",
"or",
"Object",
"with",
"Method",
"Parameters",
"and",
"Object",
"Parameters",
"if",
"a",
"Class",
"is",
"given",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Object/MethodFactory.php#L56-L61 |
36,209 | CeusMedia/Common | src/Alg/Object/MethodFactory.php | Alg_Object_MethodFactory.callObjectMethod | public static function callObjectMethod( $object, $methodName, $parameters = array(), $checkMethod = TRUE, $allowProtected = FALSE )
{
if( !is_object( $object ) )
throw new InvalidArgumentException( 'Invalid object' );
$reflection = new ReflectionObject( $object ); // get Object Reflection
if( $checkMethod && !$reflection->hasMethod( $methodName ) ) // called Method is not existing
{
$message = 'Method '.$reflection->getName().'::'.$methodName.' is not existing'; // prepare Exception Message
throw new BadMethodCallException( $message ); // throw Exception
}
if( $reflection->hasMethod( $methodName ) )
{
$method = $reflection->getMethod( $methodName );
}
else{
$method = $reflection->getMethod( '__call' );
$parameters = array(
$methodName,
$parameters
);
}
if( $allowProtected && version_compare( PHP_VERSION, '5.3.2' ) >= 0 )
$method->setAccessible( TRUE ); // @see http://php.net/manual/de/reflectionmethod.setaccessible.php
if( $parameters ) // if Method Parameters are set
return $method->invokeArgs( $object, $parameters ); // invoke Method with Parameters
return $method->invoke( $object ); // else invoke Method without Parameters
} | php | public static function callObjectMethod( $object, $methodName, $parameters = array(), $checkMethod = TRUE, $allowProtected = FALSE )
{
if( !is_object( $object ) )
throw new InvalidArgumentException( 'Invalid object' );
$reflection = new ReflectionObject( $object ); // get Object Reflection
if( $checkMethod && !$reflection->hasMethod( $methodName ) ) // called Method is not existing
{
$message = 'Method '.$reflection->getName().'::'.$methodName.' is not existing'; // prepare Exception Message
throw new BadMethodCallException( $message ); // throw Exception
}
if( $reflection->hasMethod( $methodName ) )
{
$method = $reflection->getMethod( $methodName );
}
else{
$method = $reflection->getMethod( '__call' );
$parameters = array(
$methodName,
$parameters
);
}
if( $allowProtected && version_compare( PHP_VERSION, '5.3.2' ) >= 0 )
$method->setAccessible( TRUE ); // @see http://php.net/manual/de/reflectionmethod.setaccessible.php
if( $parameters ) // if Method Parameters are set
return $method->invokeArgs( $object, $parameters ); // invoke Method with Parameters
return $method->invoke( $object ); // else invoke Method without Parameters
} | [
"public",
"static",
"function",
"callObjectMethod",
"(",
"$",
"object",
",",
"$",
"methodName",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"$",
"checkMethod",
"=",
"TRUE",
",",
"$",
"allowProtected",
"=",
"FALSE",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Invalid object'",
")",
";",
"$",
"reflection",
"=",
"new",
"ReflectionObject",
"(",
"$",
"object",
")",
";",
"// get Object Reflection",
"if",
"(",
"$",
"checkMethod",
"&&",
"!",
"$",
"reflection",
"->",
"hasMethod",
"(",
"$",
"methodName",
")",
")",
"// called Method is not existing",
"{",
"$",
"message",
"=",
"'Method '",
".",
"$",
"reflection",
"->",
"getName",
"(",
")",
".",
"'::'",
".",
"$",
"methodName",
".",
"' is not existing'",
";",
"// prepare Exception Message",
"throw",
"new",
"BadMethodCallException",
"(",
"$",
"message",
")",
";",
"// throw Exception",
"}",
"if",
"(",
"$",
"reflection",
"->",
"hasMethod",
"(",
"$",
"methodName",
")",
")",
"{",
"$",
"method",
"=",
"$",
"reflection",
"->",
"getMethod",
"(",
"$",
"methodName",
")",
";",
"}",
"else",
"{",
"$",
"method",
"=",
"$",
"reflection",
"->",
"getMethod",
"(",
"'__call'",
")",
";",
"$",
"parameters",
"=",
"array",
"(",
"$",
"methodName",
",",
"$",
"parameters",
")",
";",
"}",
"if",
"(",
"$",
"allowProtected",
"&&",
"version_compare",
"(",
"PHP_VERSION",
",",
"'5.3.2'",
")",
">=",
"0",
")",
"$",
"method",
"->",
"setAccessible",
"(",
"TRUE",
")",
";",
"// @see http://php.net/manual/de/reflectionmethod.setaccessible.php",
"if",
"(",
"$",
"parameters",
")",
"// if Method Parameters are set",
"return",
"$",
"method",
"->",
"invokeArgs",
"(",
"$",
"object",
",",
"$",
"parameters",
")",
";",
"// invoke Method with Parameters",
"return",
"$",
"method",
"->",
"invoke",
"(",
"$",
"object",
")",
";",
"// else invoke Method without Parameters",
"}"
] | Calls Class or Object Method.
@access public
@static
@param object $object Object to call Method of
@param string $methodName Name of Method to call
@param array $parameters List of Parameters for Method Call
@param boolean $checkMethod Flag: check if methods exists by default, disable for classes using __call
@param boolean $allowProtected Flag: allow invoking protected and private methods (PHP 5.3.2+), default: no
@return mixed Result of called Method
@throws InvalidArgumentException if no object is given
@throws BadMethodCallException if an invalid Method is called | [
"Calls",
"Class",
"or",
"Object",
"Method",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Object/MethodFactory.php#L96-L124 |
36,210 | meritoo/common-library | src/Traits/CssSelector/FormCssSelector.php | FormCssSelector.getInputByNameSelector | public static function getInputByNameSelector($formName, $fieldName)
{
$formSelector = static::getFormByNameSelector($formName);
$fieldName = trim($fieldName);
if (empty($formSelector) || empty($fieldName)) {
return '';
}
return sprintf('%s input[name="%s"]', $formSelector, $fieldName);
} | php | public static function getInputByNameSelector($formName, $fieldName)
{
$formSelector = static::getFormByNameSelector($formName);
$fieldName = trim($fieldName);
if (empty($formSelector) || empty($fieldName)) {
return '';
}
return sprintf('%s input[name="%s"]', $formSelector, $fieldName);
} | [
"public",
"static",
"function",
"getInputByNameSelector",
"(",
"$",
"formName",
",",
"$",
"fieldName",
")",
"{",
"$",
"formSelector",
"=",
"static",
"::",
"getFormByNameSelector",
"(",
"$",
"formName",
")",
";",
"$",
"fieldName",
"=",
"trim",
"(",
"$",
"fieldName",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"formSelector",
")",
"||",
"empty",
"(",
"$",
"fieldName",
")",
")",
"{",
"return",
"''",
";",
"}",
"return",
"sprintf",
"(",
"'%s input[name=\"%s\"]'",
",",
"$",
"formSelector",
",",
"$",
"fieldName",
")",
";",
"}"
] | Returns selector of the input field based on its name
@param string $formName Name of form (value of the "name" attribute)
@param string $fieldName Name of field (value of the "name" attribute)
@return string | [
"Returns",
"selector",
"of",
"the",
"input",
"field",
"based",
"on",
"its",
"name"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Traits/CssSelector/FormCssSelector.php#L43-L53 |
36,211 | meritoo/common-library | src/Traits/CssSelector/FormCssSelector.php | FormCssSelector.getInputByIdSelector | public static function getInputByIdSelector($formName, $fieldId)
{
$formSelector = static::getFormByNameSelector($formName);
$fieldId = trim($fieldId);
if (empty($formSelector) || empty($fieldId)) {
return '';
}
return sprintf('%s input#%s', $formSelector, $fieldId);
} | php | public static function getInputByIdSelector($formName, $fieldId)
{
$formSelector = static::getFormByNameSelector($formName);
$fieldId = trim($fieldId);
if (empty($formSelector) || empty($fieldId)) {
return '';
}
return sprintf('%s input#%s', $formSelector, $fieldId);
} | [
"public",
"static",
"function",
"getInputByIdSelector",
"(",
"$",
"formName",
",",
"$",
"fieldId",
")",
"{",
"$",
"formSelector",
"=",
"static",
"::",
"getFormByNameSelector",
"(",
"$",
"formName",
")",
";",
"$",
"fieldId",
"=",
"trim",
"(",
"$",
"fieldId",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"formSelector",
")",
"||",
"empty",
"(",
"$",
"fieldId",
")",
")",
"{",
"return",
"''",
";",
"}",
"return",
"sprintf",
"(",
"'%s input#%s'",
",",
"$",
"formSelector",
",",
"$",
"fieldId",
")",
";",
"}"
] | Returns selector of the input field based on its ID
@param string $formName Name of form (value of the "name" attribute)
@param string $fieldId ID of field (value of the "id" attribute)
@return string | [
"Returns",
"selector",
"of",
"the",
"input",
"field",
"based",
"on",
"its",
"ID"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Traits/CssSelector/FormCssSelector.php#L62-L72 |
36,212 | meritoo/common-library | src/Traits/CssSelector/FormCssSelector.php | FormCssSelector.getLabelSelector | public static function getLabelSelector($formName, $fieldId)
{
$formSelector = static::getFormByNameSelector($formName);
$fieldId = trim($fieldId);
if (empty($formSelector) || empty($fieldId)) {
return '';
}
return sprintf('%s label[for="%s"]', $formSelector, $fieldId);
} | php | public static function getLabelSelector($formName, $fieldId)
{
$formSelector = static::getFormByNameSelector($formName);
$fieldId = trim($fieldId);
if (empty($formSelector) || empty($fieldId)) {
return '';
}
return sprintf('%s label[for="%s"]', $formSelector, $fieldId);
} | [
"public",
"static",
"function",
"getLabelSelector",
"(",
"$",
"formName",
",",
"$",
"fieldId",
")",
"{",
"$",
"formSelector",
"=",
"static",
"::",
"getFormByNameSelector",
"(",
"$",
"formName",
")",
";",
"$",
"fieldId",
"=",
"trim",
"(",
"$",
"fieldId",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"formSelector",
")",
"||",
"empty",
"(",
"$",
"fieldId",
")",
")",
"{",
"return",
"''",
";",
"}",
"return",
"sprintf",
"(",
"'%s label[for=\"%s\"]'",
",",
"$",
"formSelector",
",",
"$",
"fieldId",
")",
";",
"}"
] | Returns selector of label
@param string $formName Name of form (value of the "name" attribute)
@param string $fieldId ID of field (value of the "id" attribute)
@return string | [
"Returns",
"selector",
"of",
"label"
] | b166b8b805ae97c15688d27323cae8976bd0f6dc | https://github.com/meritoo/common-library/blob/b166b8b805ae97c15688d27323cae8976bd0f6dc/src/Traits/CssSelector/FormCssSelector.php#L81-L91 |
36,213 | CeusMedia/Common | src/Alg/Math/Algebra/Matrix.php | Alg_Math_Algebra_Matrix.clear | public function clear( $init = 0 )
{
for( $row = 0; $row < $this->getRowNumber(); $row++ )
for( $column = 0; $column < $this->getColumnNumber(); $column++ )
$this->setValue( $row, $column, $init );
} | php | public function clear( $init = 0 )
{
for( $row = 0; $row < $this->getRowNumber(); $row++ )
for( $column = 0; $column < $this->getColumnNumber(); $column++ )
$this->setValue( $row, $column, $init );
} | [
"public",
"function",
"clear",
"(",
"$",
"init",
"=",
"0",
")",
"{",
"for",
"(",
"$",
"row",
"=",
"0",
";",
"$",
"row",
"<",
"$",
"this",
"->",
"getRowNumber",
"(",
")",
";",
"$",
"row",
"++",
")",
"for",
"(",
"$",
"column",
"=",
"0",
";",
"$",
"column",
"<",
"$",
"this",
"->",
"getColumnNumber",
"(",
")",
";",
"$",
"column",
"++",
")",
"$",
"this",
"->",
"setValue",
"(",
"$",
"row",
",",
"$",
"column",
",",
"$",
"init",
")",
";",
"}"
] | Clears Matrix by setting initial value.
@access public
@param int $init initial values in Matrix
@return void | [
"Clears",
"Matrix",
"by",
"setting",
"initial",
"value",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Algebra/Matrix.php#L81-L86 |
36,214 | CeusMedia/Common | src/Alg/Math/Algebra/Matrix.php | Alg_Math_Algebra_Matrix.getColumn | public function getColumn( $column )
{
if( $column < 0 || $column >= $this->getColumnNumber() )
throw new OutOfRangeException( 'Column key "'.$column.'" is not valid.' );
$values = array();
for( $row = 0; $row < $this->getRowNumber(); $row++ )
$values[] = $this->getValue( $row, $column );
return new Alg_Math_Algebra_Vector( $values );
} | php | public function getColumn( $column )
{
if( $column < 0 || $column >= $this->getColumnNumber() )
throw new OutOfRangeException( 'Column key "'.$column.'" is not valid.' );
$values = array();
for( $row = 0; $row < $this->getRowNumber(); $row++ )
$values[] = $this->getValue( $row, $column );
return new Alg_Math_Algebra_Vector( $values );
} | [
"public",
"function",
"getColumn",
"(",
"$",
"column",
")",
"{",
"if",
"(",
"$",
"column",
"<",
"0",
"||",
"$",
"column",
">=",
"$",
"this",
"->",
"getColumnNumber",
"(",
")",
")",
"throw",
"new",
"OutOfRangeException",
"(",
"'Column key \"'",
".",
"$",
"column",
".",
"'\" is not valid.'",
")",
";",
"$",
"values",
"=",
"array",
"(",
")",
";",
"for",
"(",
"$",
"row",
"=",
"0",
";",
"$",
"row",
"<",
"$",
"this",
"->",
"getRowNumber",
"(",
")",
";",
"$",
"row",
"++",
")",
"$",
"values",
"[",
"]",
"=",
"$",
"this",
"->",
"getValue",
"(",
"$",
"row",
",",
"$",
"column",
")",
";",
"return",
"new",
"Alg_Math_Algebra_Vector",
"(",
"$",
"values",
")",
";",
"}"
] | Returns a column as Vector.
@access public
@param int $column Column Index
@return Alg_Math_Algebra_Vector | [
"Returns",
"a",
"column",
"as",
"Vector",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Algebra/Matrix.php#L94-L102 |
36,215 | CeusMedia/Common | src/Alg/Math/Algebra/Matrix.php | Alg_Math_Algebra_Matrix.getRow | public function getRow( $row )
{
if( $row < 0 || $row >= $this->getRowNumber() )
throw new OutOfRangeException( 'Row key "'.$row.'" is not valid.' );
return new Alg_Math_Algebra_Vector( $this->values[$row] );
} | php | public function getRow( $row )
{
if( $row < 0 || $row >= $this->getRowNumber() )
throw new OutOfRangeException( 'Row key "'.$row.'" is not valid.' );
return new Alg_Math_Algebra_Vector( $this->values[$row] );
} | [
"public",
"function",
"getRow",
"(",
"$",
"row",
")",
"{",
"if",
"(",
"$",
"row",
"<",
"0",
"||",
"$",
"row",
">=",
"$",
"this",
"->",
"getRowNumber",
"(",
")",
")",
"throw",
"new",
"OutOfRangeException",
"(",
"'Row key \"'",
".",
"$",
"row",
".",
"'\" is not valid.'",
")",
";",
"return",
"new",
"Alg_Math_Algebra_Vector",
"(",
"$",
"this",
"->",
"values",
"[",
"$",
"row",
"]",
")",
";",
"}"
] | Returns a row as Vector.
@access public
@param int $row Row Index
@return Alg_Math_Algebra_Vector | [
"Returns",
"a",
"row",
"as",
"Vector",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Algebra/Matrix.php#L120-L125 |
36,216 | CeusMedia/Common | src/Alg/Math/Algebra/Matrix.php | Alg_Math_Algebra_Matrix.swapColumns | public function swapColumns( $column1, $column2 )
{
if( $column1 < 0 || $column1 >= $this->getColumnNumber() )
throw new OutOfRangeException( 'Column key "'.$column1.'" is not valid.' );
if( $column2 < 0 || $column2 >= $this->getColumnNumber() )
throw new OutOfRangeException( 'Column key "'.$column2.'" is not valid.' );
for( $row = 0; $row < $this->getRowNumber(); $row++ )
{
$buffer = $this->values[$row][$column1];
$this->values[$row][$column1] = $this->values[$row][$column2];
$this->values[$row][$column2] = $buffer;
}
} | php | public function swapColumns( $column1, $column2 )
{
if( $column1 < 0 || $column1 >= $this->getColumnNumber() )
throw new OutOfRangeException( 'Column key "'.$column1.'" is not valid.' );
if( $column2 < 0 || $column2 >= $this->getColumnNumber() )
throw new OutOfRangeException( 'Column key "'.$column2.'" is not valid.' );
for( $row = 0; $row < $this->getRowNumber(); $row++ )
{
$buffer = $this->values[$row][$column1];
$this->values[$row][$column1] = $this->values[$row][$column2];
$this->values[$row][$column2] = $buffer;
}
} | [
"public",
"function",
"swapColumns",
"(",
"$",
"column1",
",",
"$",
"column2",
")",
"{",
"if",
"(",
"$",
"column1",
"<",
"0",
"||",
"$",
"column1",
">=",
"$",
"this",
"->",
"getColumnNumber",
"(",
")",
")",
"throw",
"new",
"OutOfRangeException",
"(",
"'Column key \"'",
".",
"$",
"column1",
".",
"'\" is not valid.'",
")",
";",
"if",
"(",
"$",
"column2",
"<",
"0",
"||",
"$",
"column2",
">=",
"$",
"this",
"->",
"getColumnNumber",
"(",
")",
")",
"throw",
"new",
"OutOfRangeException",
"(",
"'Column key \"'",
".",
"$",
"column2",
".",
"'\" is not valid.'",
")",
";",
"for",
"(",
"$",
"row",
"=",
"0",
";",
"$",
"row",
"<",
"$",
"this",
"->",
"getRowNumber",
"(",
")",
";",
"$",
"row",
"++",
")",
"{",
"$",
"buffer",
"=",
"$",
"this",
"->",
"values",
"[",
"$",
"row",
"]",
"[",
"$",
"column1",
"]",
";",
"$",
"this",
"->",
"values",
"[",
"$",
"row",
"]",
"[",
"$",
"column1",
"]",
"=",
"$",
"this",
"->",
"values",
"[",
"$",
"row",
"]",
"[",
"$",
"column2",
"]",
";",
"$",
"this",
"->",
"values",
"[",
"$",
"row",
"]",
"[",
"$",
"column2",
"]",
"=",
"$",
"buffer",
";",
"}",
"}"
] | Swaps 2 Columns within Matrix.
@access public
@param int $column1 Index of Source Column
@param int $column2 Index of Target Column
@return void | [
"Swaps",
"2",
"Columns",
"within",
"Matrix",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Algebra/Matrix.php#L177-L190 |
36,217 | CeusMedia/Common | src/Alg/Math/Algebra/Matrix.php | Alg_Math_Algebra_Matrix.swapRows | public function swapRows( $row1, $row2 )
{
if( $row1 < 0 || $row1 >= $this->getRowNumber() )
throw new OutOfRangeException( 'Source Row key "'.$row1.'" is not valid.' );
if( $row2 < 0 || $row2 >= $this->getRowNumber() )
throw new OutOfRangeException( 'Target Row key "'.$row2.'" is not valid.' );
$buffer = $this->values[$row2];
$this->values[$row2] = $this->values[$row1];
$this->values[$row1] = $buffer;
} | php | public function swapRows( $row1, $row2 )
{
if( $row1 < 0 || $row1 >= $this->getRowNumber() )
throw new OutOfRangeException( 'Source Row key "'.$row1.'" is not valid.' );
if( $row2 < 0 || $row2 >= $this->getRowNumber() )
throw new OutOfRangeException( 'Target Row key "'.$row2.'" is not valid.' );
$buffer = $this->values[$row2];
$this->values[$row2] = $this->values[$row1];
$this->values[$row1] = $buffer;
} | [
"public",
"function",
"swapRows",
"(",
"$",
"row1",
",",
"$",
"row2",
")",
"{",
"if",
"(",
"$",
"row1",
"<",
"0",
"||",
"$",
"row1",
">=",
"$",
"this",
"->",
"getRowNumber",
"(",
")",
")",
"throw",
"new",
"OutOfRangeException",
"(",
"'Source Row key \"'",
".",
"$",
"row1",
".",
"'\" is not valid.'",
")",
";",
"if",
"(",
"$",
"row2",
"<",
"0",
"||",
"$",
"row2",
">=",
"$",
"this",
"->",
"getRowNumber",
"(",
")",
")",
"throw",
"new",
"OutOfRangeException",
"(",
"'Target Row key \"'",
".",
"$",
"row2",
".",
"'\" is not valid.'",
")",
";",
"$",
"buffer",
"=",
"$",
"this",
"->",
"values",
"[",
"$",
"row2",
"]",
";",
"$",
"this",
"->",
"values",
"[",
"$",
"row2",
"]",
"=",
"$",
"this",
"->",
"values",
"[",
"$",
"row1",
"]",
";",
"$",
"this",
"->",
"values",
"[",
"$",
"row1",
"]",
"=",
"$",
"buffer",
";",
"}"
] | Swaps 2 Rows within Matrix.
@access public
@param int $row1 Index of Source Row
@param int $row2 Index of Target Row
@return void | [
"Swaps",
"2",
"Rows",
"within",
"Matrix",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Algebra/Matrix.php#L199-L209 |
36,218 | CeusMedia/Common | src/Alg/Math/Algebra/Matrix.php | Alg_Math_Algebra_Matrix.transpose | public function transpose()
{
$array = array();
$rowNumber = $this->getRowNumber();
$columnNumber = $this->getColumnNumber();
for( $row = 0; $row < $rowNumber; $row++ )
for( $column = 0; $column < $columnNumber; $column++ )
$array[$column][$row] = $this->values[$row][$column];
$this->rowNumber = $columnNumber;
$this->columnNumber = $rowNumber;
$this->values = $array;
} | php | public function transpose()
{
$array = array();
$rowNumber = $this->getRowNumber();
$columnNumber = $this->getColumnNumber();
for( $row = 0; $row < $rowNumber; $row++ )
for( $column = 0; $column < $columnNumber; $column++ )
$array[$column][$row] = $this->values[$row][$column];
$this->rowNumber = $columnNumber;
$this->columnNumber = $rowNumber;
$this->values = $array;
} | [
"public",
"function",
"transpose",
"(",
")",
"{",
"$",
"array",
"=",
"array",
"(",
")",
";",
"$",
"rowNumber",
"=",
"$",
"this",
"->",
"getRowNumber",
"(",
")",
";",
"$",
"columnNumber",
"=",
"$",
"this",
"->",
"getColumnNumber",
"(",
")",
";",
"for",
"(",
"$",
"row",
"=",
"0",
";",
"$",
"row",
"<",
"$",
"rowNumber",
";",
"$",
"row",
"++",
")",
"for",
"(",
"$",
"column",
"=",
"0",
";",
"$",
"column",
"<",
"$",
"columnNumber",
";",
"$",
"column",
"++",
")",
"$",
"array",
"[",
"$",
"column",
"]",
"[",
"$",
"row",
"]",
"=",
"$",
"this",
"->",
"values",
"[",
"$",
"row",
"]",
"[",
"$",
"column",
"]",
";",
"$",
"this",
"->",
"rowNumber",
"=",
"$",
"columnNumber",
";",
"$",
"this",
"->",
"columnNumber",
"=",
"$",
"rowNumber",
";",
"$",
"this",
"->",
"values",
"=",
"$",
"array",
";",
"}"
] | Returns transposed Matrix.
@access public
@return Alg_Math_Algebra_Matrix | [
"Returns",
"transposed",
"Matrix",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Algebra/Matrix.php#L245-L256 |
36,219 | CeusMedia/Common | src/UI/HTML/Exception/TraceViewer.php | UI_HTML_Exception_TraceViewer.convertArrayToString | protected static function convertArrayToString( $array, $breakMode, $level = 1 )
{
$list = array();
foreach( $array as $key => $value )
{
$string = self::convertArgumentToString( $value, $breakMode, $level+1 );
$list[] = $key.":".$string;
}
$block = implode( ", ", $list );
if( $breakMode == 2 )
{
$level = str_repeat( " ", 3 * $level );
$indent = str_repeat( " ", 3 );
$list = implode( ",<br/>".$level.$indent.$indent.$indent.$indent, $list );
$block = "<br/>".$level.$indent.$indent.$indent.$indent.$list."<br/>".$level.$indent.$indent.$indent;
}
if( $breakMode == 3 )
{
$block = self::blockquote( implode( ',<br/>', $list ) );
}
return '{'.$block.'}';
} | php | protected static function convertArrayToString( $array, $breakMode, $level = 1 )
{
$list = array();
foreach( $array as $key => $value )
{
$string = self::convertArgumentToString( $value, $breakMode, $level+1 );
$list[] = $key.":".$string;
}
$block = implode( ", ", $list );
if( $breakMode == 2 )
{
$level = str_repeat( " ", 3 * $level );
$indent = str_repeat( " ", 3 );
$list = implode( ",<br/>".$level.$indent.$indent.$indent.$indent, $list );
$block = "<br/>".$level.$indent.$indent.$indent.$indent.$list."<br/>".$level.$indent.$indent.$indent;
}
if( $breakMode == 3 )
{
$block = self::blockquote( implode( ',<br/>', $list ) );
}
return '{'.$block.'}';
} | [
"protected",
"static",
"function",
"convertArrayToString",
"(",
"$",
"array",
",",
"$",
"breakMode",
",",
"$",
"level",
"=",
"1",
")",
"{",
"$",
"list",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"string",
"=",
"self",
"::",
"convertArgumentToString",
"(",
"$",
"value",
",",
"$",
"breakMode",
",",
"$",
"level",
"+",
"1",
")",
";",
"$",
"list",
"[",
"]",
"=",
"$",
"key",
".",
"\":\"",
".",
"$",
"string",
";",
"}",
"$",
"block",
"=",
"implode",
"(",
"\", \"",
",",
"$",
"list",
")",
";",
"if",
"(",
"$",
"breakMode",
"==",
"2",
")",
"{",
"$",
"level",
"=",
"str_repeat",
"(",
"\" \"",
",",
"3",
"*",
"$",
"level",
")",
";",
"$",
"indent",
"=",
"str_repeat",
"(",
"\" \"",
",",
"3",
")",
";",
"$",
"list",
"=",
"implode",
"(",
"\",<br/>\"",
".",
"$",
"level",
".",
"$",
"indent",
".",
"$",
"indent",
".",
"$",
"indent",
".",
"$",
"indent",
",",
"$",
"list",
")",
";",
"$",
"block",
"=",
"\"<br/>\"",
".",
"$",
"level",
".",
"$",
"indent",
".",
"$",
"indent",
".",
"$",
"indent",
".",
"$",
"indent",
".",
"$",
"list",
".",
"\"<br/>\"",
".",
"$",
"level",
".",
"$",
"indent",
".",
"$",
"indent",
".",
"$",
"indent",
";",
"}",
"if",
"(",
"$",
"breakMode",
"==",
"3",
")",
"{",
"$",
"block",
"=",
"self",
"::",
"blockquote",
"(",
"implode",
"(",
"',<br/>'",
",",
"$",
"list",
")",
")",
";",
"}",
"return",
"'{'",
".",
"$",
"block",
".",
"'}'",
";",
"}"
] | Converts Array to String.
@access protected
@static
@param array $array Array to convert to String
@return string | [
"Converts",
"Array",
"to",
"String",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/UI/HTML/Exception/TraceViewer.php#L208-L229 |
36,220 | CeusMedia/Common | src/Net/Connectivity.php | Net_Connectivity.check | public function check( $method = NULL ){
$method = $this->method;
if( $method && $this->validateMethod( $method ) )
$method = $method;
$currentStatus = $this->status;
switch( $method ){
case self::METHOD_SOCKET:
$this->checkUsingSocket();
break;
case self::METHOD_PING:
$this->checkUsingSystemPing();
break;
}
if( $this->status !== $currentStatus ){
if( $this->callbackOnChange ){
call_user_func_array( $this->callbackOnChange, array( $this->status ) );
}
}
} | php | public function check( $method = NULL ){
$method = $this->method;
if( $method && $this->validateMethod( $method ) )
$method = $method;
$currentStatus = $this->status;
switch( $method ){
case self::METHOD_SOCKET:
$this->checkUsingSocket();
break;
case self::METHOD_PING:
$this->checkUsingSystemPing();
break;
}
if( $this->status !== $currentStatus ){
if( $this->callbackOnChange ){
call_user_func_array( $this->callbackOnChange, array( $this->status ) );
}
}
} | [
"public",
"function",
"check",
"(",
"$",
"method",
"=",
"NULL",
")",
"{",
"$",
"method",
"=",
"$",
"this",
"->",
"method",
";",
"if",
"(",
"$",
"method",
"&&",
"$",
"this",
"->",
"validateMethod",
"(",
"$",
"method",
")",
")",
"$",
"method",
"=",
"$",
"method",
";",
"$",
"currentStatus",
"=",
"$",
"this",
"->",
"status",
";",
"switch",
"(",
"$",
"method",
")",
"{",
"case",
"self",
"::",
"METHOD_SOCKET",
":",
"$",
"this",
"->",
"checkUsingSocket",
"(",
")",
";",
"break",
";",
"case",
"self",
"::",
"METHOD_PING",
":",
"$",
"this",
"->",
"checkUsingSystemPing",
"(",
")",
";",
"break",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"status",
"!==",
"$",
"currentStatus",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"callbackOnChange",
")",
"{",
"call_user_func_array",
"(",
"$",
"this",
"->",
"callbackOnChange",
",",
"array",
"(",
"$",
"this",
"->",
"status",
")",
")",
";",
"}",
"}",
"}"
] | ...
Executes callback function by if set and status has changed.
@access public
@param integer $method Method to use for checking
@return void
@throws \RangeException if given method is unsupported | [
"...",
"Executes",
"callback",
"function",
"by",
"if",
"set",
"and",
"status",
"has",
"changed",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Connectivity.php#L67-L85 |
36,221 | CeusMedia/Common | src/Net/Connectivity.php | Net_Connectivity.checkUsingSocket | public function checkUsingSocket(){
$conn = @fsockopen( 'google.com', 443);
$this->status = $conn ? self::STATUS_ONLINE : self::STATUS_OFFLINE;
fclose( $conn );
} | php | public function checkUsingSocket(){
$conn = @fsockopen( 'google.com', 443);
$this->status = $conn ? self::STATUS_ONLINE : self::STATUS_OFFLINE;
fclose( $conn );
} | [
"public",
"function",
"checkUsingSocket",
"(",
")",
"{",
"$",
"conn",
"=",
"@",
"fsockopen",
"(",
"'google.com'",
",",
"443",
")",
";",
"$",
"this",
"->",
"status",
"=",
"$",
"conn",
"?",
"self",
"::",
"STATUS_ONLINE",
":",
"self",
"::",
"STATUS_OFFLINE",
";",
"fclose",
"(",
"$",
"conn",
")",
";",
"}"
] | Check connectivity using a socket connection.
Sets status depending on result.
@access public
@return void | [
"Check",
"connectivity",
"using",
"a",
"socket",
"connection",
".",
"Sets",
"status",
"depending",
"on",
"result",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Connectivity.php#L93-L97 |
36,222 | CeusMedia/Common | src/Net/Connectivity.php | Net_Connectivity.checkUsingSystemPing | public function checkUsingSystemPing(){
$response = NULL;
@exec( "ping -c 1 google.com 2>&1 1> /dev/null", $response, $code );
// @system( "ping -c 1 1111google.com &2>1 &1>/dev/null", $code );
if( $code == 0 )
$this->status = self::STATUS_ONLINE;
else
$this->status = self::STATUS_OFFLINE;
} | php | public function checkUsingSystemPing(){
$response = NULL;
@exec( "ping -c 1 google.com 2>&1 1> /dev/null", $response, $code );
// @system( "ping -c 1 1111google.com &2>1 &1>/dev/null", $code );
if( $code == 0 )
$this->status = self::STATUS_ONLINE;
else
$this->status = self::STATUS_OFFLINE;
} | [
"public",
"function",
"checkUsingSystemPing",
"(",
")",
"{",
"$",
"response",
"=",
"NULL",
";",
"@",
"exec",
"(",
"\"ping -c 1 google.com 2>&1 1> /dev/null\"",
",",
"$",
"response",
",",
"$",
"code",
")",
";",
"//\t\t@system( \"ping -c 1 1111google.com &2>1 &1>/dev/null\", $code );",
"if",
"(",
"$",
"code",
"==",
"0",
")",
"$",
"this",
"->",
"status",
"=",
"self",
"::",
"STATUS_ONLINE",
";",
"else",
"$",
"this",
"->",
"status",
"=",
"self",
"::",
"STATUS_OFFLINE",
";",
"}"
] | Check connectivity using ping via system call.
Sets status depending on result.
@access public
@return void | [
"Check",
"connectivity",
"using",
"ping",
"via",
"system",
"call",
".",
"Sets",
"status",
"depending",
"on",
"result",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Connectivity.php#L105-L113 |
36,223 | CeusMedia/Common | src/Net/Connectivity.php | Net_Connectivity.validateMethod | protected function validateMethod( $method ){
if( !is_int( $method ) )
throw new \InvalidArgumentException( 'Method must be integer' );
if( !in_array( $method, array( self::METHOD_SOCKET, self::METHOD_PING ) ) )
throw new \RangeException( 'Invalid method' );
return $method;
} | php | protected function validateMethod( $method ){
if( !is_int( $method ) )
throw new \InvalidArgumentException( 'Method must be integer' );
if( !in_array( $method, array( self::METHOD_SOCKET, self::METHOD_PING ) ) )
throw new \RangeException( 'Invalid method' );
return $method;
} | [
"protected",
"function",
"validateMethod",
"(",
"$",
"method",
")",
"{",
"if",
"(",
"!",
"is_int",
"(",
"$",
"method",
")",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Method must be integer'",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"method",
",",
"array",
"(",
"self",
"::",
"METHOD_SOCKET",
",",
"self",
"::",
"METHOD_PING",
")",
")",
")",
"throw",
"new",
"\\",
"RangeException",
"(",
"'Invalid method'",
")",
";",
"return",
"$",
"method",
";",
"}"
] | Validate given method.
@acess protected
@param integer Method to validate
@return integer Method after validation | [
"Validate",
"given",
"method",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/Connectivity.php#L189-L195 |
36,224 | CeusMedia/Common | src/Alg/Math/Analysis/Integration.php | Alg_Math_Analysis_Integration.getSamplingNodes | public function getSamplingNodes()
{
$nodes = array();
$start = $this->interval->getStart();
$distance = $this->getNodeDistance();
for( $i = 0; $i<$this->getNodes(); $i++ )
{
$x = $start + $i * $distance;
$nodes[] = $x;
}
return $nodes;
} | php | public function getSamplingNodes()
{
$nodes = array();
$start = $this->interval->getStart();
$distance = $this->getNodeDistance();
for( $i = 0; $i<$this->getNodes(); $i++ )
{
$x = $start + $i * $distance;
$nodes[] = $x;
}
return $nodes;
} | [
"public",
"function",
"getSamplingNodes",
"(",
")",
"{",
"$",
"nodes",
"=",
"array",
"(",
")",
";",
"$",
"start",
"=",
"$",
"this",
"->",
"interval",
"->",
"getStart",
"(",
")",
";",
"$",
"distance",
"=",
"$",
"this",
"->",
"getNodeDistance",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"getNodes",
"(",
")",
";",
"$",
"i",
"++",
")",
"{",
"$",
"x",
"=",
"$",
"start",
"+",
"$",
"i",
"*",
"$",
"distance",
";",
"$",
"nodes",
"[",
"]",
"=",
"$",
"x",
";",
"}",
"return",
"$",
"nodes",
";",
"}"
] | Returns an array of Sampling Nodes.
@access public
@return array | [
"Returns",
"an",
"array",
"of",
"Sampling",
"Nodes",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Alg/Math/Analysis/Integration.php#L116-L127 |
36,225 | ncou/Chiron | src/Chiron/Http/Middleware/EncryptCookiesMiddleware.php | EncryptCookiesMiddleware.process | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$request = $this->withDecryptedCookies($request);
$response = $handler->handle($request);
return $this->withEncryptedCookies($response);
} | php | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$request = $this->withDecryptedCookies($request);
$response = $handler->handle($request);
return $this->withEncryptedCookies($response);
} | [
"public",
"function",
"process",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"RequestHandlerInterface",
"$",
"handler",
")",
":",
"ResponseInterface",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"withDecryptedCookies",
"(",
"$",
"request",
")",
";",
"$",
"response",
"=",
"$",
"handler",
"->",
"handle",
"(",
"$",
"request",
")",
";",
"return",
"$",
"this",
"->",
"withEncryptedCookies",
"(",
"$",
"response",
")",
";",
"}"
] | Start the session, delegate the request processing and add the session cookie to the response.
@param ServerRequestInterface $request
@param RequestHandlerInterface $handler
@return ResponseInterface | [
"Start",
"the",
"session",
"delegate",
"the",
"request",
"processing",
"and",
"add",
"the",
"session",
"cookie",
"to",
"the",
"response",
"."
] | bfb6f85faba0e54005896b09a7c34e456d1a1bed | https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Middleware/EncryptCookiesMiddleware.php#L50-L56 |
36,226 | ncou/Chiron | src/Chiron/Http/Middleware/EncryptCookiesMiddleware.php | EncryptCookiesMiddleware.withDecryptedCookies | private function withDecryptedCookies(ServerRequestInterface $request): ServerRequestInterface
{
$cookies = $request->getCookieParams();
$decrypted = [];
foreach ($cookies as $name => $value) {
$decrypted[$name] = in_array($name, $this->bypassed) ? $value : $this->decrypt($value);
}
return $request->withCookieParams($decrypted);
} | php | private function withDecryptedCookies(ServerRequestInterface $request): ServerRequestInterface
{
$cookies = $request->getCookieParams();
$decrypted = [];
foreach ($cookies as $name => $value) {
$decrypted[$name] = in_array($name, $this->bypassed) ? $value : $this->decrypt($value);
}
return $request->withCookieParams($decrypted);
} | [
"private",
"function",
"withDecryptedCookies",
"(",
"ServerRequestInterface",
"$",
"request",
")",
":",
"ServerRequestInterface",
"{",
"$",
"cookies",
"=",
"$",
"request",
"->",
"getCookieParams",
"(",
")",
";",
"$",
"decrypted",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"cookies",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"decrypted",
"[",
"$",
"name",
"]",
"=",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"bypassed",
")",
"?",
"$",
"value",
":",
"$",
"this",
"->",
"decrypt",
"(",
"$",
"value",
")",
";",
"}",
"return",
"$",
"request",
"->",
"withCookieParams",
"(",
"$",
"decrypted",
")",
";",
"}"
] | Decrypt the non bypassed cookie values attached to the given request and return a new request with those values.
@param ServerRequestInterface $request
@return ServerRequestInterface | [
"Decrypt",
"the",
"non",
"bypassed",
"cookie",
"values",
"attached",
"to",
"the",
"given",
"request",
"and",
"return",
"a",
"new",
"request",
"with",
"those",
"values",
"."
] | bfb6f85faba0e54005896b09a7c34e456d1a1bed | https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Middleware/EncryptCookiesMiddleware.php#L65-L75 |
36,227 | ncou/Chiron | src/Chiron/Http/Middleware/EncryptCookiesMiddleware.php | EncryptCookiesMiddleware.withEncryptedCookies | protected function withEncryptedCookies(ResponseInterface $response): ResponseInterface
{
//$cookiesManager = new CookiesManager();
//$cookies = CookiesManager::parseHeaders($response->getHeader('Set-Cookie'));
$cookies = CookiesManager::parseSetCookieHeader($response->getHeader('Set-Cookie'));
// remove all the cookies
$response = $response->withoutHeader('Set-Cookie');
//$header = [];
foreach ($cookies as $name => $cookie) {
if (! in_array($name, $this->bypassed)) {
$cookie['value'] = $this->encrypt($cookie['value']);
}
//$cookiesManager->set($name, $value);
// add again all the cookies (and some are now encrypted)
$response = $response->withAddedHeader('Set-Cookie', CookiesManager::toHeader($name, $cookie));
}
return $response;
} | php | protected function withEncryptedCookies(ResponseInterface $response): ResponseInterface
{
//$cookiesManager = new CookiesManager();
//$cookies = CookiesManager::parseHeaders($response->getHeader('Set-Cookie'));
$cookies = CookiesManager::parseSetCookieHeader($response->getHeader('Set-Cookie'));
// remove all the cookies
$response = $response->withoutHeader('Set-Cookie');
//$header = [];
foreach ($cookies as $name => $cookie) {
if (! in_array($name, $this->bypassed)) {
$cookie['value'] = $this->encrypt($cookie['value']);
}
//$cookiesManager->set($name, $value);
// add again all the cookies (and some are now encrypted)
$response = $response->withAddedHeader('Set-Cookie', CookiesManager::toHeader($name, $cookie));
}
return $response;
} | [
"protected",
"function",
"withEncryptedCookies",
"(",
"ResponseInterface",
"$",
"response",
")",
":",
"ResponseInterface",
"{",
"//$cookiesManager = new CookiesManager();",
"//$cookies = CookiesManager::parseHeaders($response->getHeader('Set-Cookie'));",
"$",
"cookies",
"=",
"CookiesManager",
"::",
"parseSetCookieHeader",
"(",
"$",
"response",
"->",
"getHeader",
"(",
"'Set-Cookie'",
")",
")",
";",
"// remove all the cookies",
"$",
"response",
"=",
"$",
"response",
"->",
"withoutHeader",
"(",
"'Set-Cookie'",
")",
";",
"//$header = [];",
"foreach",
"(",
"$",
"cookies",
"as",
"$",
"name",
"=>",
"$",
"cookie",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"bypassed",
")",
")",
"{",
"$",
"cookie",
"[",
"'value'",
"]",
"=",
"$",
"this",
"->",
"encrypt",
"(",
"$",
"cookie",
"[",
"'value'",
"]",
")",
";",
"}",
"//$cookiesManager->set($name, $value);",
"// add again all the cookies (and some are now encrypted)",
"$",
"response",
"=",
"$",
"response",
"->",
"withAddedHeader",
"(",
"'Set-Cookie'",
",",
"CookiesManager",
"::",
"toHeader",
"(",
"$",
"name",
",",
"$",
"cookie",
")",
")",
";",
"}",
"return",
"$",
"response",
";",
"}"
] | Encode cookies from a response's Set-Cookie header.
@param ResponseInterface $response The response to encode cookies in.
@return ResponseInterface Updated response with encoded cookies. | [
"Encode",
"cookies",
"from",
"a",
"response",
"s",
"Set",
"-",
"Cookie",
"header",
"."
] | bfb6f85faba0e54005896b09a7c34e456d1a1bed | https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Middleware/EncryptCookiesMiddleware.php#L84-L106 |
36,228 | ncou/Chiron | src/Chiron/Http/Middleware/EncryptCookiesMiddleware.php | EncryptCookiesMiddleware.decrypt | private function decrypt(string $value): string
{
try {
return CryptEngine::decrypt($value, $this->password);
} catch (\Throwable $t) {
// @TODO : Add a silent log message if there is an error in the cookie decrypt function.
return '';
}
} | php | private function decrypt(string $value): string
{
try {
return CryptEngine::decrypt($value, $this->password);
} catch (\Throwable $t) {
// @TODO : Add a silent log message if there is an error in the cookie decrypt function.
return '';
}
} | [
"private",
"function",
"decrypt",
"(",
"string",
"$",
"value",
")",
":",
"string",
"{",
"try",
"{",
"return",
"CryptEngine",
"::",
"decrypt",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"password",
")",
";",
"}",
"catch",
"(",
"\\",
"Throwable",
"$",
"t",
")",
"{",
"// @TODO : Add a silent log message if there is an error in the cookie decrypt function.",
"return",
"''",
";",
"}",
"}"
] | Decrypt the given value using the key.
Return default to blank string when the key is wrong or the cypher text has been modified.
@param string $value
@return string | [
"Decrypt",
"the",
"given",
"value",
"using",
"the",
"key",
".",
"Return",
"default",
"to",
"blank",
"string",
"when",
"the",
"key",
"is",
"wrong",
"or",
"the",
"cypher",
"text",
"has",
"been",
"modified",
"."
] | bfb6f85faba0e54005896b09a7c34e456d1a1bed | https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Http/Middleware/EncryptCookiesMiddleware.php#L128-L136 |
36,229 | CeusMedia/Common | src/ADT/Multiplexer.php | ADT_Multiplexer.proceed | public function proceed()
{
if( $this->getType() == 1 )
{
$output = $this->controls[0] ? $this->inputs[1] : $this->inputs[0];
}
else if( $this->getType() == 2 )
{
$mux = new ADT_Multiplexer();
$mux->setControls( $this->controls[0] );
$mux->setInputs( $this->inputs[0], $this->inputs[1] );
$input0 = $mux->proceed();
$mux->setInputs( $this->inputs[2], $this->inputs[3] );
$input1 = $mux->proceed();
$mux->setControls( $this->controls[1] );
$mux->setInputs( $input0, $input1 );
$output = $mux->proceed();
}
else if( $this->getType() == 4)
{
$mux2 = new ADT_Multiplexer( 2 );
$mux2->setControls( $this->controls[0], $this->controls[1] );
$mux2->setInputs( $this->inputs[0], $this->inputs[1], $this->inputs[2], $this->inputs[3] );
$input0 = $mux2->proceed();
$mux2->setInputs( $this->inputs[4], $this->inputs[5], $this->inputs[6], $this->inputs[7] );
$input1 = $mux2->proceed();
$mux2->setInputs( $this->inputs[8], $this->inputs[9], $this->inputs[10], $this->inputs[11] );
$input2 = $mux2->proceed();
$mux2->setInputs( $this->inputs[12], $this->inputs[13], $this->inputs[14], $this->inputs[15] );
$input3 = $mux2->proceed();
$mux2->setControls( $this->controls[2], $this->controls[3] );
$mux2->setInputs( $input0, $input1, $input2, $input3 );
$output = $mux2->proceed();
}
return $output;
} | php | public function proceed()
{
if( $this->getType() == 1 )
{
$output = $this->controls[0] ? $this->inputs[1] : $this->inputs[0];
}
else if( $this->getType() == 2 )
{
$mux = new ADT_Multiplexer();
$mux->setControls( $this->controls[0] );
$mux->setInputs( $this->inputs[0], $this->inputs[1] );
$input0 = $mux->proceed();
$mux->setInputs( $this->inputs[2], $this->inputs[3] );
$input1 = $mux->proceed();
$mux->setControls( $this->controls[1] );
$mux->setInputs( $input0, $input1 );
$output = $mux->proceed();
}
else if( $this->getType() == 4)
{
$mux2 = new ADT_Multiplexer( 2 );
$mux2->setControls( $this->controls[0], $this->controls[1] );
$mux2->setInputs( $this->inputs[0], $this->inputs[1], $this->inputs[2], $this->inputs[3] );
$input0 = $mux2->proceed();
$mux2->setInputs( $this->inputs[4], $this->inputs[5], $this->inputs[6], $this->inputs[7] );
$input1 = $mux2->proceed();
$mux2->setInputs( $this->inputs[8], $this->inputs[9], $this->inputs[10], $this->inputs[11] );
$input2 = $mux2->proceed();
$mux2->setInputs( $this->inputs[12], $this->inputs[13], $this->inputs[14], $this->inputs[15] );
$input3 = $mux2->proceed();
$mux2->setControls( $this->controls[2], $this->controls[3] );
$mux2->setInputs( $input0, $input1, $input2, $input3 );
$output = $mux2->proceed();
}
return $output;
} | [
"public",
"function",
"proceed",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getType",
"(",
")",
"==",
"1",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"controls",
"[",
"0",
"]",
"?",
"$",
"this",
"->",
"inputs",
"[",
"1",
"]",
":",
"$",
"this",
"->",
"inputs",
"[",
"0",
"]",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"getType",
"(",
")",
"==",
"2",
")",
"{",
"$",
"mux",
"=",
"new",
"ADT_Multiplexer",
"(",
")",
";",
"$",
"mux",
"->",
"setControls",
"(",
"$",
"this",
"->",
"controls",
"[",
"0",
"]",
")",
";",
"$",
"mux",
"->",
"setInputs",
"(",
"$",
"this",
"->",
"inputs",
"[",
"0",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"1",
"]",
")",
";",
"$",
"input0",
"=",
"$",
"mux",
"->",
"proceed",
"(",
")",
";",
"$",
"mux",
"->",
"setInputs",
"(",
"$",
"this",
"->",
"inputs",
"[",
"2",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"3",
"]",
")",
";",
"$",
"input1",
"=",
"$",
"mux",
"->",
"proceed",
"(",
")",
";",
"$",
"mux",
"->",
"setControls",
"(",
"$",
"this",
"->",
"controls",
"[",
"1",
"]",
")",
";",
"$",
"mux",
"->",
"setInputs",
"(",
"$",
"input0",
",",
"$",
"input1",
")",
";",
"$",
"output",
"=",
"$",
"mux",
"->",
"proceed",
"(",
")",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"getType",
"(",
")",
"==",
"4",
")",
"{",
"$",
"mux2",
"=",
"new",
"ADT_Multiplexer",
"(",
"2",
")",
";",
"$",
"mux2",
"->",
"setControls",
"(",
"$",
"this",
"->",
"controls",
"[",
"0",
"]",
",",
"$",
"this",
"->",
"controls",
"[",
"1",
"]",
")",
";",
"$",
"mux2",
"->",
"setInputs",
"(",
"$",
"this",
"->",
"inputs",
"[",
"0",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"1",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"2",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"3",
"]",
")",
";",
"$",
"input0",
"=",
"$",
"mux2",
"->",
"proceed",
"(",
")",
";",
"$",
"mux2",
"->",
"setInputs",
"(",
"$",
"this",
"->",
"inputs",
"[",
"4",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"5",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"6",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"7",
"]",
")",
";",
"$",
"input1",
"=",
"$",
"mux2",
"->",
"proceed",
"(",
")",
";",
"$",
"mux2",
"->",
"setInputs",
"(",
"$",
"this",
"->",
"inputs",
"[",
"8",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"9",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"10",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"11",
"]",
")",
";",
"$",
"input2",
"=",
"$",
"mux2",
"->",
"proceed",
"(",
")",
";",
"$",
"mux2",
"->",
"setInputs",
"(",
"$",
"this",
"->",
"inputs",
"[",
"12",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"13",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"14",
"]",
",",
"$",
"this",
"->",
"inputs",
"[",
"15",
"]",
")",
";",
"$",
"input3",
"=",
"$",
"mux2",
"->",
"proceed",
"(",
")",
";",
"$",
"mux2",
"->",
"setControls",
"(",
"$",
"this",
"->",
"controls",
"[",
"2",
"]",
",",
"$",
"this",
"->",
"controls",
"[",
"3",
"]",
")",
";",
"$",
"mux2",
"->",
"setInputs",
"(",
"$",
"input0",
",",
"$",
"input1",
",",
"$",
"input2",
",",
"$",
"input3",
")",
";",
"$",
"output",
"=",
"$",
"mux2",
"->",
"proceed",
"(",
")",
";",
"}",
"return",
"$",
"output",
";",
"}"
] | Runs Multiplexer.
@access public
@return mixed | [
"Runs",
"Multiplexer",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/Multiplexer.php#L98-L133 |
36,230 | CeusMedia/Common | src/ADT/Multiplexer.php | ADT_Multiplexer.setControls | public function setControls()
{
$this->controls = array();
$args = func_get_args();
for( $i = 0; $i < $this->type; $i ++ )
if( isset( $args[$i] ) )
$this->controls[$i] = $args[$i];
} | php | public function setControls()
{
$this->controls = array();
$args = func_get_args();
for( $i = 0; $i < $this->type; $i ++ )
if( isset( $args[$i] ) )
$this->controls[$i] = $args[$i];
} | [
"public",
"function",
"setControls",
"(",
")",
"{",
"$",
"this",
"->",
"controls",
"=",
"array",
"(",
")",
";",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"this",
"->",
"type",
";",
"$",
"i",
"++",
")",
"if",
"(",
"isset",
"(",
"$",
"args",
"[",
"$",
"i",
"]",
")",
")",
"$",
"this",
"->",
"controls",
"[",
"$",
"i",
"]",
"=",
"$",
"args",
"[",
"$",
"i",
"]",
";",
"}"
] | Sets Controls from Method Arguments.
@access public
@return void | [
"Sets",
"Controls",
"from",
"Method",
"Arguments",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/Multiplexer.php#L140-L147 |
36,231 | CeusMedia/Common | src/ADT/Multiplexer.php | ADT_Multiplexer.setInputs | public function setInputs()
{
$this->inputs = array();
$len = pow( 2, $this->type );
$args = func_get_args();
for( $i = 0; $i < $len; $i ++ )
if( isset( $args[$i] ) )
$this->inputs[$i] = $args[$i];
} | php | public function setInputs()
{
$this->inputs = array();
$len = pow( 2, $this->type );
$args = func_get_args();
for( $i = 0; $i < $len; $i ++ )
if( isset( $args[$i] ) )
$this->inputs[$i] = $args[$i];
} | [
"public",
"function",
"setInputs",
"(",
")",
"{",
"$",
"this",
"->",
"inputs",
"=",
"array",
"(",
")",
";",
"$",
"len",
"=",
"pow",
"(",
"2",
",",
"$",
"this",
"->",
"type",
")",
";",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"len",
";",
"$",
"i",
"++",
")",
"if",
"(",
"isset",
"(",
"$",
"args",
"[",
"$",
"i",
"]",
")",
")",
"$",
"this",
"->",
"inputs",
"[",
"$",
"i",
"]",
"=",
"$",
"args",
"[",
"$",
"i",
"]",
";",
"}"
] | Sets Inputs from Method Arguments.
@access public
@return void | [
"Sets",
"Inputs",
"from",
"Method",
"Arguments",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/ADT/Multiplexer.php#L154-L162 |
36,232 | CeusMedia/Common | src/Exception/Validation.php | Exception_Validation.serialize | public function serialize()
{
return serialize( array( $this->message, $this->code, $this->file, $this->line, $this->errors, $this->form ) );
} | php | public function serialize()
{
return serialize( array( $this->message, $this->code, $this->file, $this->line, $this->errors, $this->form ) );
} | [
"public",
"function",
"serialize",
"(",
")",
"{",
"return",
"serialize",
"(",
"array",
"(",
"$",
"this",
"->",
"message",
",",
"$",
"this",
"->",
"code",
",",
"$",
"this",
"->",
"file",
",",
"$",
"this",
"->",
"line",
",",
"$",
"this",
"->",
"errors",
",",
"$",
"this",
"->",
"form",
")",
")",
";",
"}"
] | Returns serial of exception.
@access public
@return string | [
"Returns",
"serial",
"of",
"exception",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Exception/Validation.php#L88-L91 |
36,233 | CeusMedia/Common | src/Net/HTTP/Status.php | Net_HTTP_Status.sendHeader | static public function sendHeader( $code, $protocol = "HTTP/1.0" ){
$text = self::getText( $code );
header( $protocol.' '.$code.' '.$text );
} | php | static public function sendHeader( $code, $protocol = "HTTP/1.0" ){
$text = self::getText( $code );
header( $protocol.' '.$code.' '.$text );
} | [
"static",
"public",
"function",
"sendHeader",
"(",
"$",
"code",
",",
"$",
"protocol",
"=",
"\"HTTP/1.0\"",
")",
"{",
"$",
"text",
"=",
"self",
"::",
"getText",
"(",
"$",
"code",
")",
";",
"header",
"(",
"$",
"protocol",
".",
"' '",
".",
"$",
"code",
".",
"' '",
".",
"$",
"text",
")",
";",
"}"
] | Sends HTTP header with status code and text.
@access public
@param integer $code HTTP status code to send
@param string $protocol HTTP protocol, default: HTTP/1.0
@return void | [
"Sends",
"HTTP",
"header",
"with",
"status",
"code",
"and",
"text",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Net/HTTP/Status.php#L158-L161 |
36,234 | ncou/Chiron | src/Chiron/Routing/Route.php | Route.validateHttpMethods | private function validateHttpMethods(array $methods): array
{
if (empty($methods)) {
throw new InvalidArgumentException(
'HTTP methods argument was empty; must contain at least one method'
);
}
if (false === array_reduce($methods, function ($valid, $method) {
if (false === $valid) {
return false;
}
if (! is_string($method)) {
return false;
}
//if (! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
if (! preg_match("/^[!#$%&'*+.^_`|~0-9a-z-]+$/i", $method)) {
return false;
}
return $valid;
}, true)) {
throw new InvalidArgumentException('One or more HTTP methods were invalid');
}
return array_map('strtoupper', $methods);
} | php | private function validateHttpMethods(array $methods): array
{
if (empty($methods)) {
throw new InvalidArgumentException(
'HTTP methods argument was empty; must contain at least one method'
);
}
if (false === array_reduce($methods, function ($valid, $method) {
if (false === $valid) {
return false;
}
if (! is_string($method)) {
return false;
}
//if (! preg_match('/^[!#$%&\'*+.^_`\|~0-9a-z-]+$/i', $method)) {
if (! preg_match("/^[!#$%&'*+.^_`|~0-9a-z-]+$/i", $method)) {
return false;
}
return $valid;
}, true)) {
throw new InvalidArgumentException('One or more HTTP methods were invalid');
}
return array_map('strtoupper', $methods);
} | [
"private",
"function",
"validateHttpMethods",
"(",
"array",
"$",
"methods",
")",
":",
"array",
"{",
"if",
"(",
"empty",
"(",
"$",
"methods",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'HTTP methods argument was empty; must contain at least one method'",
")",
";",
"}",
"if",
"(",
"false",
"===",
"array_reduce",
"(",
"$",
"methods",
",",
"function",
"(",
"$",
"valid",
",",
"$",
"method",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"valid",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"method",
")",
")",
"{",
"return",
"false",
";",
"}",
"//if (! preg_match('/^[!#$%&\\'*+.^_`\\|~0-9a-z-]+$/i', $method)) {",
"if",
"(",
"!",
"preg_match",
"(",
"\"/^[!#$%&'*+.^_`|~0-9a-z-]+$/i\"",
",",
"$",
"method",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"valid",
";",
"}",
",",
"true",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'One or more HTTP methods were invalid'",
")",
";",
"}",
"return",
"array_map",
"(",
"'strtoupper'",
",",
"$",
"methods",
")",
";",
"}"
] | Validate the provided HTTP method names.
Validates, and then normalizes to upper case.
@param string[] An array of HTTP method names.
@throws Exception InvalidArgumentException for any invalid method names.
@return string[] | [
"Validate",
"the",
"provided",
"HTTP",
"method",
"names",
"."
] | bfb6f85faba0e54005896b09a7c34e456d1a1bed | https://github.com/ncou/Chiron/blob/bfb6f85faba0e54005896b09a7c34e456d1a1bed/src/Chiron/Routing/Route.php#L403-L428 |
36,235 | CeusMedia/Common | src/Loader.php | Loader.registerNew | public static function registerNew( $extensions = NULL, $prefix = NULL, $path = NULL, $logFile = NULL, $verbose = 0 )
{
$loader = new Loader( $extensions, $prefix, $path, $logFile );
$loader->setVerbose( (int) $verbose );
$loader->registerAutoloader();
return $loader;
} | php | public static function registerNew( $extensions = NULL, $prefix = NULL, $path = NULL, $logFile = NULL, $verbose = 0 )
{
$loader = new Loader( $extensions, $prefix, $path, $logFile );
$loader->setVerbose( (int) $verbose );
$loader->registerAutoloader();
return $loader;
} | [
"public",
"static",
"function",
"registerNew",
"(",
"$",
"extensions",
"=",
"NULL",
",",
"$",
"prefix",
"=",
"NULL",
",",
"$",
"path",
"=",
"NULL",
",",
"$",
"logFile",
"=",
"NULL",
",",
"$",
"verbose",
"=",
"0",
")",
"{",
"$",
"loader",
"=",
"new",
"Loader",
"(",
"$",
"extensions",
",",
"$",
"prefix",
",",
"$",
"path",
",",
"$",
"logFile",
")",
";",
"$",
"loader",
"->",
"setVerbose",
"(",
"(",
"int",
")",
"$",
"verbose",
")",
";",
"$",
"loader",
"->",
"registerAutoloader",
"(",
")",
";",
"return",
"$",
"loader",
";",
"}"
] | Register new Autoloader statically.
@static
@access public
@param mixed $extensions String or List of supported Class File Extensions
@param string $prefix Prefix of Classes
@param string $path Path to Classes
@param string $logFile Path to autoload log file
@param boolean $verbose Verbosity: 0 - quiet | 1 - show load | 2 - show scan (default: 0 - quiet)
@return Loader
@deprecated not working in PHP 5.2 | [
"Register",
"new",
"Autoloader",
"statically",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Loader.php#L71-L77 |
36,236 | CeusMedia/Common | src/Loader.php | Loader.loadClass | public function loadClass( $className )
{
if( $this->prefix )
{
$prefix = strtolower( substr( $className, 0, strlen( $this->prefix ) ) );
if( $prefix != $this->prefix )
return FALSE;
$className = str_ireplace( $this->prefix, '', $className );
}
$basePath = $this->path ? $this->path : "";
if( $this->lowerPath )
{
$matches = array();
preg_match_all( '/^(.*)([a-z0-9]+)$/iU', $className, $matches );
$fileName = $matches[2][0];
$pathName = str_replace( "_","/", strtolower( $matches[1][0] ) );
$fileName = $pathName.$fileName;
}
else
$fileName = str_replace( "_","/", $className );
foreach( $this->extensions as $extension )
{
$filePath = $basePath.$fileName.".".$extension;
if( $this->verbose > 1 )
echo $this->lineBreak."autoload: ".$filePath;
if( defined( 'LOADER_LOG' ) && LOADER_LOG )
error_log( $filePath."\n", 3, LOADER_LOG );
# if( !@fopen( $filePath, "r", TRUE ) )
if( !file_exists( $filePath ) )
# if( !is_readable( $filePath ) )
continue;
$this->loadFile( $filePath, TRUE );
return TRUE;
}
return FALSE;
} | php | public function loadClass( $className )
{
if( $this->prefix )
{
$prefix = strtolower( substr( $className, 0, strlen( $this->prefix ) ) );
if( $prefix != $this->prefix )
return FALSE;
$className = str_ireplace( $this->prefix, '', $className );
}
$basePath = $this->path ? $this->path : "";
if( $this->lowerPath )
{
$matches = array();
preg_match_all( '/^(.*)([a-z0-9]+)$/iU', $className, $matches );
$fileName = $matches[2][0];
$pathName = str_replace( "_","/", strtolower( $matches[1][0] ) );
$fileName = $pathName.$fileName;
}
else
$fileName = str_replace( "_","/", $className );
foreach( $this->extensions as $extension )
{
$filePath = $basePath.$fileName.".".$extension;
if( $this->verbose > 1 )
echo $this->lineBreak."autoload: ".$filePath;
if( defined( 'LOADER_LOG' ) && LOADER_LOG )
error_log( $filePath."\n", 3, LOADER_LOG );
# if( !@fopen( $filePath, "r", TRUE ) )
if( !file_exists( $filePath ) )
# if( !is_readable( $filePath ) )
continue;
$this->loadFile( $filePath, TRUE );
return TRUE;
}
return FALSE;
} | [
"public",
"function",
"loadClass",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"prefix",
")",
"{",
"$",
"prefix",
"=",
"strtolower",
"(",
"substr",
"(",
"$",
"className",
",",
"0",
",",
"strlen",
"(",
"$",
"this",
"->",
"prefix",
")",
")",
")",
";",
"if",
"(",
"$",
"prefix",
"!=",
"$",
"this",
"->",
"prefix",
")",
"return",
"FALSE",
";",
"$",
"className",
"=",
"str_ireplace",
"(",
"$",
"this",
"->",
"prefix",
",",
"''",
",",
"$",
"className",
")",
";",
"}",
"$",
"basePath",
"=",
"$",
"this",
"->",
"path",
"?",
"$",
"this",
"->",
"path",
":",
"\"\"",
";",
"if",
"(",
"$",
"this",
"->",
"lowerPath",
")",
"{",
"$",
"matches",
"=",
"array",
"(",
")",
";",
"preg_match_all",
"(",
"'/^(.*)([a-z0-9]+)$/iU'",
",",
"$",
"className",
",",
"$",
"matches",
")",
";",
"$",
"fileName",
"=",
"$",
"matches",
"[",
"2",
"]",
"[",
"0",
"]",
";",
"$",
"pathName",
"=",
"str_replace",
"(",
"\"_\"",
",",
"\"/\"",
",",
"strtolower",
"(",
"$",
"matches",
"[",
"1",
"]",
"[",
"0",
"]",
")",
")",
";",
"$",
"fileName",
"=",
"$",
"pathName",
".",
"$",
"fileName",
";",
"}",
"else",
"$",
"fileName",
"=",
"str_replace",
"(",
"\"_\"",
",",
"\"/\"",
",",
"$",
"className",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"extensions",
"as",
"$",
"extension",
")",
"{",
"$",
"filePath",
"=",
"$",
"basePath",
".",
"$",
"fileName",
".",
"\".\"",
".",
"$",
"extension",
";",
"if",
"(",
"$",
"this",
"->",
"verbose",
">",
"1",
")",
"echo",
"$",
"this",
"->",
"lineBreak",
".",
"\"autoload: \"",
".",
"$",
"filePath",
";",
"if",
"(",
"defined",
"(",
"'LOADER_LOG'",
")",
"&&",
"LOADER_LOG",
")",
"error_log",
"(",
"$",
"filePath",
".",
"\"\\n\"",
",",
"3",
",",
"LOADER_LOG",
")",
";",
"#\t\t\tif( !@fopen( $filePath, \"r\", TRUE ) )",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filePath",
")",
")",
"#\t\t\tif( !is_readable( $filePath ) )",
"continue",
";",
"$",
"this",
"->",
"loadFile",
"(",
"$",
"filePath",
",",
"TRUE",
")",
";",
"return",
"TRUE",
";",
"}",
"return",
"FALSE",
";",
"}"
] | Try to load a Class by its Class Name.
@access public
@param string $className Class Name with encoded Path
@return bool | [
"Try",
"to",
"load",
"a",
"Class",
"by",
"its",
"Class",
"Name",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Loader.php#L85-L120 |
36,237 | CeusMedia/Common | src/Loader.php | Loader.loadFile | public function loadFile( $fileName, $once = FALSE )
{
$this->logLoadedFile( $fileName );
if( $once )
include_once $fileName;
else
include $fileName;
if( $this->verbose > 0 )
echo $this->lineBreak."load: ".$fileName;
} | php | public function loadFile( $fileName, $once = FALSE )
{
$this->logLoadedFile( $fileName );
if( $once )
include_once $fileName;
else
include $fileName;
if( $this->verbose > 0 )
echo $this->lineBreak."load: ".$fileName;
} | [
"public",
"function",
"loadFile",
"(",
"$",
"fileName",
",",
"$",
"once",
"=",
"FALSE",
")",
"{",
"$",
"this",
"->",
"logLoadedFile",
"(",
"$",
"fileName",
")",
";",
"if",
"(",
"$",
"once",
")",
"include_once",
"$",
"fileName",
";",
"else",
"include",
"$",
"fileName",
";",
"if",
"(",
"$",
"this",
"->",
"verbose",
">",
"0",
")",
"echo",
"$",
"this",
"->",
"lineBreak",
".",
"\"load: \"",
".",
"$",
"fileName",
";",
"}"
] | Try to load a File by its File Name.
@access public
@param string $fileName File Name, absolute or relative
@param bool $once Flag: Load once only
@return void | [
"Try",
"to",
"load",
"a",
"File",
"by",
"its",
"File",
"Name",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Loader.php#L129-L138 |
36,238 | CeusMedia/Common | src/Loader.php | Loader.setPath | public function setPath( $path )
{
# if( $path && !file_exists( $path ) )
# throw new RuntimeException( 'Invalid path' );
$path = str_replace( DIRECTORY_SEPARATOR, "/", $path );
$path = preg_replace( "@(.+)/$@", "\\1", $path )."/";
$this->path = $path;
} | php | public function setPath( $path )
{
# if( $path && !file_exists( $path ) )
# throw new RuntimeException( 'Invalid path' );
$path = str_replace( DIRECTORY_SEPARATOR, "/", $path );
$path = preg_replace( "@(.+)/$@", "\\1", $path )."/";
$this->path = $path;
} | [
"public",
"function",
"setPath",
"(",
"$",
"path",
")",
"{",
"#\t\tif( $path && !file_exists( $path ) )",
"#\t\t\tthrow new RuntimeException( 'Invalid path' );",
"$",
"path",
"=",
"str_replace",
"(",
"DIRECTORY_SEPARATOR",
",",
"\"/\"",
",",
"$",
"path",
")",
";",
"$",
"path",
"=",
"preg_replace",
"(",
"\"@(.+)/$@\"",
",",
"\"\\\\1\"",
",",
"$",
"path",
")",
".",
"\"/\"",
";",
"$",
"this",
"->",
"path",
"=",
"$",
"path",
";",
"}"
] | Sets Path to load Files from to force absolute File Names.
@access public
@param string $path Path to load Files from, empty to remove set Path
@return void
@throws RuntimeException if Path is not existing | [
"Sets",
"Path",
"to",
"load",
"Files",
"from",
"to",
"force",
"absolute",
"File",
"Names",
"."
] | 1138adf9341782a6284c05884989f7497532bcf4 | https://github.com/CeusMedia/Common/blob/1138adf9341782a6284c05884989f7497532bcf4/src/Loader.php#L211-L218 |
36,239 | Assasz/yggdrasil | src/Yggdrasil/Core/Controller/ApiController.php | ApiController.fromBody | protected function fromBody(string $key)
{
$dataCollection = $this->parseBody();
if (!$this->inBody([$key])) {
throw new \InvalidArgumentException('Data with key ' . $key . ' doesn\'t exist in request body.');
}
return $dataCollection[$key];
} | php | protected function fromBody(string $key)
{
$dataCollection = $this->parseBody();
if (!$this->inBody([$key])) {
throw new \InvalidArgumentException('Data with key ' . $key . ' doesn\'t exist in request body.');
}
return $dataCollection[$key];
} | [
"protected",
"function",
"fromBody",
"(",
"string",
"$",
"key",
")",
"{",
"$",
"dataCollection",
"=",
"$",
"this",
"->",
"parseBody",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"inBody",
"(",
"[",
"$",
"key",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Data with key '",
".",
"$",
"key",
".",
"' doesn\\'t exist in request body.'",
")",
";",
"}",
"return",
"$",
"dataCollection",
"[",
"$",
"key",
"]",
";",
"}"
] | Returns request body data specified by key
@param string $key
@return mixed
@throws \InvalidArgumentException if data specified by key doesn't exist | [
"Returns",
"request",
"body",
"data",
"specified",
"by",
"key"
] | bee9bef7713b85799cdd3e9b23dccae33154f3b3 | https://github.com/Assasz/yggdrasil/blob/bee9bef7713b85799cdd3e9b23dccae33154f3b3/src/Yggdrasil/Core/Controller/ApiController.php#L63-L72 |
36,240 | 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_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",
";",
"}"
] | 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 |
36,241 | 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",
"->",
"getRequest",
"(",
")",
")",
";",
"return",
"$",
"this",
"->",
"getTemplateEngine",
"(",
")",
"->",
"render",
"(",
"$",
"view",
",",
"$",
"params",
")",
";",
"}"
] | 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 |
36,242 | 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",
"::",
"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",
";",
"}"
] | 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 |
36,243 | 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",
"?",
"\" class=\\\"\"",
".",
"$",
"class",
".",
"\"\\\"\"",
":",
"\"\"",
";",
"$",
"code",
"=",
"\"<acronym\"",
".",
"$",
"ins_title",
".",
"$",
"ins_class",
".",
"\">\"",
".",
"$",
"text",
".",
"\"</acronym>\"",
";",
"return",
"$",
"code",
";",
"}"
] | 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 |
36,244 | 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=\\\"fld_\"",
".",
"$",
"field_id",
".",
"\"\\\"\"",
":",
"\"\"",
";",
"$",
"ins_class",
"=",
"$",
"class",
"?",
"\" class=\\\"\"",
".",
"$",
"class",
".",
"\"\\\"\"",
":",
"\"\"",
";",
"$",
"ins_colspan",
"=",
"(",
"$",
"colspan",
">",
"1",
")",
"?",
"\" colspan=\\\"\"",
".",
"$",
"colspan",
".",
"\"\\\"\"",
":",
"\"\"",
";",
"if",
"(",
"$",
"suffix",
")",
"{",
"$",
"code",
"=",
"\"<td\"",
".",
"$",
"ins_colspan",
".",
"\">\r\n\t\t\t <table cellpadding=\\\"0\\\" cellspacing=\\\"0\\\" border=\\\"0\\\">\r\n\t\t\t <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",
";",
"}"
] | 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 |
36,245 | 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",
",",
"'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",
";",
"}"
] | 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 |
36,246 | 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",
"(",
"$",
"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",
".",
"\">\r\n\t\t\t<table cellpadding='0' cellspacing='0' border='0' width='100%'>\r\n\t\t\t <tr>\r\n\t\t\t\t<td class='label' id='lbl_\"",
".",
"$",
"label_name",
".",
"\"'><label for='\"",
".",
"$",
"label_name",
".",
"\"'>\"",
".",
"$",
"label_text",
".",
"\"</label></td>\r\n\t\t\t\t<td class='prefix' id='ico_\"",
".",
"$",
"label_name",
".",
"\"' align='right' valign='middle'>\r\n\t\t\t\t <table cellpadding='0' cellspacing='0' border='0'><tr>\"",
".",
"$",
"ins_icons",
".",
"\"</tr></table></td>\r\n\t\t\t </tr>\r\n\t\t\t</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",
";",
"}"
] | 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 |
36,247 | 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( "&", "&", $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( "&", "&", $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",
",",
"$",
"relation",
"=",
"NULL",
")",
"{",
"$",
"url",
"=",
"str_replace",
"(",
"'\"'",
",",
"\"'\"",
",",
"$",
"url",
")",
";",
"$",
"url",
"=",
"str_replace",
"(",
"\"&\"",
",",
"\"&\"",
",",
"$",
"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",
";",
"}"
] | 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 |
36,248 | 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",
";",
"$",
"indent",
"=",
"str_repeat",
"(",
"\" \"",
",",
"$",
"depth",
")",
";",
"$",
"tag",
"=",
"UI_HTML_Tag",
"::",
"create",
"(",
"\"li\"",
",",
"$",
"content",
",",
"$",
"attributes",
")",
";",
"$",
"code",
"=",
"$",
"indent",
".",
"$",
"tag",
";",
"return",
"$",
"code",
";",
"}"
] | 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 |
36,249 | 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",
")",
".",
"\"\\n\"",
";",
"$",
"indent",
"=",
"str_repeat",
"(",
"\"\t\"",
",",
"2",
"*",
"abs",
"(",
"(",
"int",
")",
"$",
"level",
")",
")",
";",
"$",
"tag",
"=",
"UI_HTML_Tag",
"::",
"create",
"(",
"\"ol\"",
",",
"$",
"content",
",",
"$",
"attributes",
")",
";",
"$",
"code",
"=",
"$",
"indent",
".",
"$",
"tag",
";",
"return",
"$",
"code",
";",
"}"
] | 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 |
36,250 | 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",
".",
"\"\\\"\"",
":",
"\"\"",
";",
"$",
"ins_colspan",
"=",
"$",
"colspan",
"?",
"\" colspan=\\\"\"",
".",
"$",
"colspan",
".",
"\"\\\"\"",
":",
"\"\"",
";",
"$",
"ins_rowspan",
"=",
"$",
"rowspan",
"?",
"\" rowspan=\\\"\"",
".",
"$",
"rowspan",
".",
"\"\\\"\"",
":",
"\"\"",
";",
"$",
"code",
"=",
"\"<tr><td\"",
".",
"$",
"ins_colspan",
".",
"$",
"ins_rowspan",
".",
"$",
"ins_class",
".",
"\"></td></tr>\"",
";",
"return",
"$",
"code",
";",
"}"
] | 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 |
36,251 | 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",
")",
"{",
"$",
"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",
";",
"}"
] | 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 |
36,252 | 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",
")",
";",
"$",
"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",
";",
"}"
] | 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 |
36,253 | 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",
"]",
"[",
"]",
"=",
"array",
"(",
"\"tag\"",
"=>",
"$",
"tag",
",",
"\"attributes\"",
"=>",
"$",
"attributes",
",",
"\"content\"",
"=>",
"''",
",",
"\"children\"",
"=>",
"array",
"(",
")",
")",
";",
"$",
"index",
"=",
"count",
"(",
"$",
"this",
"->",
"last",
"[",
"$",
"count",
"]",
")",
"-",
"1",
";",
"$",
"this",
"->",
"last",
"[",
"]",
"=",
"&",
"$",
"this",
"->",
"last",
"[",
"$",
"count",
"]",
"[",
"$",
"index",
"]",
"[",
"'children'",
"]",
";",
"}"
] | 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 |
36,254 | 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",
"->",
"last",
"[",
"$",
"count",
"]",
";",
"$",
"childNode",
"=",
"new",
"XML_DOM_Node",
"(",
"$",
"tag",
",",
"\"\"",
",",
"$",
"attributes",
")",
";",
"$",
"parentNode",
"->",
"addChild",
"(",
"$",
"childNode",
")",
";",
"$",
"this",
"->",
"last",
"[",
"]",
"=",
"&",
"$",
"childNode",
";",
"}"
] | 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 |
36,255 | 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",
")",
";",
"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",
";",
"}"
] | 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 |
36,256 | 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",
"false",
";",
"}"
] | 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 |
36,257 | 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'",
":",
"$",
"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",
";",
"}"
] | 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 |
36,258 | 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",
"(",
"$",
"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",
";",
"}"
] | 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 |
36,259 | 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",
")",
";",
"$",
"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",
";",
"}"
] | 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 |
36,260 | 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",
")",
";",
"$",
"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",
"(",
")",
";",
"}",
"#\t\tif( !$method->getAccess() )",
"#\t\t\t$method->setAccess( 'public' );",
"return",
"$",
"method",
";",
"}"
] | 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 |
36,261 | 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 router driver is not supported.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"drivers",
"->",
"get",
"(",
"'router'",
")",
";",
"}"
] | 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 |
36,262 | 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",
"DriverNotSupportedException",
"(",
"'Provided template engine driver is not supported.'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"drivers",
"->",
"get",
"(",
"'templateEngine'",
")",
";",
"}"
] | 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 |
36,263 | 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",
"(",
"$",
"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",
";",
"}"
] | 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 |
36,264 | 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",
"(",
"$",
"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",
"}",
"}",
"}"
] | 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 |
36,265 | 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",
"[",
"$",
"errorKey",
"]",
";",
"return",
"$",
"list",
";",
"}"
] | 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 |
36,266 | 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",
")",
")",
";",
"return",
"$",
"this",
"->",
"rules",
"[",
"$",
"error",
"]",
";",
"}"
] | 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 |
36,267 | 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",
";",
"$",
"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",
";",
"}"
] | 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 |
36,268 | 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",
"->",
"lastCheck",
")",
";",
"$",
"data",
"=",
"array_merge",
"(",
"$",
"last",
",",
"$",
"data",
")",
";",
"return",
"FS_File_Writer",
"::",
"save",
"(",
"$",
"this",
"->",
"cacheFile",
",",
"json_encode",
"(",
"$",
"data",
")",
")",
";",
"}"
] | 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 |
36,269 | 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",
"->",
"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",
")",
";",
"}"
] | 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 |
36,270 | 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",
"$",
"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",
";",
"}",
"}",
"}",
"}"
] | 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 |
36,271 | 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",
"(",
"$",
"array",
"as",
"$",
"sectionName",
"=>",
"$",
"sectionData",
")",
"foreach",
"(",
"$",
"sectionData",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"$",
"this",
"->",
"pairs",
"[",
"$",
"sectionName",
".",
"\".\"",
".",
"$",
"key",
"]",
"=",
"$",
"item",
"[",
"'value'",
"]",
";",
"}"
] | 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 |
36,272 | 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",
"(",
"$",
"sectionData",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"$",
"this",
"->",
"pairs",
"[",
"$",
"sectionName",
".",
"\".\"",
".",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}"
] | 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 |
36,273 | 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",
"(",
")",
";",
"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",
"}"
] | 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 |
36,274 | 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",
")",
"// 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",
";",
"}",
"}",
"}"
] | 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 |
36,275 | 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",
"(",
"$",
"sectionData",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"$",
"this",
"->",
"pairs",
"[",
"$",
"sectionName",
".",
"\".\"",
".",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}"
] | 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 |
36,276 | 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",
")",
";",
"if",
"(",
"$",
"lastCache",
"&&",
"$",
"lastChange",
"<=",
"$",
"lastCache",
")",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"cacheFile",
")",
";",
"$",
"array",
"=",
"@",
"unserialize",
"(",
"$",
"content",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"array",
")",
")",
"{",
"$",
"this",
"->",
"pairs",
"=",
"$",
"array",
";",
"return",
"TRUE",
";",
"}",
"}",
"return",
"FALSE",
";",
"}"
] | 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 |
36,277 | 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",
"AccessorInterface",
")",
"{",
"$",
"result",
"[",
"$",
"field",
"]",
"=",
"$",
"value",
"->",
"packValue",
"(",
")",
";",
"}",
"else",
"{",
"$",
"result",
"[",
"$",
"field",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"return",
"$",
"result",
";",
"}"
] | 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 |
36,278 | 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",
")",
"||",
"!",
"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",
"]",
")",
";",
"}"
] | 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 |
36,279 | 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",
"(",
"$",
"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",
";",
"}"
] | 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 |
36,280 | 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",
"(",
"$",
"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",
";",
"}",
"}"
] | 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 |
36,281 | 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",
",",
"$",
"params",
")",
";",
"$",
"this",
"->",
"usedPrepare",
"=",
"true",
";",
"$",
"stmt",
"->",
"execute",
"(",
")",
";",
"return",
"$",
"stmt",
";",
"}"
] | 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 |
36,282 | 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",
"->",
"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",
"(",
")",
")",
";",
"}"
] | 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 |
36,283 | 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",
"(",
"$",
"newNode",
")",
")",
"{",
"$",
"this",
"->",
"nodes",
"[",
"]",
"=",
"$",
"newNode",
";",
"return",
"$",
"newNode",
";",
"}",
"else",
"return",
"$",
"this",
"->",
"getNode",
"(",
"$",
"nodeName",
")",
";",
"}"
] | 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 |
36,284 | 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",
"]",
"->",
"getNodeName",
"(",
")",
"==",
"$",
"node",
")",
"return",
"$",
"this",
"->",
"nodes",
"[",
"$",
"i",
"]",
";",
"return",
"NULL",
";",
"}"
] | 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 |
36,285 | 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",
"]",
"==",
"$",
"node",
")",
"return",
"$",
"i",
";",
"return",
"NULL",
";",
"}"
] | 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 |
36,286 | 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",
"->",
"getNodeIndex",
"(",
"$",
"node",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"nodes",
"[",
"$",
"index",
"]",
")",
";",
"sort",
"(",
"$",
"this",
"->",
"nodes",
")",
";",
"}"
] | 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 |
36,287 | 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",
"->",
"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",
")",
";",
"}"
] | 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 |
36,288 | 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",
"->",
"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",
";",
"}"
] | 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 |
36,289 | 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 |
36,290 | 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",
"::",
"getPlaceholderPattern",
"(",
")",
",",
"$",
"content",
")",
";",
"}"
] | 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 |
36,291 | 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",
"(",
")",
",",
"$",
"content",
",",
"$",
"result",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"matchCount",
"&&",
"0",
"<",
"$",
"matchCount",
")",
"{",
"foreach",
"(",
"$",
"result",
"as",
"$",
"index",
"=>",
"$",
"placeholders",
")",
"{",
"$",
"result",
"[",
"$",
"index",
"]",
"=",
"array_unique",
"(",
"$",
"placeholders",
")",
";",
"}",
"}",
"return",
"$",
"result",
";",
"}"
] | 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 |
36,292 | 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",
",",
"\"vars\"",
"=>",
"$",
"this",
"->",
"vars",
",",
")",
";",
"return",
"$",
"data",
";",
"}"
] | 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 |
36,293 | 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",
"(",
"$",
"parts",
"[",
"1",
"]",
")",
";",
"return",
"$",
"value",
";",
"}"
] | 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 |
36,294 | 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 \"'",
".",
"$",
"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.'",
")",
";",
"}",
"}"
] | 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 |
36,295 | 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",
";",
"$",
"result",
"->",
"route",
"=",
"$",
"route",
";",
"$",
"result",
"->",
"matchedParams",
"=",
"$",
"params",
";",
"return",
"$",
"result",
";",
"}"
] | 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 |
36,296 | 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",
"=",
"$",
"methods",
";",
"return",
"$",
"result",
";",
"}"
] | 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 |
36,297 | 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",
"true",
";",
"}"
] | 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 |
36,298 | 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",
"->",
"route",
")",
"{",
"$",
"this",
"->",
"matchedRouteMiddlewareStack",
"=",
"$",
"this",
"->",
"route",
"->",
"gatherMiddlewareStack",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"matchedRouteMiddlewareStack",
";",
"}"
] | 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 |
36,299 | 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",
"(",
")",
":",
"[",
"]",
";",
"}",
"return",
"$",
"this",
"->",
"allowedMethods",
";",
"}"
] | 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 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.