repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
vegas-cmf/oauth | src/OAuth/Storage/Session.php | Session.clearAuthorizationState | public function clearAuthorizationState($service)
{
$service = $this->normalizeServiceName($service);
$states = $this->sessionScope->get(self::SESSION_STATE);
if (array_key_exists($service, $states)) {
unset($states, $service);
}
$this->sessionScope->set(self::SE... | php | public function clearAuthorizationState($service)
{
$service = $this->normalizeServiceName($service);
$states = $this->sessionScope->get(self::SESSION_STATE);
if (array_key_exists($service, $states)) {
unset($states, $service);
}
$this->sessionScope->set(self::SE... | [
"public",
"function",
"clearAuthorizationState",
"(",
"$",
"service",
")",
"{",
"$",
"service",
"=",
"$",
"this",
"->",
"normalizeServiceName",
"(",
"$",
"service",
")",
";",
"$",
"states",
"=",
"$",
"this",
"->",
"sessionScope",
"->",
"get",
"(",
"self",
... | Clear the authorization state of a given service
@param string $service
@return TokenStorageInterface | [
"Clear",
"the",
"authorization",
"state",
"of",
"a",
"given",
"service"
] | 5183a60d02cdf3b7db9f3168be1c0bbe1306cddf | https://github.com/vegas-cmf/oauth/blob/5183a60d02cdf3b7db9f3168be1c0bbe1306cddf/src/OAuth/Storage/Session.php#L202-L213 | train |
kambalabs/KmbPmProxy | src/KmbPmProxy/Model/PuppetClass.php | PuppetClass.getParameterDefinition | public function getParameterDefinition($name)
{
if ($this->hasParametersDefinitions()) {
foreach ($this->getParametersDefinitions() as $parameterDefinition) {
if ($parameterDefinition->name === $name) {
return $parameterDefinition;
}
... | php | public function getParameterDefinition($name)
{
if ($this->hasParametersDefinitions()) {
foreach ($this->getParametersDefinitions() as $parameterDefinition) {
if ($parameterDefinition->name === $name) {
return $parameterDefinition;
}
... | [
"public",
"function",
"getParameterDefinition",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasParametersDefinitions",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getParametersDefinitions",
"(",
")",
"as",
"$",
"parameterDefinition",... | Get specified parameter definition.
@param string $name
@return \stdClass | [
"Get",
"specified",
"parameter",
"definition",
"."
] | b4c664ae8b6f29e4e8768461ed99e1b0b80bde18 | https://github.com/kambalabs/KmbPmProxy/blob/b4c664ae8b6f29e4e8768461ed99e1b0b80bde18/src/KmbPmProxy/Model/PuppetClass.php#L116-L126 | train |
kambalabs/KmbPmProxy | src/KmbPmProxy/Model/PuppetClass.php | PuppetClass.getParameterTemplate | public function getParameterTemplate($name)
{
if ($this->hasParametersTemplates()) {
foreach ($this->getParametersTemplates() as $parameterTemplate) {
if ($parameterTemplate->name === $name) {
return $parameterTemplate;
}
}
... | php | public function getParameterTemplate($name)
{
if ($this->hasParametersTemplates()) {
foreach ($this->getParametersTemplates() as $parameterTemplate) {
if ($parameterTemplate->name === $name) {
return $parameterTemplate;
}
}
... | [
"public",
"function",
"getParameterTemplate",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasParametersTemplates",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getParametersTemplates",
"(",
")",
"as",
"$",
"parameterTemplate",
")",
... | Get specified parameter template.
@param string $name
@return \stdClass | [
"Get",
"specified",
"parameter",
"template",
"."
] | b4c664ae8b6f29e4e8768461ed99e1b0b80bde18 | https://github.com/kambalabs/KmbPmProxy/blob/b4c664ae8b6f29e4e8768461ed99e1b0b80bde18/src/KmbPmProxy/Model/PuppetClass.php#L183-L193 | train |
WellCommerce/PageBundle | Form/Admin/PageFormBuilder.php | PageFormBuilder.addShopFieldset | private function addShopFieldset(FormInterface $form)
{
$shopsData = $form->addChild($this->getElement('nested_fieldset', [
'name' => 'shops_data',
'label' => $this->trans('common.fieldset.shops')
]));
$shopsData->addChild($this->getElement('multi_select', [
... | php | private function addShopFieldset(FormInterface $form)
{
$shopsData = $form->addChild($this->getElement('nested_fieldset', [
'name' => 'shops_data',
'label' => $this->trans('common.fieldset.shops')
]));
$shopsData->addChild($this->getElement('multi_select', [
... | [
"private",
"function",
"addShopFieldset",
"(",
"FormInterface",
"$",
"form",
")",
"{",
"$",
"shopsData",
"=",
"$",
"form",
"->",
"addChild",
"(",
"$",
"this",
"->",
"getElement",
"(",
"'nested_fieldset'",
",",
"[",
"'name'",
"=>",
"'shops_data'",
",",
"'labe... | Adds shop selector fieldset to form
@param FormInterface $form | [
"Adds",
"shop",
"selector",
"fieldset",
"to",
"form"
] | c9a1e8c8c52177e3b82f246fd38a4598214aa222 | https://github.com/WellCommerce/PageBundle/blob/c9a1e8c8c52177e3b82f246fd38a4598214aa222/Form/Admin/PageFormBuilder.php#L194-L207 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Message/MessageFactory.php | MessageFactory.fromMessage | public function fromMessage($message)
{
static $parser;
if (!$parser) {
$parser = new MessageParser();
}
// Parse a response
if (strtoupper(substr($message, 0, 4)) == 'HTTP') {
$data = $parser->parseResponse($message);
return $this->create... | php | public function fromMessage($message)
{
static $parser;
if (!$parser) {
$parser = new MessageParser();
}
// Parse a response
if (strtoupper(substr($message, 0, 4)) == 'HTTP') {
$data = $parser->parseResponse($message);
return $this->create... | [
"public",
"function",
"fromMessage",
"(",
"$",
"message",
")",
"{",
"static",
"$",
"parser",
";",
"if",
"(",
"!",
"$",
"parser",
")",
"{",
"$",
"parser",
"=",
"new",
"MessageParser",
"(",
")",
";",
"}",
"// Parse a response",
"if",
"(",
"strtoupper",
"... | Create a request or response object from an HTTP message string
@param string $message Message to parse
@return RequestInterface|ResponseInterface
@throws \InvalidArgumentException if unable to parse a message | [
"Create",
"a",
"request",
"or",
"response",
"object",
"from",
"an",
"HTTP",
"message",
"string"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Message/MessageFactory.php#L89-L123 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Message/MessageFactory.php | MessageFactory.addPostData | protected function addPostData(RequestInterface $request, array $body)
{
static $fields = ['string' => true, 'array' => true, 'NULL' => true,
'boolean' => true, 'double' => true, 'integer' => true];
$post = new PostBody();
foreach ($body as $key => $value) {
if (isse... | php | protected function addPostData(RequestInterface $request, array $body)
{
static $fields = ['string' => true, 'array' => true, 'NULL' => true,
'boolean' => true, 'double' => true, 'integer' => true];
$post = new PostBody();
foreach ($body as $key => $value) {
if (isse... | [
"protected",
"function",
"addPostData",
"(",
"RequestInterface",
"$",
"request",
",",
"array",
"$",
"body",
")",
"{",
"static",
"$",
"fields",
"=",
"[",
"'string'",
"=>",
"true",
",",
"'array'",
"=>",
"true",
",",
"'NULL'",
"=>",
"true",
",",
"'boolean'",
... | Apply POST fields and files to a request to attempt to give an accurate
representation.
@param RequestInterface $request Request to update
@param array $body Body to apply | [
"Apply",
"POST",
"fields",
"and",
"files",
"to",
"a",
"request",
"to",
"attempt",
"to",
"give",
"an",
"accurate",
"representation",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Message/MessageFactory.php#L132-L153 | train |
bheisig/cli | src/JSONFile.php | JSONFile.read | public static function read($file, $force = false) {
if (!is_readable($file)) {
if ($force === true) {
return [];
} else {
throw new Exception(sprintf(
'Unable to read file "%s"',
$file
), ExitApp::RU... | php | public static function read($file, $force = false) {
if (!is_readable($file)) {
if ($force === true) {
return [];
} else {
throw new Exception(sprintf(
'Unable to read file "%s"',
$file
), ExitApp::RU... | [
"public",
"static",
"function",
"read",
"(",
"$",
"file",
",",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"file",
")",
")",
"{",
"if",
"(",
"$",
"force",
"===",
"true",
")",
"{",
"return",
"[",
"]",
";",
"}",... | Parse a JSON file
@param string $file File path
@param bool $force If "true" and file is not readable ignore it, otherwise throw an exception. Defaults to
"false".
@return array Return content as an array
@throws Exception on error | [
"Parse",
"a",
"JSON",
"file"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/JSONFile.php#L45-L79 | train |
bheisig/cli | src/JSONFile.php | JSONFile.write | public static function write($file, array $content) {
$jsonString = json_encode($content, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
if ($jsonString === false) {
throw new Exception('Unable to convert array to JSON string', ExitApp::RUNTIME_ERROR);
}
$status = file_put_co... | php | public static function write($file, array $content) {
$jsonString = json_encode($content, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
if ($jsonString === false) {
throw new Exception('Unable to convert array to JSON string', ExitApp::RUNTIME_ERROR);
}
$status = file_put_co... | [
"public",
"static",
"function",
"write",
"(",
"$",
"file",
",",
"array",
"$",
"content",
")",
"{",
"$",
"jsonString",
"=",
"json_encode",
"(",
"$",
"content",
",",
"JSON_PRETTY_PRINT",
"|",
"JSON_UNESCAPED_SLASHES",
")",
";",
"if",
"(",
"$",
"jsonString",
... | Write JSON-formatted content to file
@param string $file File path
@param array $content Content
@throws Exception on error | [
"Write",
"JSON",
"-",
"formatted",
"content",
"to",
"file"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/JSONFile.php#L89-L107 | train |
railken/lem | src/Generator.php | Generator.generate | public function generate(string $path, string $namespace, string $name)
{
$name = $this->camelize($name);
$vars = [
'NAMESPACE' => $namespace,
'NAME' => $name,
'NAME:CAMELIZED' => $name,
'NAME:UNDERSCORE' => $this->underscore($name),... | php | public function generate(string $path, string $namespace, string $name)
{
$name = $this->camelize($name);
$vars = [
'NAMESPACE' => $namespace,
'NAME' => $name,
'NAME:CAMELIZED' => $name,
'NAME:UNDERSCORE' => $this->underscore($name),... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"path",
",",
"string",
"$",
"namespace",
",",
"string",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"camelize",
"(",
"$",
"name",
")",
";",
"$",
"vars",
"=",
"[",
"'NAMESPACE'",
... | Generate a new ModelStructure folder.
@param string $path
@param string $namespace
@param string $name | [
"Generate",
"a",
"new",
"ModelStructure",
"folder",
"."
] | cff1efcd090a9504b2faf5594121885786dea67a | https://github.com/railken/lem/blob/cff1efcd090a9504b2faf5594121885786dea67a/src/Generator.php#L45-L65 | train |
pryley/castor-framework | src/Forms/Field.php | Field.getField | public function getField( array $args = [] )
{
if( empty( $args )) {
$args = $this->args;
}
$className = sprintf( 'GeminiLabs\Castor\Forms\Fields\%s', ucfirst( $args['type'] ));
if( !class_exists( $className )) {
throw new ReflectionException( "Class does not exist: {$className}" );
}
return (new ... | php | public function getField( array $args = [] )
{
if( empty( $args )) {
$args = $this->args;
}
$className = sprintf( 'GeminiLabs\Castor\Forms\Fields\%s', ucfirst( $args['type'] ));
if( !class_exists( $className )) {
throw new ReflectionException( "Class does not exist: {$className}" );
}
return (new ... | [
"public",
"function",
"getField",
"(",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"args",
")",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"args",
";",
"}",
"$",
"className",
"=",
"sprintf",
"(",
"'GeminiLabs\... | Get a specific Field
@return mixed GeminiLabs\SiteReviews\Html\Fields\* | [
"Get",
"a",
"specific",
"Field"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Field.php#L48-L61 | train |
pryley/castor-framework | src/Forms/Field.php | Field.normalize | public function normalize( array $args = [] )
{
$defaults = [
'after' => '',
'attributes' => '',
'before' => '',
'class' => '',
'default' => null,
'depends' => null,
'desc' => '',
'errors' => [],
'inline' => false,
'label' => '',
'name... | php | public function normalize( array $args = [] )
{
$defaults = [
'after' => '',
'attributes' => '',
'before' => '',
'class' => '',
'default' => null,
'depends' => null,
'desc' => '',
'errors' => [],
'inline' => false,
'label' => '',
'name... | [
"public",
"function",
"normalize",
"(",
"array",
"$",
"args",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'after'",
"=>",
"''",
",",
"'attributes'",
"=>",
"''",
",",
"'before'",
"=>",
"''",
",",
"'class'",
"=>",
"''",
",",
"'default'",
"=>",... | Normalize the field arguments
@return $this | [
"Normalize",
"the",
"field",
"arguments"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Field.php#L68-L111 | train |
pryley/castor-framework | src/Forms/Field.php | Field.render | public function render( $print = true )
{
if( $this->args['render'] === false )return;
$field = $this->getField();
$class = 'glsr-field';
$class .= $this->args['errors'] ? ' glsr-has-error' : '';
$renderedString = '%s';
if( ( isset( $field->args['required'] ) && $field->args['required'] )
|| ( isse... | php | public function render( $print = true )
{
if( $this->args['render'] === false )return;
$field = $this->getField();
$class = 'glsr-field';
$class .= $this->args['errors'] ? ' glsr-has-error' : '';
$renderedString = '%s';
if( ( isset( $field->args['required'] ) && $field->args['required'] )
|| ( isse... | [
"public",
"function",
"render",
"(",
"$",
"print",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"args",
"[",
"'render'",
"]",
"===",
"false",
")",
"return",
";",
"$",
"field",
"=",
"$",
"this",
"->",
"getField",
"(",
")",
";",
"$",
"class... | Render the field
@param mixed $print
@return string|void | [
"Render",
"the",
"field"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Field.php#L120-L155 | train |
pryley/castor-framework | src/Forms/Field.php | Field.checkForErrors | protected function checkForErrors( array $atts )
{
$args = $this->args;
if( !array_key_exists( $atts['name'], $args['errors'] )) {
$this->args['errors'] = ''; // set to an empty string
return;
}
$field_errors = $args['errors'][ $atts['name'] ];
$errors = array_reduce( $field_errors['errors'], functi... | php | protected function checkForErrors( array $atts )
{
$args = $this->args;
if( !array_key_exists( $atts['name'], $args['errors'] )) {
$this->args['errors'] = ''; // set to an empty string
return;
}
$field_errors = $args['errors'][ $atts['name'] ];
$errors = array_reduce( $field_errors['errors'], functi... | [
"protected",
"function",
"checkForErrors",
"(",
"array",
"$",
"atts",
")",
"{",
"$",
"args",
"=",
"$",
"this",
"->",
"args",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"atts",
"[",
"'name'",
"]",
",",
"$",
"args",
"[",
"'errors'",
"]",
")",
... | Check for form submission field errors
@return void | [
"Check",
"for",
"form",
"submission",
"field",
"errors"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Field.php#L174-L190 | train |
pryley/castor-framework | src/Forms/Field.php | Field.parseAttributes | protected function parseAttributes( array $args )
{
if( empty( $args['attributes'] )) {
return [];
}
$attributes = (array) $args['attributes'];
foreach( $attributes as $key => $value ) {
if( is_string( $key ))continue;
unset( $attributes[ $key ] );
if( !isset( $attributes[ $value ] )) {
$attr... | php | protected function parseAttributes( array $args )
{
if( empty( $args['attributes'] )) {
return [];
}
$attributes = (array) $args['attributes'];
foreach( $attributes as $key => $value ) {
if( is_string( $key ))continue;
unset( $attributes[ $key ] );
if( !isset( $attributes[ $value ] )) {
$attr... | [
"protected",
"function",
"parseAttributes",
"(",
"array",
"$",
"args",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"args",
"[",
"'attributes'",
"]",
")",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"attributes",
"=",
"(",
"array",
")",
"$",
"args",
"[... | Parse the field attributes and convert to an array if needed
@return array | [
"Parse",
"the",
"field",
"attributes",
"and",
"convert",
"to",
"an",
"array",
"if",
"needed"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Field.php#L197-L214 | train |
pryley/castor-framework | src/Forms/Field.php | Field.parseId | protected function parseId( array $args )
{
if( isset( $args['id'] ) && !$args['id'] )return;
!$args['suffix'] ?: $args['suffix'] = "-{$args['suffix']}";
return str_replace( ['[]','[',']','.'], ['','-','','-'], $this->parseName( $args ) . $args['suffix'] );
} | php | protected function parseId( array $args )
{
if( isset( $args['id'] ) && !$args['id'] )return;
!$args['suffix'] ?: $args['suffix'] = "-{$args['suffix']}";
return str_replace( ['[]','[',']','.'], ['','-','','-'], $this->parseName( $args ) . $args['suffix'] );
} | [
"protected",
"function",
"parseId",
"(",
"array",
"$",
"args",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"args",
"[",
"'id'",
"]",
")",
"&&",
"!",
"$",
"args",
"[",
"'id'",
"]",
")",
"return",
";",
"!",
"$",
"args",
"[",
"'suffix'",
"]",
"?",
":"... | Parse the field ID from the field path
@return null|string | [
"Parse",
"the",
"field",
"ID",
"from",
"the",
"field",
"path"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Field.php#L221-L228 | train |
pryley/castor-framework | src/Forms/Field.php | Field.parseName | protected function parseName( array $args )
{
$name = $args['name'];
$prefix = $this->parsePrefix( $args );
if( $prefix === false ) {
return $name;
}
$paths = explode( '.', $name );
return array_reduce( $paths, function( $result, $value ) {
return $result .= "[$value]";
}, $prefix );
} | php | protected function parseName( array $args )
{
$name = $args['name'];
$prefix = $this->parsePrefix( $args );
if( $prefix === false ) {
return $name;
}
$paths = explode( '.', $name );
return array_reduce( $paths, function( $result, $value ) {
return $result .= "[$value]";
}, $prefix );
} | [
"protected",
"function",
"parseName",
"(",
"array",
"$",
"args",
")",
"{",
"$",
"name",
"=",
"$",
"args",
"[",
"'name'",
"]",
";",
"$",
"prefix",
"=",
"$",
"this",
"->",
"parsePrefix",
"(",
"$",
"args",
")",
";",
"if",
"(",
"$",
"prefix",
"===",
... | Parse the field name
@return string | [
"Parse",
"the",
"field",
"name"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Field.php#L247-L261 | train |
pryley/castor-framework | src/Forms/Field.php | Field.parseType | protected function parseType( array $args )
{
$type = $args['type'];
return false !== stripos( $type, '_inline' )
? str_replace( '_inline', '', $type )
: $type;
} | php | protected function parseType( array $args )
{
$type = $args['type'];
return false !== stripos( $type, '_inline' )
? str_replace( '_inline', '', $type )
: $type;
} | [
"protected",
"function",
"parseType",
"(",
"array",
"$",
"args",
")",
"{",
"$",
"type",
"=",
"$",
"args",
"[",
"'type'",
"]",
";",
"return",
"false",
"!==",
"stripos",
"(",
"$",
"type",
",",
"'_inline'",
")",
"?",
"str_replace",
"(",
"'_inline'",
",",
... | Parse the field type
@return string | [
"Parse",
"the",
"field",
"type"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Field.php#L278-L285 | train |
pryley/castor-framework | src/Forms/Field.php | Field.parseValue | protected function parseValue( array $args )
{
$default = $args['default'];
$name = $args['name'];
$prefix = $args['prefix'];
$value = $args['value'];
if( $default == ':placeholder' ) {
$default = '';
}
return ( !empty( $value ) || !$name || $prefix === false )
? $value
: $default;
} | php | protected function parseValue( array $args )
{
$default = $args['default'];
$name = $args['name'];
$prefix = $args['prefix'];
$value = $args['value'];
if( $default == ':placeholder' ) {
$default = '';
}
return ( !empty( $value ) || !$name || $prefix === false )
? $value
: $default;
} | [
"protected",
"function",
"parseValue",
"(",
"array",
"$",
"args",
")",
"{",
"$",
"default",
"=",
"$",
"args",
"[",
"'default'",
"]",
";",
"$",
"name",
"=",
"$",
"args",
"[",
"'name'",
"]",
";",
"$",
"prefix",
"=",
"$",
"args",
"[",
"'prefix'",
"]",... | Parse the field value
@return string | [
"Parse",
"the",
"field",
"value"
] | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Forms/Field.php#L292-L306 | train |
nicodevs/laito | src/Laito/Http/Response.php | Response.output | public function output($response)
{
// Set format
switch ($this->format) {
case 'json':
$response = array_merge_recursive($response, $this->extra);
$this->header('Content-type: application/json; charset=utf-8');
$response = json_encode($res... | php | public function output($response)
{
// Set format
switch ($this->format) {
case 'json':
$response = array_merge_recursive($response, $this->extra);
$this->header('Content-type: application/json; charset=utf-8');
$response = json_encode($res... | [
"public",
"function",
"output",
"(",
"$",
"response",
")",
"{",
"// Set format",
"switch",
"(",
"$",
"this",
"->",
"format",
")",
"{",
"case",
"'json'",
":",
"$",
"response",
"=",
"array_merge_recursive",
"(",
"$",
"response",
",",
"$",
"this",
"->",
"ex... | Echoes out the response
@param array $response Response data
@return string HTTP Response | [
"Echoes",
"out",
"the",
"response"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Http/Response.php#L99-L130 | train |
nicodevs/laito | src/Laito/Http/Response.php | Response.error | public function error($code, $message, $extra = [])
{
$response['success'] = false;
$this->extra($extra);
if (!in_array($code, array_keys($this->errors))) {
$code = 500;
}
$response['error']['code'] = $code;
$this->header($this->errors[$code]);
$re... | php | public function error($code, $message, $extra = [])
{
$response['success'] = false;
$this->extra($extra);
if (!in_array($code, array_keys($this->errors))) {
$code = 500;
}
$response['error']['code'] = $code;
$this->header($this->errors[$code]);
$re... | [
"public",
"function",
"error",
"(",
"$",
"code",
",",
"$",
"message",
",",
"$",
"extra",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"[",
"'success'",
"]",
"=",
"false",
";",
"$",
"this",
"->",
"extra",
"(",
"$",
"extra",
")",
";",
"if",
"(",
"!"... | Sets an error header and echoes out the response
@param int $code Error code
@param string $message Error message
@return string HTTP Response | [
"Sets",
"an",
"error",
"header",
"and",
"echoes",
"out",
"the",
"response"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Http/Response.php#L139-L151 | train |
nicodevs/laito | src/Laito/Http/Response.php | Response.html | private function html($data)
{
if (!is_array($data)) {
return $data;
}
$return = '';
foreach ($data as $key => $value) {
$return .= '<li>' . $key . ': ' . (is_array($value) ? $this->html($value) : $value) . '</li>';
}
return '<ul>' . $return . ... | php | private function html($data)
{
if (!is_array($data)) {
return $data;
}
$return = '';
foreach ($data as $key => $value) {
$return .= '<li>' . $key . ': ' . (is_array($value) ? $this->html($value) : $value) . '</li>';
}
return '<ul>' . $return . ... | [
"private",
"function",
"html",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"$",
"return",
"=",
"''",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
... | Transforms an array into an HTML list
@param array $data Array of data to transform
@return string HTML list | [
"Transforms",
"an",
"array",
"into",
"an",
"HTML",
"list"
] | d2d28abfcbf981c4decfec28ce94f8849600e9fe | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Http/Response.php#L159-L169 | train |
zewadesign/framework | Zewa/HTTP/Session.php | Session.flashManagement | private function flashManagement()
{
$flashdata = $_SESSION[$this->flashdataId] ?? null;
if ($flashdata !== null) {
$flashdata = unserialize(base64_decode($flashdata));
unset($_SESSION[$this->flashdataId]);
if (!empty($flashdata)) {
$this->flashda... | php | private function flashManagement()
{
$flashdata = $_SESSION[$this->flashdataId] ?? null;
if ($flashdata !== null) {
$flashdata = unserialize(base64_decode($flashdata));
unset($_SESSION[$this->flashdataId]);
if (!empty($flashdata)) {
$this->flashda... | [
"private",
"function",
"flashManagement",
"(",
")",
"{",
"$",
"flashdata",
"=",
"$",
"_SESSION",
"[",
"$",
"this",
"->",
"flashdataId",
"]",
"??",
"null",
";",
"if",
"(",
"$",
"flashdata",
"!==",
"null",
")",
"{",
"$",
"flashdata",
"=",
"unserialize",
... | Processes current requests flashdata, recycles old.
@access private | [
"Processes",
"current",
"requests",
"flashdata",
"recycles",
"old",
"."
] | be74e41c674ac2c2ef924752ed310cfbaafe33b8 | https://github.com/zewadesign/framework/blob/be74e41c674ac2c2ef924752ed310cfbaafe33b8/Zewa/HTTP/Session.php#L33-L45 | train |
zewadesign/framework | Zewa/HTTP/Session.php | Session.set | public function set(string $key, $value)
{
$key = $this->security->normalize($key);
$value = $this->security->normalize($value);
parent::set($key, $value); // TODO: Change the autogenerated stub
$_SESSION[$key] = $value;
} | php | public function set(string $key, $value)
{
$key = $this->security->normalize($key);
$value = $this->security->normalize($value);
parent::set($key, $value); // TODO: Change the autogenerated stub
$_SESSION[$key] = $value;
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"security",
"->",
"normalize",
"(",
"$",
"key",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"security",
"->",
"normalize",
... | In addition, most superglobals are immuteable, whereas session is not | [
"In",
"addition",
"most",
"superglobals",
"are",
"immuteable",
"whereas",
"session",
"is",
"not"
] | be74e41c674ac2c2ef924752ed310cfbaafe33b8 | https://github.com/zewadesign/framework/blob/be74e41c674ac2c2ef924752ed310cfbaafe33b8/Zewa/HTTP/Session.php#L66-L72 | train |
zewadesign/framework | Zewa/HTTP/Session.php | Session.destroy | public function destroy()
{
$_SESSION = [];
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
$time = time() - 42000;
$path = $params['path'];
$domain = $params['domain'];
$secure = $params['secure'];
... | php | public function destroy()
{
$_SESSION = [];
if (ini_get("session.use_cookies")) {
$params = session_get_cookie_params();
$time = time() - 42000;
$path = $params['path'];
$domain = $params['domain'];
$secure = $params['secure'];
... | [
"public",
"function",
"destroy",
"(",
")",
"{",
"$",
"_SESSION",
"=",
"[",
"]",
";",
"if",
"(",
"ini_get",
"(",
"\"session.use_cookies\"",
")",
")",
"{",
"$",
"params",
"=",
"session_get_cookie_params",
"(",
")",
";",
"$",
"time",
"=",
"time",
"(",
")"... | destroys a session and related cookies | [
"destroys",
"a",
"session",
"and",
"related",
"cookies"
] | be74e41c674ac2c2ef924752ed310cfbaafe33b8 | https://github.com/zewadesign/framework/blob/be74e41c674ac2c2ef924752ed310cfbaafe33b8/Zewa/HTTP/Session.php#L102-L120 | train |
itcreator/custom-cmf | Module/Component/src/Cmf/Component/Grid/Pager.php | Pager.loadItemsForCurrentPage | protected function loadItemsForCurrentPage()
{
$items = $this->adapter->getItems($this->getOffset(), $this->itemsCountPerPage, $this->sort);
if (!($items instanceof \Traversable)) {
$this->items = new \ArrayIterator($items);
} else {
$this->items = $items;
}
... | php | protected function loadItemsForCurrentPage()
{
$items = $this->adapter->getItems($this->getOffset(), $this->itemsCountPerPage, $this->sort);
if (!($items instanceof \Traversable)) {
$this->items = new \ArrayIterator($items);
} else {
$this->items = $items;
}
... | [
"protected",
"function",
"loadItemsForCurrentPage",
"(",
")",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"adapter",
"->",
"getItems",
"(",
"$",
"this",
"->",
"getOffset",
"(",
")",
",",
"$",
"this",
"->",
"itemsCountPerPage",
",",
"$",
"this",
"->",
"sor... | Method load items for current page
@return void | [
"Method",
"load",
"items",
"for",
"current",
"page"
] | 42fc0535dfa0f641856f06673f6ab596b2020c40 | https://github.com/itcreator/custom-cmf/blob/42fc0535dfa0f641856f06673f6ab596b2020c40/Module/Component/src/Cmf/Component/Grid/Pager.php#L102-L110 | train |
brightnucleus/options-store | src/OptionRepository/AbstractOptionRepository.php | AbstractOptionRepository.initialize | protected function initialize(array $options)
{
foreach ($options as $option) {
if (! $option instanceof Option) {
throw InvalidOption::fromOption($option);
}
$option = $this->identityMap->put($option, $this);
$this->schema[$option->getKey()]... | php | protected function initialize(array $options)
{
foreach ($options as $option) {
if (! $option instanceof Option) {
throw InvalidOption::fromOption($option);
}
$option = $this->identityMap->put($option, $this);
$this->schema[$option->getKey()]... | [
"protected",
"function",
"initialize",
"(",
"array",
"$",
"options",
")",
"{",
"foreach",
"(",
"$",
"options",
"as",
"$",
"option",
")",
"{",
"if",
"(",
"!",
"$",
"option",
"instanceof",
"Option",
")",
"{",
"throw",
"InvalidOption",
"::",
"fromOption",
"... | Initialize the internal state of the repository.
@since 0.1.0
@param array $options | [
"Initialize",
"the",
"internal",
"state",
"of",
"the",
"repository",
"."
] | 9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1 | https://github.com/brightnucleus/options-store/blob/9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1/src/OptionRepository/AbstractOptionRepository.php#L82-L93 | train |
squareproton/Bond | src/Bond/Pg/ConnectionSettings.php | ConnectionSettings.getConnectionString | public function getConnectionString()
{
$settings = $this->connectionInfo;
unset( $settings['search_path'] );
foreach ($settings as $key => &$value) {
$value = sprintf(
"%s='%s'",
$key,
$value
);
}
ret... | php | public function getConnectionString()
{
$settings = $this->connectionInfo;
unset( $settings['search_path'] );
foreach ($settings as $key => &$value) {
$value = sprintf(
"%s='%s'",
$key,
$value
);
}
ret... | [
"public",
"function",
"getConnectionString",
"(",
")",
"{",
"$",
"settings",
"=",
"$",
"this",
"->",
"connectionInfo",
";",
"unset",
"(",
"$",
"settings",
"[",
"'search_path'",
"]",
")",
";",
"foreach",
"(",
"$",
"settings",
"as",
"$",
"key",
"=>",
"&",
... | Generate a property formatted postgres connection string
@param array $settings array( 'host' =>, 'port' =>, 'dbname' =>, 'user' => , 'password' => )
@return string a pg_connect compatable connectio string | [
"Generate",
"a",
"property",
"formatted",
"postgres",
"connection",
"string"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/ConnectionSettings.php#L41-L57 | train |
fulgurio/LightCMSBundle | Repository/MediaRepository.php | MediaRepository.findAllWithPagination | public function findAllWithPagination($filters, $limit, $offset, $resultInArray = FALSE)
{
$where = $this->getQueryFilter($filters);
$query = $this->getEntityManager()->createQuery('SELECT m FROM FulgurioLightCMSBundle:Media m ' . $where . ' ORDER BY m.created_at DESC')->setMaxResults($limit)->setFi... | php | public function findAllWithPagination($filters, $limit, $offset, $resultInArray = FALSE)
{
$where = $this->getQueryFilter($filters);
$query = $this->getEntityManager()->createQuery('SELECT m FROM FulgurioLightCMSBundle:Media m ' . $where . ' ORDER BY m.created_at DESC')->setMaxResults($limit)->setFi... | [
"public",
"function",
"findAllWithPagination",
"(",
"$",
"filters",
",",
"$",
"limit",
",",
"$",
"offset",
",",
"$",
"resultInArray",
"=",
"FALSE",
")",
"{",
"$",
"where",
"=",
"$",
"this",
"->",
"getQueryFilter",
"(",
"$",
"filters",
")",
";",
"$",
"q... | Find media with pagination
@param array $filters
@param number $limit
@param number $offset
@param boolean $resultInArray
@return array | [
"Find",
"media",
"with",
"pagination"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Repository/MediaRepository.php#L33-L49 | train |
fulgurio/LightCMSBundle | Repository/MediaRepository.php | MediaRepository.count | public function count($filters)
{
$where = $this->getQueryFilter($filters);
$query = $this->getEntityManager()->createQuery('SELECT COUNT(m) FROM FulgurioLightCMSBundle:Media m' . $where);
if (!empty($filters))
{
foreach ($filters as $filterKey => $filterValue)
... | php | public function count($filters)
{
$where = $this->getQueryFilter($filters);
$query = $this->getEntityManager()->createQuery('SELECT COUNT(m) FROM FulgurioLightCMSBundle:Media m' . $where);
if (!empty($filters))
{
foreach ($filters as $filterKey => $filterValue)
... | [
"public",
"function",
"count",
"(",
"$",
"filters",
")",
"{",
"$",
"where",
"=",
"$",
"this",
"->",
"getQueryFilter",
"(",
"$",
"filters",
")",
";",
"$",
"query",
"=",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
"->",
"createQuery",
"(",
"'SELECT ... | Count number of result
@param array $filters
@return Ambigous <\Doctrine\ORM\mixed, mixed, \Doctrine\ORM\Internal\Hydration\mixed, \Doctrine\DBAL\Driver\Statement> | [
"Count",
"number",
"of",
"result"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Repository/MediaRepository.php#L57-L69 | train |
fulgurio/LightCMSBundle | Repository/MediaRepository.php | MediaRepository.getQueryFilter | private function getQueryFilter($filters)
{
$where = '';
if (!empty($filters))
{
foreach ($filters as $filterKey => $filterValue)
{
$where .= ' AND m.' . $filterKey . ' LIKE :' . $filterKey;
}
$where = ' WHERE ' . substr($where,... | php | private function getQueryFilter($filters)
{
$where = '';
if (!empty($filters))
{
foreach ($filters as $filterKey => $filterValue)
{
$where .= ' AND m.' . $filterKey . ' LIKE :' . $filterKey;
}
$where = ' WHERE ' . substr($where,... | [
"private",
"function",
"getQueryFilter",
"(",
"$",
"filters",
")",
"{",
"$",
"where",
"=",
"''",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"filters",
")",
")",
"{",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"filterKey",
"=>",
"$",
"filterValue",
")",
... | Make query filter string, from given filters
@param array $filters
@return string | [
"Make",
"query",
"filter",
"string",
"from",
"given",
"filters"
] | 66319af52b97b6552b7c391ee370538263f42d10 | https://github.com/fulgurio/LightCMSBundle/blob/66319af52b97b6552b7c391ee370538263f42d10/Repository/MediaRepository.php#L77-L89 | train |
mtils/file-db | src/FileDB/Model/EmsFileDBModel.php | EmsFileDBModel.removeDeletedFsChildrenFromDb | protected function removeDeletedFsChildrenFromDb($dbChildren)
{
$existingChildren = [];
// First delete all children that do not exist in fs
foreach ($dbChildren as $child) {
if (!$this->filesystem->exists($child->getPath())) {
$this->nodeRepository->delete($chi... | php | protected function removeDeletedFsChildrenFromDb($dbChildren)
{
$existingChildren = [];
// First delete all children that do not exist in fs
foreach ($dbChildren as $child) {
if (!$this->filesystem->exists($child->getPath())) {
$this->nodeRepository->delete($chi... | [
"protected",
"function",
"removeDeletedFsChildrenFromDb",
"(",
"$",
"dbChildren",
")",
"{",
"$",
"existingChildren",
"=",
"[",
"]",
";",
"// First delete all children that do not exist in fs",
"foreach",
"(",
"$",
"dbChildren",
"as",
"$",
"child",
")",
"{",
"if",
"(... | Delete the non existing
@param CanHaveParent[] $dbChildren
@return array | [
"Delete",
"the",
"non",
"existing"
] | 270ebc26b0fa3d2c996ca8861507fa63d2db6814 | https://github.com/mtils/file-db/blob/270ebc26b0fa3d2c996ca8861507fa63d2db6814/src/FileDB/Model/EmsFileDBModel.php#L414-L429 | train |
mtils/file-db | src/FileDB/Model/EmsFileDBModel.php | EmsFileDBModel.absoluteToFilesystemPath | protected function absoluteToFilesystemPath($filePath)
{
if (!$this->isWithinFilesystem($filePath)) {
return $filePath;
}
$fsPath = (string)$this->filesystem->url()->path;
return str_replace($fsPath,'', $filePath);
} | php | protected function absoluteToFilesystemPath($filePath)
{
if (!$this->isWithinFilesystem($filePath)) {
return $filePath;
}
$fsPath = (string)$this->filesystem->url()->path;
return str_replace($fsPath,'', $filePath);
} | [
"protected",
"function",
"absoluteToFilesystemPath",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isWithinFilesystem",
"(",
"$",
"filePath",
")",
")",
"{",
"return",
"$",
"filePath",
";",
"}",
"$",
"fsPath",
"=",
"(",
"string",
")"... | Cat the absolute part of a file path off to make a relative filesystem
path
@param string $filePath
@return string | [
"Cat",
"the",
"absolute",
"part",
"of",
"a",
"file",
"path",
"off",
"to",
"make",
"a",
"relative",
"filesystem",
"path"
] | 270ebc26b0fa3d2c996ca8861507fa63d2db6814 | https://github.com/mtils/file-db/blob/270ebc26b0fa3d2c996ca8861507fa63d2db6814/src/FileDB/Model/EmsFileDBModel.php#L538-L549 | train |
mtils/file-db | src/FileDB/Model/EmsFileDBModel.php | EmsFileDBModel.isExcludedFromDb | protected function isExcludedFromDb($basename)
{
if (in_array(mb_strtolower($basename), $this->excludeFromDb)) {
return true;
}
return Helper::startsWith($basename, '.') || Helper::startsWith($basename, '_');
} | php | protected function isExcludedFromDb($basename)
{
if (in_array(mb_strtolower($basename), $this->excludeFromDb)) {
return true;
}
return Helper::startsWith($basename, '.') || Helper::startsWith($basename, '_');
} | [
"protected",
"function",
"isExcludedFromDb",
"(",
"$",
"basename",
")",
"{",
"if",
"(",
"in_array",
"(",
"mb_strtolower",
"(",
"$",
"basename",
")",
",",
"$",
"this",
"->",
"excludeFromDb",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"Helper",
"... | Return true if the passed file should not be mirrored in the db.
@param string $basename
@return bool | [
"Return",
"true",
"if",
"the",
"passed",
"file",
"should",
"not",
"be",
"mirrored",
"in",
"the",
"db",
"."
] | 270ebc26b0fa3d2c996ca8861507fa63d2db6814 | https://github.com/mtils/file-db/blob/270ebc26b0fa3d2c996ca8861507fa63d2db6814/src/FileDB/Model/EmsFileDBModel.php#L801-L809 | train |
mtils/cmsable | src/Cmsable/Routing/ControllerCreator.php | ControllerCreator.createController | public function createController($name, SiteTreeNodeInterface $page=null)
{
$this->page = $page;
$controller = $this->makeController($name);
$this->modifyController($controller, $page);
return $controller;
} | php | public function createController($name, SiteTreeNodeInterface $page=null)
{
$this->page = $page;
$controller = $this->makeController($name);
$this->modifyController($controller, $page);
return $controller;
} | [
"public",
"function",
"createController",
"(",
"$",
"name",
",",
"SiteTreeNodeInterface",
"$",
"page",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"page",
"=",
"$",
"page",
";",
"$",
"controller",
"=",
"$",
"this",
"->",
"makeController",
"(",
"$",
"name",... | Creates a controller while routing to a page. This method is used
to configure dependencies of you controller according to a page.
You can also configure your controller directly like setting a
a layout
@param string $controllerName The classname of the routed controller
@param \Cmsable\Model\SiteTreeNodeInterface $pa... | [
"Creates",
"a",
"controller",
"while",
"routing",
"to",
"a",
"page",
".",
"This",
"method",
"is",
"used",
"to",
"configure",
"dependencies",
"of",
"you",
"controller",
"according",
"to",
"a",
"page",
".",
"You",
"can",
"also",
"configure",
"your",
"controlle... | 03ae84ee3c7d46146f2a1cf687e5c29d6de4286d | https://github.com/mtils/cmsable/blob/03ae84ee3c7d46146f2a1cf687e5c29d6de4286d/src/Cmsable/Routing/ControllerCreator.php#L42-L53 | train |
battis/simplecache | src/HierarchicalSimpleCache.php | HierarchicalSimpleCache.pushKey | public function pushKey($layer)
{
$this->base .= $this->delimiter . str_replace($this->delimiter, $this->placeholder, $layer);
return $this->getBase();
} | php | public function pushKey($layer)
{
$this->base .= $this->delimiter . str_replace($this->delimiter, $this->placeholder, $layer);
return $this->getBase();
} | [
"public",
"function",
"pushKey",
"(",
"$",
"layer",
")",
"{",
"$",
"this",
"->",
"base",
".=",
"$",
"this",
"->",
"delimiter",
".",
"str_replace",
"(",
"$",
"this",
"->",
"delimiter",
",",
"$",
"this",
"->",
"placeholder",
",",
"$",
"layer",
")",
";"... | Add a layer of depth to the key hierarchy
@param string $layer
@return string The new base key | [
"Add",
"a",
"layer",
"of",
"depth",
"to",
"the",
"key",
"hierarchy"
] | edda1bee5994fcc2a7b4a10e868d161d8dcddf3b | https://github.com/battis/simplecache/blob/edda1bee5994fcc2a7b4a10e868d161d8dcddf3b/src/HierarchicalSimpleCache.php#L64-L68 | train |
battis/simplecache | src/HierarchicalSimpleCache.php | HierarchicalSimpleCache.popKey | public function popKey()
{
if (strlen($this->base)) {
$layers = explode($this->delimiter, $this->base);
$last = count($layers) - 1;
$layer = $layers[$last];
if ($last > 0) {
unset ($layers[$last]);
$this->base = implode($this->d... | php | public function popKey()
{
if (strlen($this->base)) {
$layers = explode($this->delimiter, $this->base);
$last = count($layers) - 1;
$layer = $layers[$last];
if ($last > 0) {
unset ($layers[$last]);
$this->base = implode($this->d... | [
"public",
"function",
"popKey",
"(",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"this",
"->",
"base",
")",
")",
"{",
"$",
"layers",
"=",
"explode",
"(",
"$",
"this",
"->",
"delimiter",
",",
"$",
"this",
"->",
"base",
")",
";",
"$",
"last",
"=",
"... | Remove a layer of depth from the key hierarchy
@return string|null The layer that was removed from the hierarchy (`NULL`
if no layers exist) | [
"Remove",
"a",
"layer",
"of",
"depth",
"from",
"the",
"key",
"hierarchy"
] | edda1bee5994fcc2a7b4a10e868d161d8dcddf3b | https://github.com/battis/simplecache/blob/edda1bee5994fcc2a7b4a10e868d161d8dcddf3b/src/HierarchicalSimpleCache.php#L76-L92 | train |
togucms/MediaBundle | Controller/GalleryController.php | GalleryController.postGalleryAction | public function postGalleryAction() {
$serializer = $this->get("tpg_extjs.phpcr_serializer");
$entity = $serializer->deserialize(
$this->getRequest()->getContent(),
'Togu\MediaBundle\Document\Gallery',
'json',
DeserializationContext::create()->setGroups(ar... | php | public function postGalleryAction() {
$serializer = $this->get("tpg_extjs.phpcr_serializer");
$entity = $serializer->deserialize(
$this->getRequest()->getContent(),
'Togu\MediaBundle\Document\Gallery',
'json',
DeserializationContext::create()->setGroups(ar... | [
"public",
"function",
"postGalleryAction",
"(",
")",
"{",
"$",
"serializer",
"=",
"$",
"this",
"->",
"get",
"(",
"\"tpg_extjs.phpcr_serializer\"",
")",
";",
"$",
"entity",
"=",
"$",
"serializer",
"->",
"deserialize",
"(",
"$",
"this",
"->",
"getRequest",
"("... | Create a new Gallery record
@return \Symfony\Component\HttpFoundation\Response | [
"Create",
"a",
"new",
"Gallery",
"record"
] | 42065d5fa419654540a52ae8f0047708eac9930b | https://github.com/togucms/MediaBundle/blob/42065d5fa419654540a52ae8f0047708eac9930b/Controller/GalleryController.php#L225-L256 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/DecorationsObject.php | DecorationsObject.getBackgroundColorEscapeSequence | public function getBackgroundColorEscapeSequence ( $colorName = '' ) {
if ( $this->_isDefinedColor($colorName) === true ) {
$colors = self::getDefinedColors();
list($textColor, $backgroundColor) = $colors[$colorName];
return $backgroundColor;
}
return '';
... | php | public function getBackgroundColorEscapeSequence ( $colorName = '' ) {
if ( $this->_isDefinedColor($colorName) === true ) {
$colors = self::getDefinedColors();
list($textColor, $backgroundColor) = $colors[$colorName];
return $backgroundColor;
}
return '';
... | [
"public",
"function",
"getBackgroundColorEscapeSequence",
"(",
"$",
"colorName",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_isDefinedColor",
"(",
"$",
"colorName",
")",
"===",
"true",
")",
"{",
"$",
"colors",
"=",
"self",
"::",
"getDefinedColors",
... | Get Background color escape sequence
@param string $color Color name
@return string background color escape sequence | [
"Get",
"Background",
"color",
"escape",
"sequence"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/DecorationsObject.php#L117-L124 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/DecorationsObject.php | DecorationsObject.setIsBold | public function setIsBold ( $isBold ) {
if ( $isBold === true ) {
$this->_isBold = true;
} else {
$this->_isBold = false;
}
} | php | public function setIsBold ( $isBold ) {
if ( $isBold === true ) {
$this->_isBold = true;
} else {
$this->_isBold = false;
}
} | [
"public",
"function",
"setIsBold",
"(",
"$",
"isBold",
")",
"{",
"if",
"(",
"$",
"isBold",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"_isBold",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"_isBold",
"=",
"false",
";",
"}",
"}"
] | Set which is bold
@param bool $isBold | [
"Set",
"which",
"is",
"bold"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/DecorationsObject.php#L161-L167 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/DecorationsObject.php | DecorationsObject.setIsUnderlined | public function setIsUnderlined ( $isUnderlined ) {
if ( $isUnderlined === true ) {
$this->_isUnderlined = true;
} else {
$this->_isUnderlined = false;
}
} | php | public function setIsUnderlined ( $isUnderlined ) {
if ( $isUnderlined === true ) {
$this->_isUnderlined = true;
} else {
$this->_isUnderlined = false;
}
} | [
"public",
"function",
"setIsUnderlined",
"(",
"$",
"isUnderlined",
")",
"{",
"if",
"(",
"$",
"isUnderlined",
"===",
"true",
")",
"{",
"$",
"this",
"->",
"_isUnderlined",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"_isUnderlined",
"=",
"false"... | Set which is underlined
@param bool $isUnderlined | [
"Set",
"which",
"is",
"underlined"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/DecorationsObject.php#L193-L199 | train |
stellaqua/Waltz.Stagehand | src/Waltz/Stagehand/CuiUtility/DecorationsObject.php | DecorationsObject._isDefinedColor | private function _isDefinedColor ( $colorName ) {
$colors = self::getDefinedColors();
$colorNames = array_keys($colors);
return in_array($colorName, $colorNames);
} | php | private function _isDefinedColor ( $colorName ) {
$colors = self::getDefinedColors();
$colorNames = array_keys($colors);
return in_array($colorName, $colorNames);
} | [
"private",
"function",
"_isDefinedColor",
"(",
"$",
"colorName",
")",
"{",
"$",
"colors",
"=",
"self",
"::",
"getDefinedColors",
"(",
")",
";",
"$",
"colorNames",
"=",
"array_keys",
"(",
"$",
"colors",
")",
";",
"return",
"in_array",
"(",
"$",
"colorName",... | Which is defined color
@param string $colorName Color name
@return bool Which is defined color | [
"Which",
"is",
"defined",
"color"
] | 01df286751f5b9a5c90c47138dca3709e5bc383b | https://github.com/stellaqua/Waltz.Stagehand/blob/01df286751f5b9a5c90c47138dca3709e5bc383b/src/Waltz/Stagehand/CuiUtility/DecorationsObject.php#L217-L221 | train |
shgysk8zer0/core_api | traits/events.php | Events.triggerEvent | final protected static function triggerEvent($event, array $context = array())
{
if (array_key_exists($event, static::$registered_events)) {
array_map(function($handler) use ($context)
{
call_user_func($handler, $context);
}, static::$registered_events[$event]);
}
} | php | final protected static function triggerEvent($event, array $context = array())
{
if (array_key_exists($event, static::$registered_events)) {
array_map(function($handler) use ($context)
{
call_user_func($handler, $context);
}, static::$registered_events[$event]);
}
} | [
"final",
"protected",
"static",
"function",
"triggerEvent",
"(",
"$",
"event",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"event",
",",
"static",
"::",
"$",
"registered_events",
")",
")",
"{",... | Trigger an event an call its callback if any exist. Otherwise, nothing
@param string $event Name of event. E.G. "Error"
@param array $context An array of paramaters to pass to the callback
@return void | [
"Trigger",
"an",
"event",
"an",
"call",
"its",
"callback",
"if",
"any",
"exist",
".",
"Otherwise",
"nothing"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/events.php#L60-L68 | train |
lanfisis/deflection | src/Deflection/Element/Param.php | Param.getElement | public function getElement()
{
if ($this->getDocblock()) {
$this->setLines($this->getDocblock()->getElement());
}
$name = '';
if ($this->getName() and !is_array($this->getValue())) {
$name = ($this->getType() ? $this->getType().' ' : '')
.'$'.... | php | public function getElement()
{
if ($this->getDocblock()) {
$this->setLines($this->getDocblock()->getElement());
}
$name = '';
if ($this->getName() and !is_array($this->getValue())) {
$name = ($this->getType() ? $this->getType().' ' : '')
.'$'.... | [
"public",
"function",
"getElement",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getDocblock",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setLines",
"(",
"$",
"this",
"->",
"getDocblock",
"(",
")",
"->",
"getElement",
"(",
")",
")",
";",
"}",
"$",
... | Return param content
@return array | [
"Return",
"param",
"content"
] | 31deaf7f085d6456d8a323e7ac3cc9914fbe49a9 | https://github.com/lanfisis/deflection/blob/31deaf7f085d6456d8a323e7ac3cc9914fbe49a9/src/Deflection/Element/Param.php#L163-L186 | train |
buflix/SimpleCollection | src/SimpleCollection/Entity/AbstractEntityCollection.php | AbstractEntityCollection.offsetSet | public function offsetSet($mOffset, $oEntity)
{
$this->checkClass($oEntity);
return parent::offsetSet($mOffset, $oEntity);
} | php | public function offsetSet($mOffset, $oEntity)
{
$this->checkClass($oEntity);
return parent::offsetSet($mOffset, $oEntity);
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"mOffset",
",",
"$",
"oEntity",
")",
"{",
"$",
"this",
"->",
"checkClass",
"(",
"$",
"oEntity",
")",
";",
"return",
"parent",
"::",
"offsetSet",
"(",
"$",
"mOffset",
",",
"$",
"oEntity",
")",
";",
"}"
] | set the entity by the given offset
@param string|int $mOffset Offset
@param EntityInterface $oEntity ProxyServer
@return $this
@throws \InvalidArgumentException | [
"set",
"the",
"entity",
"by",
"the",
"given",
"offset"
] | 405504d8be6415a872a5a49ce8223c22a932831a | https://github.com/buflix/SimpleCollection/blob/405504d8be6415a872a5a49ce8223c22a932831a/src/SimpleCollection/Entity/AbstractEntityCollection.php#L38-L43 | train |
buflix/SimpleCollection | src/SimpleCollection/Entity/AbstractEntityCollection.php | AbstractEntityCollection.toArray | public function toArray()
{
$aReturn = array();
foreach ($this->values as $sKey => $oEntity) {
/* @var EntityInterface $oEntity */
$aReturn[$sKey] = $oEntity->toArray();
}
return $aReturn;
} | php | public function toArray()
{
$aReturn = array();
foreach ($this->values as $sKey => $oEntity) {
/* @var EntityInterface $oEntity */
$aReturn[$sKey] = $oEntity->toArray();
}
return $aReturn;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"aReturn",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"values",
"as",
"$",
"sKey",
"=>",
"$",
"oEntity",
")",
"{",
"/* @var EntityInterface $oEntity */",
"$",
"aReturn",
"[",
"$",
... | return this collection as array
@return array | [
"return",
"this",
"collection",
"as",
"array"
] | 405504d8be6415a872a5a49ce8223c22a932831a | https://github.com/buflix/SimpleCollection/blob/405504d8be6415a872a5a49ce8223c22a932831a/src/SimpleCollection/Entity/AbstractEntityCollection.php#L65-L75 | train |
drdplusinfo/drdplus-profession-levels | DrdPlus/Person/ProfessionLevels/ProfessionFirstLevel.php | ProfessionFirstLevel.checkPropertyIncrement | protected function checkPropertyIncrement(BaseProperty $baseProperty, Profession $profession)
{
$propertyFirstLevelModifier = static::getBasePropertyFirstLevelModifier(
PropertyCode::getIt($baseProperty->getCode()),
$profession
);
if ($baseProperty->getValue() !== $pr... | php | protected function checkPropertyIncrement(BaseProperty $baseProperty, Profession $profession)
{
$propertyFirstLevelModifier = static::getBasePropertyFirstLevelModifier(
PropertyCode::getIt($baseProperty->getCode()),
$profession
);
if ($baseProperty->getValue() !== $pr... | [
"protected",
"function",
"checkPropertyIncrement",
"(",
"BaseProperty",
"$",
"baseProperty",
",",
"Profession",
"$",
"profession",
")",
"{",
"$",
"propertyFirstLevelModifier",
"=",
"static",
"::",
"getBasePropertyFirstLevelModifier",
"(",
"PropertyCode",
"::",
"getIt",
... | It is only the increment based on first level of specific profession.
There are other increments like race, size etc., solved in different library.
@param BaseProperty $baseProperty
@param Profession $profession
@throws \DrdPlus\Person\ProfessionLevels\Exceptions\InvalidFirstLevelPropertyValue | [
"It",
"is",
"only",
"the",
"increment",
"based",
"on",
"first",
"level",
"of",
"specific",
"profession",
".",
"There",
"are",
"other",
"increments",
"like",
"race",
"size",
"etc",
".",
"solved",
"in",
"different",
"library",
"."
] | c8c07b98dd47412f9770456a97e4728106d2c5fc | https://github.com/drdplusinfo/drdplus-profession-levels/blob/c8c07b98dd47412f9770456a97e4728106d2c5fc/DrdPlus/Person/ProfessionLevels/ProfessionFirstLevel.php#L67-L79 | train |
Waryway/PhpTraitsLibrary | src/Singleton.php | Singleton.instance | final public static function instance() {
$c = get_called_class();
if( ! isset( self::$instances[$c] ) )
{
self::$instances[$c] = new $c;
}
return self::$instances[$c];
} | php | final public static function instance() {
$c = get_called_class();
if( ! isset( self::$instances[$c] ) )
{
self::$instances[$c] = new $c;
}
return self::$instances[$c];
} | [
"final",
"public",
"static",
"function",
"instance",
"(",
")",
"{",
"$",
"c",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"instances",
"[",
"$",
"c",
"]",
")",
")",
"{",
"self",
"::",
"$",
"instances",
... | Grab an instance of the singleton.
@return self | [
"Grab",
"an",
"instance",
"of",
"the",
"singleton",
"."
] | 90c02e09b92e94664669b020b47a20a1590c4a4a | https://github.com/Waryway/PhpTraitsLibrary/blob/90c02e09b92e94664669b020b47a20a1590c4a4a/src/Singleton.php#L39-L48 | train |
bheisig/cli | src/IO.php | IO.out | public static function out($line, ...$args) {
if (count($args) > 0) {
$line = call_user_func_array(
'sprintf',
array_merge([$line], $args)
);
}
fwrite(STDOUT, $line . PHP_EOL);
} | php | public static function out($line, ...$args) {
if (count($args) > 0) {
$line = call_user_func_array(
'sprintf',
array_merge([$line], $args)
);
}
fwrite(STDOUT, $line . PHP_EOL);
} | [
"public",
"static",
"function",
"out",
"(",
"$",
"line",
",",
"...",
"$",
"args",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"args",
")",
">",
"0",
")",
"{",
"$",
"line",
"=",
"call_user_func_array",
"(",
"'sprintf'",
",",
"array_merge",
"(",
"[",
"$"... | Write line to STDOUT
@param string $line Line
@param mixed ...$args (Optional) One or more arguments | [
"Write",
"line",
"to",
"STDOUT"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/IO.php#L40-L49 | train |
bheisig/cli | src/IO.php | IO.err | public static function err($message, ...$args) {
if (count($args) > 0) {
$message = call_user_func_array(
'sprintf',
array_merge([$message], $args)
);
}
fwrite(STDERR, $message . PHP_EOL);
} | php | public static function err($message, ...$args) {
if (count($args) > 0) {
$message = call_user_func_array(
'sprintf',
array_merge([$message], $args)
);
}
fwrite(STDERR, $message . PHP_EOL);
} | [
"public",
"static",
"function",
"err",
"(",
"$",
"message",
",",
"...",
"$",
"args",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"args",
")",
">",
"0",
")",
"{",
"$",
"message",
"=",
"call_user_func_array",
"(",
"'sprintf'",
",",
"array_merge",
"(",
"[",... | Write message to STDERR
@param string $message Message
@param mixed ...$args (Optional) One or more arguments | [
"Write",
"message",
"to",
"STDERR"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/IO.php#L57-L66 | train |
bheisig/cli | src/IO.php | IO.in | public static function in($message, ...$args) {
if ($message !== '') {
if (count($args) > 0) {
$message = call_user_func_array(
'sprintf',
array_merge([$message], $args)
);
}
$message .= ' ';
}
... | php | public static function in($message, ...$args) {
if ($message !== '') {
if (count($args) > 0) {
$message = call_user_func_array(
'sprintf',
array_merge([$message], $args)
);
}
$message .= ' ';
}
... | [
"public",
"static",
"function",
"in",
"(",
"$",
"message",
",",
"...",
"$",
"args",
")",
"{",
"if",
"(",
"$",
"message",
"!==",
"''",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"args",
")",
">",
"0",
")",
"{",
"$",
"message",
"=",
"call_user_func_ar... | Read from STDIN
@param string $message Message
@param mixed ...$args (Optional) One or more arguments
@return string User input
@throws Exception on error | [
"Read",
"from",
"STDIN"
] | ee77266e173335950357899cdfe86b43c00a6776 | https://github.com/bheisig/cli/blob/ee77266e173335950357899cdfe86b43c00a6776/src/IO.php#L78-L99 | train |
SergioMadness/pwf-helpers | src/Validator.php | Validator.validate | public static function validate($type, $paramName, $data, array $params = [])
{
$data = (array) $data;
switch ($type) {
case self::VALIDATOR_USER:
return static::validateByCallback($paramName, $data, $params);
case self::VALIDATOR_EMAIL:
return... | php | public static function validate($type, $paramName, $data, array $params = [])
{
$data = (array) $data;
switch ($type) {
case self::VALIDATOR_USER:
return static::validateByCallback($paramName, $data, $params);
case self::VALIDATOR_EMAIL:
return... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"type",
",",
"$",
"paramName",
",",
"$",
"data",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"(",
"array",
")",
"$",
"data",
";",
"switch",
"(",
"$",
"type",
")",
... | Validate by type
@param string $type
@param string $paramName
@param array $data
@param array $params
@return mixed
@throws \Exception | [
"Validate",
"by",
"type"
] | d6cd44807c120356d60618cb08f237841c35e293 | https://github.com/SergioMadness/pwf-helpers/blob/d6cd44807c120356d60618cb08f237841c35e293/src/Validator.php#L37-L52 | train |
SergioMadness/pwf-helpers | src/Validator.php | Validator.validateEmail | public static function validateEmail($paramName, array $data)
{
$result = false;
if (isset($data[$paramName])) {
$result = filter_var($data[$paramName], FILTER_VALIDATE_EMAIL) !== false;
} else {
throw new \Exception('Parameter is not set');
}
return $... | php | public static function validateEmail($paramName, array $data)
{
$result = false;
if (isset($data[$paramName])) {
$result = filter_var($data[$paramName], FILTER_VALIDATE_EMAIL) !== false;
} else {
throw new \Exception('Parameter is not set');
}
return $... | [
"public",
"static",
"function",
"validateEmail",
"(",
"$",
"paramName",
",",
"array",
"$",
"data",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"$",
"paramName",
"]",
")",
")",
"{",
"$",
"result",
"=",
"fil... | Validate e-mail
@param string $paramName
@param array $data
@return bool
@throws \Exception | [
"Validate",
"e",
"-",
"mail"
] | d6cd44807c120356d60618cb08f237841c35e293 | https://github.com/SergioMadness/pwf-helpers/blob/d6cd44807c120356d60618cb08f237841c35e293/src/Validator.php#L119-L128 | train |
SergioMadness/pwf-helpers | src/Validator.php | Validator.validateByCallback | public static function validateByCallback($paramName, array $data,
array $params)
{
if (isset($params['callback'])) {
return $params['callback']($paramName, $data);
} else {
throw new \Exception('Callback parameter is required');
... | php | public static function validateByCallback($paramName, array $data,
array $params)
{
if (isset($params['callback'])) {
return $params['callback']($paramName, $data);
} else {
throw new \Exception('Callback parameter is required');
... | [
"public",
"static",
"function",
"validateByCallback",
"(",
"$",
"paramName",
",",
"array",
"$",
"data",
",",
"array",
"$",
"params",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"params",
"[",
"'callback'",
"]",
")",
")",
"{",
"return",
"$",
"params",
"[",
... | Validate by user function
@param string $paramName
@param mixed $data
@param array $params
@return mixed
@throws \Exception | [
"Validate",
"by",
"user",
"function"
] | d6cd44807c120356d60618cb08f237841c35e293 | https://github.com/SergioMadness/pwf-helpers/blob/d6cd44807c120356d60618cb08f237841c35e293/src/Validator.php#L139-L147 | train |
kambalabs/KmbZendDbInfrastructure | src/KmbZendDbInfrastructure/Service/RevisionService.php | RevisionService.release | public function release(RevisionInterface $revision, UserInterface $user, $comment)
{
$connection = $this->revisionRepository->getDbAdapter()->getDriver()->getConnection()->beginTransaction();
try {
if ($revision->getReleasedAt() != null) {
$this->revisionRepository->remo... | php | public function release(RevisionInterface $revision, UserInterface $user, $comment)
{
$connection = $this->revisionRepository->getDbAdapter()->getDriver()->getConnection()->beginTransaction();
try {
if ($revision->getReleasedAt() != null) {
$this->revisionRepository->remo... | [
"public",
"function",
"release",
"(",
"RevisionInterface",
"$",
"revision",
",",
"UserInterface",
"$",
"user",
",",
"$",
"comment",
")",
"{",
"$",
"connection",
"=",
"$",
"this",
"->",
"revisionRepository",
"->",
"getDbAdapter",
"(",
")",
"->",
"getDriver",
... | Release specified revision and create a current revision from it.
If the revision had already been released, the current revision should be removed first.
@param RevisionInterface $revision
@param UserInterface $user
@param string $comment
@throws \Zend\Db\Exception\ExceptionInterface
@return RevisionSe... | [
"Release",
"specified",
"revision",
"and",
"create",
"a",
"current",
"revision",
"from",
"it",
".",
"If",
"the",
"revision",
"had",
"already",
"been",
"released",
"the",
"current",
"revision",
"should",
"be",
"removed",
"first",
"."
] | 9bf4df4272d2064965202d0e689f944d56a4c6bb | https://github.com/kambalabs/KmbZendDbInfrastructure/blob/9bf4df4272d2064965202d0e689f944d56a4c6bb/src/KmbZendDbInfrastructure/Service/RevisionService.php#L47-L72 | train |
kambalabs/KmbZendDbInfrastructure | src/KmbZendDbInfrastructure/Service/RevisionService.php | RevisionService.remove | public function remove(RevisionInterface $revision)
{
$connection = $this->revisionRepository->getDbAdapter()->getDriver()->getConnection()->beginTransaction();
try {
$this->revisionRepository->remove($revision);
if ($revision->getReleasedAt() == null) {
$last... | php | public function remove(RevisionInterface $revision)
{
$connection = $this->revisionRepository->getDbAdapter()->getDriver()->getConnection()->beginTransaction();
try {
$this->revisionRepository->remove($revision);
if ($revision->getReleasedAt() == null) {
$last... | [
"public",
"function",
"remove",
"(",
"RevisionInterface",
"$",
"revision",
")",
"{",
"$",
"connection",
"=",
"$",
"this",
"->",
"revisionRepository",
"->",
"getDbAdapter",
"(",
")",
"->",
"getDriver",
"(",
")",
"->",
"getConnection",
"(",
")",
"->",
"beginTr... | Remove specified revision.
If it's the current revision, another current revision should be recreate from last released revision.
@param RevisionInterface $revision
@throws \Zend\Db\Exception\ExceptionInterface
@return RevisionService | [
"Remove",
"specified",
"revision",
".",
"If",
"it",
"s",
"the",
"current",
"revision",
"another",
"current",
"revision",
"should",
"be",
"recreate",
"from",
"last",
"released",
"revision",
"."
] | 9bf4df4272d2064965202d0e689f944d56a4c6bb | https://github.com/kambalabs/KmbZendDbInfrastructure/blob/9bf4df4272d2064965202d0e689f944d56a4c6bb/src/KmbZendDbInfrastructure/Service/RevisionService.php#L82-L97 | train |
DreadLabs/typo3-cms-phing-helper | Classes/Tasks/GenerateLocalConfigurationTask.php | GenerateLocalConfigurationTask.transformPropertiesToArray | protected function transformPropertiesToArray()
{
$properties = $this->project->getProperties();
foreach ($properties as $propertyName => $propertyValue) {
if (0 !== strpos($propertyName, $this->propertyPrefix . '.')) {
continue;
}
list(, $mainKe... | php | protected function transformPropertiesToArray()
{
$properties = $this->project->getProperties();
foreach ($properties as $propertyName => $propertyValue) {
if (0 !== strpos($propertyName, $this->propertyPrefix . '.')) {
continue;
}
list(, $mainKe... | [
"protected",
"function",
"transformPropertiesToArray",
"(",
")",
"{",
"$",
"properties",
"=",
"$",
"this",
"->",
"project",
"->",
"getProperties",
"(",
")",
";",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"propertyName",
"=>",
"$",
"propertyValue",
")",
"... | transforms the flat property list into a local configuration array
Example
Given
LocalConfiguration.DB.database=my_database_name
Result
$this->localConfiguration = array(
'DB' => array(
'database' => 'my_database_name'
)
);
@return void | [
"transforms",
"the",
"flat",
"property",
"list",
"into",
"a",
"local",
"configuration",
"array"
] | b6606102c4702a92bc1872eba962febceaa0e645 | https://github.com/DreadLabs/typo3-cms-phing-helper/blob/b6606102c4702a92bc1872eba962febceaa0e645/Classes/Tasks/GenerateLocalConfigurationTask.php#L153-L166 | train |
ZFury/framework | library/Grid/AbstractGrid.php | AbstractGrid.processRequest | protected function processRequest()
{
/** @var \Zend\Http\PhpEnvironment\Request $request */
$request = $this->sm->get('Request');
$url = explode('?', $request->getRequestUri());
$this->url = $url[0];
$params = $request->getQuery();
if ($params->get('page')) {
... | php | protected function processRequest()
{
/** @var \Zend\Http\PhpEnvironment\Request $request */
$request = $this->sm->get('Request');
$url = explode('?', $request->getRequestUri());
$this->url = $url[0];
$params = $request->getQuery();
if ($params->get('page')) {
... | [
"protected",
"function",
"processRequest",
"(",
")",
"{",
"/** @var \\Zend\\Http\\PhpEnvironment\\Request $request */",
"$",
"request",
"=",
"$",
"this",
"->",
"sm",
"->",
"get",
"(",
"'Request'",
")",
";",
"$",
"url",
"=",
"explode",
"(",
"'?'",
",",
"$",
"re... | Parses request and sets grid params | [
"Parses",
"request",
"and",
"sets",
"grid",
"params"
] | eee4ca2a64d2d65490777b08be56c4c9b67bc892 | https://github.com/ZFury/framework/blob/eee4ca2a64d2d65490777b08be56c4c9b67bc892/library/Grid/AbstractGrid.php#L151-L186 | train |
ZFury/framework | library/Grid/AbstractGrid.php | AbstractGrid.countTotalRows | protected function countTotalRows()
{
$source = $this->getSource();
/** @var \Doctrine\ORM\Query\Expr\Select $select */
$source->resetDQLPart('select')->setFirstResult(0)->select('count(' . $this->entityAlias . ')');
return (int)$source->getQuery()->getSingleScalarResult();
} | php | protected function countTotalRows()
{
$source = $this->getSource();
/** @var \Doctrine\ORM\Query\Expr\Select $select */
$source->resetDQLPart('select')->setFirstResult(0)->select('count(' . $this->entityAlias . ')');
return (int)$source->getQuery()->getSingleScalarResult();
} | [
"protected",
"function",
"countTotalRows",
"(",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"getSource",
"(",
")",
";",
"/** @var \\Doctrine\\ORM\\Query\\Expr\\Select $select */",
"$",
"source",
"->",
"resetDQLPart",
"(",
"'select'",
")",
"->",
"setFirstResult"... | Get total rows in result ignoring limit
@return int | [
"Get",
"total",
"rows",
"in",
"result",
"ignoring",
"limit"
] | eee4ca2a64d2d65490777b08be56c4c9b67bc892 | https://github.com/ZFury/framework/blob/eee4ca2a64d2d65490777b08be56c4c9b67bc892/library/Grid/AbstractGrid.php#L491-L497 | train |
ZFury/framework | library/Grid/AbstractGrid.php | AbstractGrid.order | public function order($column)
{
if (!in_array($column, $this->allowedOrders)) {
return null;
}
if (isset($this->order[$column])) {
$order = strtolower($this->order[$column]) == self::ORDER_ASC ? self::ORDER_DESC : self::ORDER_ASC;
} else {
... | php | public function order($column)
{
if (!in_array($column, $this->allowedOrders)) {
return null;
}
if (isset($this->order[$column])) {
$order = strtolower($this->order[$column]) == self::ORDER_ASC ? self::ORDER_DESC : self::ORDER_ASC;
} else {
... | [
"public",
"function",
"order",
"(",
"$",
"column",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"column",
",",
"$",
"this",
"->",
"allowedOrders",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"order",
... | Get url for order by column name
@param $column
@return string | [
"Get",
"url",
"for",
"order",
"by",
"column",
"name"
] | eee4ca2a64d2d65490777b08be56c4c9b67bc892 | https://github.com/ZFury/framework/blob/eee4ca2a64d2d65490777b08be56c4c9b67bc892/library/Grid/AbstractGrid.php#L643-L656 | train |
ptlis/grep-db | src/Metadata/MySQL/MetadataFactory.php | MetadataFactory.getServerMetadata | public function getServerMetadata(
Connection $connection
) {
// Attempt to list databases, ignoring internal databases
try {
$statement = $connection->query('SHOW DATABASES WHERE `Database` NOT IN ("information_schema", "performance_schema", "sys", "mysql");');
} catch (... | php | public function getServerMetadata(
Connection $connection
) {
// Attempt to list databases, ignoring internal databases
try {
$statement = $connection->query('SHOW DATABASES WHERE `Database` NOT IN ("information_schema", "performance_schema", "sys", "mysql");');
} catch (... | [
"public",
"function",
"getServerMetadata",
"(",
"Connection",
"$",
"connection",
")",
"{",
"// Attempt to list databases, ignoring internal databases",
"try",
"{",
"$",
"statement",
"=",
"$",
"connection",
"->",
"query",
"(",
"'SHOW DATABASES WHERE `Database` NOT IN (\"inform... | Query the server and build server metadata DTO. | [
"Query",
"the",
"server",
"and",
"build",
"server",
"metadata",
"DTO",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Metadata/MySQL/MetadataFactory.php#L21-L38 | train |
ptlis/grep-db | src/Metadata/MySQL/MetadataFactory.php | MetadataFactory.getDatabaseMetadata | public function getDatabaseMetadata(
Connection $connection,
string $databaseName
): DatabaseMetadata {
// Get a list of table names
$tableNameStatement = $connection
->createQueryBuilder()
->select([
'tables.TABLE_NAME AS name'
])
... | php | public function getDatabaseMetadata(
Connection $connection,
string $databaseName
): DatabaseMetadata {
// Get a list of table names
$tableNameStatement = $connection
->createQueryBuilder()
->select([
'tables.TABLE_NAME AS name'
])
... | [
"public",
"function",
"getDatabaseMetadata",
"(",
"Connection",
"$",
"connection",
",",
"string",
"$",
"databaseName",
")",
":",
"DatabaseMetadata",
"{",
"// Get a list of table names",
"$",
"tableNameStatement",
"=",
"$",
"connection",
"->",
"createQueryBuilder",
"(",
... | Query the server and build database metadata DTO. | [
"Query",
"the",
"server",
"and",
"build",
"database",
"metadata",
"DTO",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Metadata/MySQL/MetadataFactory.php#L43-L66 | train |
ptlis/grep-db | src/Metadata/MySQL/MetadataFactory.php | MetadataFactory.getTableMetadata | public function getTableMetadata(
Connection $connection,
string $databaseName,
string $tableName
): TableMetadata {
// Get top-level table information
$tableStatement = $connection
->createQueryBuilder()
->select([
'tables.TABLE_NAME A... | php | public function getTableMetadata(
Connection $connection,
string $databaseName,
string $tableName
): TableMetadata {
// Get top-level table information
$tableStatement = $connection
->createQueryBuilder()
->select([
'tables.TABLE_NAME A... | [
"public",
"function",
"getTableMetadata",
"(",
"Connection",
"$",
"connection",
",",
"string",
"$",
"databaseName",
",",
"string",
"$",
"tableName",
")",
":",
"TableMetadata",
"{",
"// Get top-level table information",
"$",
"tableStatement",
"=",
"$",
"connection",
... | Query the server and build table metadata DTO. | [
"Query",
"the",
"server",
"and",
"build",
"table",
"metadata",
"DTO",
"."
] | 7abff68982d426690d0515ccd7adc7a2e3d72a3f | https://github.com/ptlis/grep-db/blob/7abff68982d426690d0515ccd7adc7a2e3d72a3f/src/Metadata/MySQL/MetadataFactory.php#L71-L149 | train |
rzajac/phptools | src/Helper/Debug.php | Debug.getCallStack | public static function getCallStack($asArray = false)
{
$i = 0;
$resp = [];
if (!$asArray) {
$resp[] = str_repeat('=', 50);
}
foreach (debug_backtrace() as $node) {
$file = Arr::get($node, 'file', '');
$file = $file ?: 'no_file';
... | php | public static function getCallStack($asArray = false)
{
$i = 0;
$resp = [];
if (!$asArray) {
$resp[] = str_repeat('=', 50);
}
foreach (debug_backtrace() as $node) {
$file = Arr::get($node, 'file', '');
$file = $file ?: 'no_file';
... | [
"public",
"static",
"function",
"getCallStack",
"(",
"$",
"asArray",
"=",
"false",
")",
"{",
"$",
"i",
"=",
"0",
";",
"$",
"resp",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"$",
"asArray",
")",
"{",
"$",
"resp",
"[",
"]",
"=",
"str_repeat",
"(",
"'='... | Prints stack trace.
@param bool $asArray
@return string | [
"Prints",
"stack",
"trace",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Helper/Debug.php#L34-L57 | train |
vaniocz/stdlib | src/LinkedHashSet.php | LinkedHashSet.add | public function add($value): bool
{
if (isset($this->hashMap[$value])) {
return false;
}
$this->hashMap[$value] = 1;
return true;
} | php | public function add($value): bool
{
if (isset($this->hashMap[$value])) {
return false;
}
$this->hashMap[$value] = 1;
return true;
} | [
"public",
"function",
"add",
"(",
"$",
"value",
")",
":",
"bool",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"hashMap",
"[",
"$",
"value",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"hashMap",
"[",
"$",
"value",
"... | Add the given value to the set if it is not already present.
@param mixed $value The value to be added.
@return bool True if the value was not present in the set, false otherwise. | [
"Add",
"the",
"given",
"value",
"to",
"the",
"set",
"if",
"it",
"is",
"not",
"already",
"present",
"."
] | 06a8343c42829d8fdeecad2bb5c30946fbd73e74 | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/LinkedHashSet.php#L29-L38 | train |
vaniocz/stdlib | src/LinkedHashSet.php | LinkedHashSet.remove | public function remove($value): bool
{
if (!isset($this->hashMap[$value])) {
return false;
}
unset($this->hashMap[$value]);
return true;
} | php | public function remove($value): bool
{
if (!isset($this->hashMap[$value])) {
return false;
}
unset($this->hashMap[$value]);
return true;
} | [
"public",
"function",
"remove",
"(",
"$",
"value",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"hashMap",
"[",
"$",
"value",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"unset",
"(",
"$",
"this",
"->",
"hashMap",
... | Remove the given value if it's present in the set.
@param mixed $value The value to be removed.
@return bool True if the value was present in the set, false otherwise. | [
"Remove",
"the",
"given",
"value",
"if",
"it",
"s",
"present",
"in",
"the",
"set",
"."
] | 06a8343c42829d8fdeecad2bb5c30946fbd73e74 | https://github.com/vaniocz/stdlib/blob/06a8343c42829d8fdeecad2bb5c30946fbd73e74/src/LinkedHashSet.php#L59-L68 | train |
agentmedia/phine-core | src/Core/Modules/Backend/AjaxSelectPage.php | AjaxSelectPage.HasPages | protected function HasPages(Site $site)
{
$this->site = $site;
$this->tree = new PageTreeProvider($site);
$this->page = $this->tree->TopMost();
return (bool) $this->page;
} | php | protected function HasPages(Site $site)
{
$this->site = $site;
$this->tree = new PageTreeProvider($site);
$this->page = $this->tree->TopMost();
return (bool) $this->page;
} | [
"protected",
"function",
"HasPages",
"(",
"Site",
"$",
"site",
")",
"{",
"$",
"this",
"->",
"site",
"=",
"$",
"site",
";",
"$",
"this",
"->",
"tree",
"=",
"new",
"PageTreeProvider",
"(",
"$",
"site",
")",
";",
"$",
"this",
"->",
"page",
"=",
"$",
... | Sets the site as current site and returns true if it has pages below
@param Site $site The site to set and check for pages
@return boolean Returns true if the site has pages | [
"Sets",
"the",
"site",
"as",
"current",
"site",
"and",
"returns",
"true",
"if",
"it",
"has",
"pages",
"below"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/AjaxSelectPage.php#L100-L106 | train |
Kris-Kuiper/sFire-Framework | src/DB/Driver/MySQLi/TableGateway.php | TableGateway.getTable | public function getTable() {
if(false === isset($this -> table)) {
$cl = new \ReflectionClass($this);
return trigger_error(sprintf('No table specified in "%s" class', $cl -> getFileName()), E_USER_ERROR);
}
return $this -> table;
} | php | public function getTable() {
if(false === isset($this -> table)) {
$cl = new \ReflectionClass($this);
return trigger_error(sprintf('No table specified in "%s" class', $cl -> getFileName()), E_USER_ERROR);
}
return $this -> table;
} | [
"public",
"function",
"getTable",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"isset",
"(",
"$",
"this",
"->",
"table",
")",
")",
"{",
"$",
"cl",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
";",
"return",
"trigger_error",
"(",
"sprintf"... | Returns the table
@return string | [
"Returns",
"the",
"table"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/DB/Driver/MySQLi/TableGateway.php#L63-L72 | train |
Kris-Kuiper/sFire-Framework | src/DB/Driver/MySQLi/TableGateway.php | TableGateway.rows | public function rows($column = '*', $where = null, $params = []) {
if(null === $this -> getAdapter()) {
return trigger_error(sprintf('No database adapter was set in "%s"', __METHOD__), E_USER_ERROR);
}
if(false === is_string($column)) {
return trigger_error(sprintf('Argument 1 passed to %s() must b... | php | public function rows($column = '*', $where = null, $params = []) {
if(null === $this -> getAdapter()) {
return trigger_error(sprintf('No database adapter was set in "%s"', __METHOD__), E_USER_ERROR);
}
if(false === is_string($column)) {
return trigger_error(sprintf('Argument 1 passed to %s() must b... | [
"public",
"function",
"rows",
"(",
"$",
"column",
"=",
"'*'",
",",
"$",
"where",
"=",
"null",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"getAdapter",
"(",
")",
")",
"{",
"return",
"trigger_error",
"... | Retrieve the number of rows
@param string $column
@param string $where
@param array $params
@return int|boolean | [
"Retrieve",
"the",
"number",
"of",
"rows"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/DB/Driver/MySQLi/TableGateway.php#L82-L122 | train |
Kris-Kuiper/sFire-Framework | src/DB/Driver/MySQLi/TableGateway.php | TableGateway.call | public function call($function, $params) {
if(null === $this -> getAdapter()) {
return trigger_error(sprintf('No database adapter was set in "%s"', __METHOD__), E_USER_ERROR);
}
if(null !== $function && false === is_string($function)) {
return trigger_error(sprintf('Argument 1 passed to %s() must b... | php | public function call($function, $params) {
if(null === $this -> getAdapter()) {
return trigger_error(sprintf('No database adapter was set in "%s"', __METHOD__), E_USER_ERROR);
}
if(null !== $function && false === is_string($function)) {
return trigger_error(sprintf('Argument 1 passed to %s() must b... | [
"public",
"function",
"call",
"(",
"$",
"function",
",",
"$",
"params",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"getAdapter",
"(",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'No database adapter was set in \"%s\"'",
",",
... | Call stored procedure
@param string $function
@param array $params
@return boolean | [
"Call",
"stored",
"procedure"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/DB/Driver/MySQLi/TableGateway.php#L319-L337 | train |
Kris-Kuiper/sFire-Framework | src/DB/Driver/MySQLi/TableGateway.php | TableGateway.select | public function select($query, $params = [], $type = null) {
$type = $type === null ? $this -> getEntityNamespace($this -> getTable()) : $type;
if(null === $this -> getAdapter()) {
return trigger_error(sprintf('No database adapter was set in "%s"', __METHOD__), E_USER_ERROR);
}
return new Result... | php | public function select($query, $params = [], $type = null) {
$type = $type === null ? $this -> getEntityNamespace($this -> getTable()) : $type;
if(null === $this -> getAdapter()) {
return trigger_error(sprintf('No database adapter was set in "%s"', __METHOD__), E_USER_ERROR);
}
return new Result... | [
"public",
"function",
"select",
"(",
"$",
"query",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"$",
"type",
"===",
"null",
"?",
"$",
"this",
"->",
"getEntityNamespace",
"(",
"$",
"this",
"->",
"ge... | Execute select statement and returns a ResultSet
@param string $query
@param array $params
@param boolean $toEntity
@return sFire\Adapter\MySQL\ResultSet | [
"Execute",
"select",
"statement",
"and",
"returns",
"a",
"ResultSet"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/DB/Driver/MySQLi/TableGateway.php#L347-L356 | train |
Kris-Kuiper/sFire-Framework | src/DB/Driver/MySQLi/TableGateway.php | TableGateway.getEntityNamespace | private function getEntityNamespace($table) {
if(false === is_string($table)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($table)), E_USER_ERROR);
}
$path = $this -> getNamespace($this, ['directory', 'dbtable'], ['directory', '... | php | private function getEntityNamespace($table) {
if(false === is_string($table)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($table)), E_USER_ERROR);
}
$path = $this -> getNamespace($this, ['directory', 'dbtable'], ['directory', '... | [
"private",
"function",
"getEntityNamespace",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"table",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
... | Loads entity table name
@param string $table
@return string | [
"Loads",
"entity",
"table",
"name"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/DB/Driver/MySQLi/TableGateway.php#L399-L409 | train |
Kris-Kuiper/sFire-Framework | src/Form/Types/Selectrange.php | Selectrange.range | public function range($min, $max, $steps = 1, $round = 0) {
if(false === is_numeric($min)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type float or integer, "%s" given', __METHOD__, gettype($min)), E_USER_ERROR);
}
if(false === is_numeric($max)) ... | php | public function range($min, $max, $steps = 1, $round = 0) {
if(false === is_numeric($min)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type float or integer, "%s" given', __METHOD__, gettype($min)), E_USER_ERROR);
}
if(false === is_numeric($max)) ... | [
"public",
"function",
"range",
"(",
"$",
"min",
",",
"$",
"max",
",",
"$",
"steps",
"=",
"1",
",",
"$",
"round",
"=",
"0",
")",
"{",
"if",
"(",
"false",
"===",
"is_numeric",
"(",
"$",
"min",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf... | Set the min. and max. number to iterate. The min will increase by the steps and can be formatted with the round parameter
@param float $min
@param float $max
@param float $steps
@param int $round
@return sFire\Form\Types\Selectrange | [
"Set",
"the",
"min",
".",
"and",
"max",
".",
"number",
"to",
"iterate",
".",
"The",
"min",
"will",
"increase",
"by",
"the",
"steps",
"and",
"can",
"be",
"formatted",
"with",
"the",
"round",
"parameter"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Form/Types/Selectrange.php#L54-L78 | train |
sergeymakinen/tests | src/Util/ExtensionTrait.php | ExtensionTrait.getProperty | protected function getProperty($object, $name)
{
$class = new \ReflectionClass($object);
while (!$class->hasProperty($name)) {
$class = $class->getParentClass();
}
return $class->getProperty($name);
} | php | protected function getProperty($object, $name)
{
$class = new \ReflectionClass($object);
while (!$class->hasProperty($name)) {
$class = $class->getParentClass();
}
return $class->getProperty($name);
} | [
"protected",
"function",
"getProperty",
"(",
"$",
"object",
",",
"$",
"name",
")",
"{",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"object",
")",
";",
"while",
"(",
"!",
"$",
"class",
"->",
"hasProperty",
"(",
"$",
"name",
")",
")",... | Returns the reflected property.
@param object|string $object
@param string $name
@return \ReflectionProperty | [
"Returns",
"the",
"reflected",
"property",
"."
] | 6ad901d0caaa76cd1d891e10c1218654c0178bed | https://github.com/sergeymakinen/tests/blob/6ad901d0caaa76cd1d891e10c1218654c0178bed/src/Util/ExtensionTrait.php#L21-L28 | train |
hiqsol-attic/composer-extension-plugin | src/Plugin.php | Plugin.onPostAutoloadDump | public function onPostAutoloadDump(Event $event)
{
$this->io->writeError('<info>Generating extensions files</info>');
foreach ($this->getPackages() as $package) {
if ($package instanceof \Composer\Package\CompletePackageInterface) {
$this->processPackage($package);
... | php | public function onPostAutoloadDump(Event $event)
{
$this->io->writeError('<info>Generating extensions files</info>');
foreach ($this->getPackages() as $package) {
if ($package instanceof \Composer\Package\CompletePackageInterface) {
$this->processPackage($package);
... | [
"public",
"function",
"onPostAutoloadDump",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"io",
"->",
"writeError",
"(",
"'<info>Generating extensions files</info>'",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"getPackages",
"(",
")",
"as",
"$",
... | Simply rewrites extensions file from scratch.
@param Event $event | [
"Simply",
"rewrites",
"extensions",
"file",
"from",
"scratch",
"."
] | 3e4a5384ca368f43debe277c606846e4299d2bf4 | https://github.com/hiqsol-attic/composer-extension-plugin/blob/3e4a5384ca368f43debe277c606846e4299d2bf4/src/Plugin.php#L103-L116 | train |
hiqsol-attic/composer-extension-plugin | src/Plugin.php | Plugin.processPackage | public function processPackage(PackageInterface $package)
{
$extra = $package->getExtra();
$files = isset($extra[self::EXTRA_OPTION_NAME]) ? $extra[self::EXTRA_OPTION_NAME] : null;
if ($package->getType() !== self::PACKAGE_TYPE && is_null($files)) {
return;
}
$ex... | php | public function processPackage(PackageInterface $package)
{
$extra = $package->getExtra();
$files = isset($extra[self::EXTRA_OPTION_NAME]) ? $extra[self::EXTRA_OPTION_NAME] : null;
if ($package->getType() !== self::PACKAGE_TYPE && is_null($files)) {
return;
}
$ex... | [
"public",
"function",
"processPackage",
"(",
"PackageInterface",
"$",
"package",
")",
"{",
"$",
"extra",
"=",
"$",
"package",
"->",
"getExtra",
"(",
")",
";",
"$",
"files",
"=",
"isset",
"(",
"$",
"extra",
"[",
"self",
"::",
"EXTRA_OPTION_NAME",
"]",
")"... | Scans the given package and collects extensions data.
@param PackageInterface $package | [
"Scans",
"the",
"given",
"package",
"and",
"collects",
"extensions",
"data",
"."
] | 3e4a5384ca368f43debe277c606846e4299d2bf4 | https://github.com/hiqsol-attic/composer-extension-plugin/blob/3e4a5384ca368f43debe277c606846e4299d2bf4/src/Plugin.php#L142-L176 | train |
hiqsol-attic/composer-extension-plugin | src/Plugin.php | Plugin.readExtensionConfig | protected function readExtensionConfig(PackageInterface $package, $file)
{
$path = $this->preparePath($package, $file);
if (!file_exists($path)) {
$this->io->writeError('<error>Non existent extension config file</error> ' . $file . ' in ' . $package->getName());
exit(1);
... | php | protected function readExtensionConfig(PackageInterface $package, $file)
{
$path = $this->preparePath($package, $file);
if (!file_exists($path)) {
$this->io->writeError('<error>Non existent extension config file</error> ' . $file . ' in ' . $package->getName());
exit(1);
... | [
"protected",
"function",
"readExtensionConfig",
"(",
"PackageInterface",
"$",
"package",
",",
"$",
"file",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"preparePath",
"(",
"$",
"package",
",",
"$",
"file",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
... | Read extra config.
@param string $file
@return array | [
"Read",
"extra",
"config",
"."
] | 3e4a5384ca368f43debe277c606846e4299d2bf4 | https://github.com/hiqsol-attic/composer-extension-plugin/blob/3e4a5384ca368f43debe277c606846e4299d2bf4/src/Plugin.php#L183-L191 | train |
cmsgears/module-community | common/models/resources/GroupMessage.php | GroupMessage.getGroup | public function getGroup() {
$groupTable = CmnTables::getTableName( CmnTables::TABLE_GROUP );
return $this->hasOne( Group::class, [ 'id' => 'groupId' ] )->from( "$groupTable group" );
} | php | public function getGroup() {
$groupTable = CmnTables::getTableName( CmnTables::TABLE_GROUP );
return $this->hasOne( Group::class, [ 'id' => 'groupId' ] )->from( "$groupTable group" );
} | [
"public",
"function",
"getGroup",
"(",
")",
"{",
"$",
"groupTable",
"=",
"CmnTables",
"::",
"getTableName",
"(",
"CmnTables",
"::",
"TABLE_GROUP",
")",
";",
"return",
"$",
"this",
"->",
"hasOne",
"(",
"Group",
"::",
"class",
",",
"[",
"'id'",
"=>",
"'gro... | Returns the corresponding group.
@return \cmsgears\community\common\models\entities\Group | [
"Returns",
"the",
"corresponding",
"group",
"."
] | 0ca9cf0aa0cee395a4788bd6085f291e10728555 | https://github.com/cmsgears/module-community/blob/0ca9cf0aa0cee395a4788bd6085f291e10728555/common/models/resources/GroupMessage.php#L194-L199 | train |
jenskooij/cloudcontrol | src/storage/storage/ValuelistsStorage.php | ValuelistsStorage.saveValuelist | public function saveValuelist($slug, $postValues)
{
$valuelistObject = ValuelistFactory::createValuelistFromPostValues($postValues);
$valuelists = $this->repository->valuelists;
foreach ($valuelists as $key => $valuelist) {
if ($valuelist->slug == $slug) {
$value... | php | public function saveValuelist($slug, $postValues)
{
$valuelistObject = ValuelistFactory::createValuelistFromPostValues($postValues);
$valuelists = $this->repository->valuelists;
foreach ($valuelists as $key => $valuelist) {
if ($valuelist->slug == $slug) {
$value... | [
"public",
"function",
"saveValuelist",
"(",
"$",
"slug",
",",
"$",
"postValues",
")",
"{",
"$",
"valuelistObject",
"=",
"ValuelistFactory",
"::",
"createValuelistFromPostValues",
"(",
"$",
"postValues",
")",
";",
"$",
"valuelists",
"=",
"$",
"this",
"->",
"rep... | Save changes to a valuelist
@param $slug
@param $postValues
@throws \Exception | [
"Save",
"changes",
"to",
"a",
"valuelist"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/ValuelistsStorage.php#L47-L59 | train |
jenskooij/cloudcontrol | src/storage/storage/ValuelistsStorage.php | ValuelistsStorage.getValuelistBySlug | public function getValuelistBySlug($slug)
{
$valuelists = $this->repository->valuelists;
foreach ($valuelists as $valuelist) {
if ($valuelist->slug == $slug) {
return $valuelist;
}
}
return null;
} | php | public function getValuelistBySlug($slug)
{
$valuelists = $this->repository->valuelists;
foreach ($valuelists as $valuelist) {
if ($valuelist->slug == $slug) {
return $valuelist;
}
}
return null;
} | [
"public",
"function",
"getValuelistBySlug",
"(",
"$",
"slug",
")",
"{",
"$",
"valuelists",
"=",
"$",
"this",
"->",
"repository",
"->",
"valuelists",
";",
"foreach",
"(",
"$",
"valuelists",
"as",
"$",
"valuelist",
")",
"{",
"if",
"(",
"$",
"valuelist",
"-... | Get a valuelist by its slug
@param $slug
@return \stdClass | [
"Get",
"a",
"valuelist",
"by",
"its",
"slug"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/ValuelistsStorage.php#L68-L78 | train |
devlabmtl/haven-security | Controller/LoginController.php | LoginController.resetConfirmationAction | public function resetConfirmationAction($uuid) {
$em = $this->container->get("doctrine")->getEntityManager();
$request = $this->container->get("request");
$confirm_data = $request->get("haven_bundle_securitybundle_confirmtype");
$user_reset = $em->getRepository("HavenSecurityBundle:UserR... | php | public function resetConfirmationAction($uuid) {
$em = $this->container->get("doctrine")->getEntityManager();
$request = $this->container->get("request");
$confirm_data = $request->get("haven_bundle_securitybundle_confirmtype");
$user_reset = $em->getRepository("HavenSecurityBundle:UserR... | [
"public",
"function",
"resetConfirmationAction",
"(",
"$",
"uuid",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"\"doctrine\"",
")",
"->",
"getEntityManager",
"(",
")",
";",
"$",
"request",
"=",
"$",
"this",
"->",
"containe... | reset confirmation by the user
@Route("/{_locale}/auth/confirmation/{uuid}")
@Template() | [
"reset",
"confirmation",
"by",
"the",
"user"
] | 8e53d57e3d5680e97ad8c0b9f37d34e8e478ce10 | https://github.com/devlabmtl/haven-security/blob/8e53d57e3d5680e97ad8c0b9f37d34e8e478ce10/Controller/LoginController.php#L212-L246 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.get | public function get($key, $default = null) {
$this->check();
$value = $this->readValue($key);
return is_null($value) ? $default : $value;
} | php | public function get($key, $default = null) {
$this->check();
$value = $this->readValue($key);
return is_null($value) ? $default : $value;
} | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"check",
"(",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"readValue",
"(",
"$",
"key",
")",
";",
"return",
"is_null",
"(",
"$",
"v... | Get value from storage
@param string $key
@return mixed | [
"Get",
"value",
"from",
"storage"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L89-L93 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.has | public function has($key) {
$this->check();
$data = $this->readData();
return isset($data[$key]);
} | php | public function has($key) {
$this->check();
$data = $this->readData();
return isset($data[$key]);
} | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"check",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"readData",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
")",
";",
"}"
] | Check if storage has given key
@return bool | [
"Check",
"if",
"storage",
"has",
"given",
"key"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L118-L122 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.destroy | public function destroy() {
if (false === shmop_delete($this->shm)) {
throw new RuntimeException(sprintf('Unable to destroy shared memory segment id: %s', $this->shm));
}
$this->destroyed = true;
} | php | public function destroy() {
if (false === shmop_delete($this->shm)) {
throw new RuntimeException(sprintf('Unable to destroy shared memory segment id: %s', $this->shm));
}
$this->destroyed = true;
} | [
"public",
"function",
"destroy",
"(",
")",
"{",
"if",
"(",
"false",
"===",
"shmop_delete",
"(",
"$",
"this",
"->",
"shm",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"sprintf",
"(",
"'Unable to destroy shared memory segment id: %s'",
",",
"$",
"thi... | Destroy shared memory segment
@throws RuntimeException | [
"Destroy",
"shared",
"memory",
"segment"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L136-L142 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.setupSegment | protected function setupSegment() {
// Attempt to open shm segment
$this->shm = @shmop_open($this->getIdentifier(), self::SHM_OPEN_MODE, 0, 0);
// If segment doesn't exist init new segment
if (false === $this->shm) {
$this->createSegment();
}
} | php | protected function setupSegment() {
// Attempt to open shm segment
$this->shm = @shmop_open($this->getIdentifier(), self::SHM_OPEN_MODE, 0, 0);
// If segment doesn't exist init new segment
if (false === $this->shm) {
$this->createSegment();
}
} | [
"protected",
"function",
"setupSegment",
"(",
")",
"{",
"// Attempt to open shm segment",
"$",
"this",
"->",
"shm",
"=",
"@",
"shmop_open",
"(",
"$",
"this",
"->",
"getIdentifier",
"(",
")",
",",
"self",
"::",
"SHM_OPEN_MODE",
",",
"0",
",",
"0",
")",
";",... | Create or open shared memory segment using current key | [
"Create",
"or",
"open",
"shared",
"memory",
"segment",
"using",
"current",
"key"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L157-L165 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.createSegment | protected function createSegment() {
$this->shm = shmop_open(
$this->getIdentifier(),
self::SHM_CREATE_MODE,
self::SHM_CREATE_PERMISSIONS,
$this->size
);
if (false === $this->shm) {
throw new RuntimeException(sprintf('Unable to create shared memory segment with key: %s', $this->getIdentifier()));
... | php | protected function createSegment() {
$this->shm = shmop_open(
$this->getIdentifier(),
self::SHM_CREATE_MODE,
self::SHM_CREATE_PERMISSIONS,
$this->size
);
if (false === $this->shm) {
throw new RuntimeException(sprintf('Unable to create shared memory segment with key: %s', $this->getIdentifier()));
... | [
"protected",
"function",
"createSegment",
"(",
")",
"{",
"$",
"this",
"->",
"shm",
"=",
"shmop_open",
"(",
"$",
"this",
"->",
"getIdentifier",
"(",
")",
",",
"self",
"::",
"SHM_CREATE_MODE",
",",
"self",
"::",
"SHM_CREATE_PERMISSIONS",
",",
"$",
"this",
"-... | Create new shm segment and write base meta data | [
"Create",
"new",
"shm",
"segment",
"and",
"write",
"base",
"meta",
"data"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L170-L183 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.updateSize | protected function updateSize($size) {
$size = sprintf('%' . self::SHM_DATA_OFFSET . 'd', intval($size));
return !!$this->write(0, $size);
} | php | protected function updateSize($size) {
$size = sprintf('%' . self::SHM_DATA_OFFSET . 'd', intval($size));
return !!$this->write(0, $size);
} | [
"protected",
"function",
"updateSize",
"(",
"$",
"size",
")",
"{",
"$",
"size",
"=",
"sprintf",
"(",
"'%'",
".",
"self",
"::",
"SHM_DATA_OFFSET",
".",
"'d'",
",",
"intval",
"(",
"$",
"size",
")",
")",
";",
"return",
"!",
"!",
"$",
"this",
"->",
"wr... | Update size field
@param int size | [
"Update",
"size",
"field"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L189-L192 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.writeValue | protected function writeValue($key, $value) {
$data = $this->readData();
$data[$key] = $this->encode($value);
if ($this->writeData($data)) {
return $value;
}
return false;
} | php | protected function writeValue($key, $value) {
$data = $this->readData();
$data[$key] = $this->encode($value);
if ($this->writeData($data)) {
return $value;
}
return false;
} | [
"protected",
"function",
"writeValue",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"readData",
"(",
")",
";",
"$",
"data",
"[",
"$",
"key",
"]",
"=",
"$",
"this",
"->",
"encode",
"(",
"$",
"value",
")",
";... | Write value to shm segment
@param string $key
@param string $value | [
"Write",
"value",
"to",
"shm",
"segment"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L207-L216 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.unsetValue | protected function unsetValue($key) {
$data = $this->readData();
unset($data[$key]);
return $this->writeData($data);
} | php | protected function unsetValue($key) {
$data = $this->readData();
unset($data[$key]);
return $this->writeData($data);
} | [
"protected",
"function",
"unsetValue",
"(",
"$",
"key",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"readData",
"(",
")",
";",
"unset",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
")",
";",
"return",
"$",
"this",
"->",
"writeData",
"(",
"$",
"data... | Removes item from storage
@param string $key | [
"Removes",
"item",
"from",
"storage"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L222-L226 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.readValue | protected function readValue($key) {
$data = $this->readData();
return isset($data[$key]) ? $this->decode($data[$key]) : null;
} | php | protected function readValue($key) {
$data = $this->readData();
return isset($data[$key]) ? $this->decode($data[$key]) : null;
} | [
"protected",
"function",
"readValue",
"(",
"$",
"key",
")",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"readData",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"data",
"[",
"$",
"key",
"]",
")",
"?",
"$",
"this",
"->",
"decode",
"(",
"$",
"data",
... | Read value from shm segment
@param string key
@return string | null if field doesn't exist | [
"Read",
"value",
"from",
"shm",
"segment"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L233-L236 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.writeData | protected function writeData(array $data) {
$size = $this->write(self::SHM_DATA_OFFSET, json_encode($data));
return $this->updateSize($size);
} | php | protected function writeData(array $data) {
$size = $this->write(self::SHM_DATA_OFFSET, json_encode($data));
return $this->updateSize($size);
} | [
"protected",
"function",
"writeData",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"size",
"=",
"$",
"this",
"->",
"write",
"(",
"self",
"::",
"SHM_DATA_OFFSET",
",",
"json_encode",
"(",
"$",
"data",
")",
")",
";",
"return",
"$",
"this",
"->",
"updateSize... | Write data to shm segment
@param array $data | [
"Write",
"data",
"to",
"shm",
"segment"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L242-L245 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.readData | protected function readData() {
$used = $this->readSize();
return 0 === $used ? array() : json_decode($this->read(self::SHM_DATA_OFFSET, $used), true);
} | php | protected function readData() {
$used = $this->readSize();
return 0 === $used ? array() : json_decode($this->read(self::SHM_DATA_OFFSET, $used), true);
} | [
"protected",
"function",
"readData",
"(",
")",
"{",
"$",
"used",
"=",
"$",
"this",
"->",
"readSize",
"(",
")",
";",
"return",
"0",
"===",
"$",
"used",
"?",
"array",
"(",
")",
":",
"json_decode",
"(",
"$",
"this",
"->",
"read",
"(",
"self",
"::",
... | Read data from shm segment
@param string $key
@return string | [
"Read",
"data",
"from",
"shm",
"segment"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L252-L255 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.encode | protected function encode($val) {
switch (true) {
case is_array($val):
return self::T_ARRAY . json_encode($val);
case is_int($val):
return self::T_INT . $val;
case is_bool($val):
return self::T_BOOLEAN . $val;
case is_float($val):
return self::T_DOUBLE . $val;
case is_object($val):
... | php | protected function encode($val) {
switch (true) {
case is_array($val):
return self::T_ARRAY . json_encode($val);
case is_int($val):
return self::T_INT . $val;
case is_bool($val):
return self::T_BOOLEAN . $val;
case is_float($val):
return self::T_DOUBLE . $val;
case is_object($val):
... | [
"protected",
"function",
"encode",
"(",
"$",
"val",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"is_array",
"(",
"$",
"val",
")",
":",
"return",
"self",
"::",
"T_ARRAY",
".",
"json_encode",
"(",
"$",
"val",
")",
";",
"case",
"is_int",
"(",
"... | Serialize value with type prefix
@param mixed $value
@return string encoded value | [
"Serialize",
"value",
"with",
"type",
"prefix"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L282-L297 | train |
boo1ean/shared | src/Shared/Storage.php | Storage.decode | protected function decode($encoded) {
$val = substr($encoded, 1);
switch ($encoded[0]) {
case self::T_ARRAY:
return json_decode($val, true);
case self::T_INT:
return intval($val);
case self::T_BOOLEAN:
return !!$val;
case self::T_DOUBLE:
return floatval($val);
case self::T_OBJECT:
... | php | protected function decode($encoded) {
$val = substr($encoded, 1);
switch ($encoded[0]) {
case self::T_ARRAY:
return json_decode($val, true);
case self::T_INT:
return intval($val);
case self::T_BOOLEAN:
return !!$val;
case self::T_DOUBLE:
return floatval($val);
case self::T_OBJECT:
... | [
"protected",
"function",
"decode",
"(",
"$",
"encoded",
")",
"{",
"$",
"val",
"=",
"substr",
"(",
"$",
"encoded",
",",
"1",
")",
";",
"switch",
"(",
"$",
"encoded",
"[",
"0",
"]",
")",
"{",
"case",
"self",
"::",
"T_ARRAY",
":",
"return",
"json_deco... | Unserialize value from storage
@param string $encoded
@return mixed | [
"Unserialize",
"value",
"from",
"storage"
] | 92c6309a9af21e280179b4de161dbe74bc764f22 | https://github.com/boo1ean/shared/blob/92c6309a9af21e280179b4de161dbe74bc764f22/src/Shared/Storage.php#L304-L320 | train |
lasallecms/lasallecms-l5-shortmessageservice-pkg | src/Twilio/UseTwilio.php | UseTwilio.getTwilioConfig | public function getTwilioConfig($connection='twilio')
{
$twilioconfig = config('twilio.twilio');
$configSettings = [];
$configSettings['sid'] = $twilioconfig['connections'][$connection]['sid'];
$configSettings['token'] = $twilioconfig['conne... | php | public function getTwilioConfig($connection='twilio')
{
$twilioconfig = config('twilio.twilio');
$configSettings = [];
$configSettings['sid'] = $twilioconfig['connections'][$connection]['sid'];
$configSettings['token'] = $twilioconfig['conne... | [
"public",
"function",
"getTwilioConfig",
"(",
"$",
"connection",
"=",
"'twilio'",
")",
"{",
"$",
"twilioconfig",
"=",
"config",
"(",
"'twilio.twilio'",
")",
";",
"$",
"configSettings",
"=",
"[",
"]",
";",
"$",
"configSettings",
"[",
"'sid'",
"]",
"=",
"$",... | Get the Twilio config settings from the laravel-twilio package
@param string $conection The connection to fetch. Can have multiple Twilio connections in the config.
@return array | [
"Get",
"the",
"Twilio",
"config",
"settings",
"from",
"the",
"laravel",
"-",
"twilio",
"package"
] | 0562046af8f60a80947bada451fde2f0859b3812 | https://github.com/lasallecms/lasallecms-l5-shortmessageservice-pkg/blob/0562046af8f60a80947bada451fde2f0859b3812/src/Twilio/UseTwilio.php#L100-L110 | train |
kaiohken1982/Watermarker | src/Watermarker/Watermarker/Watermarker.php | Watermarker.watermarkDimensionCoords | public function watermarkDimensionCoords()
{
$watermarkInfo = $this->getWatermarkInfo();
$imageInfo = $this->getImageInfo();
switch ($this->getType()) :
case self::WATERMARK_TYPE_FULLWIDTH:
default:
$resizedWatermarkWidth = number_format($imageInfo['width'], 0, ',', '');
... | php | public function watermarkDimensionCoords()
{
$watermarkInfo = $this->getWatermarkInfo();
$imageInfo = $this->getImageInfo();
switch ($this->getType()) :
case self::WATERMARK_TYPE_FULLWIDTH:
default:
$resizedWatermarkWidth = number_format($imageInfo['width'], 0, ',', '');
... | [
"public",
"function",
"watermarkDimensionCoords",
"(",
")",
"{",
"$",
"watermarkInfo",
"=",
"$",
"this",
"->",
"getWatermarkInfo",
"(",
")",
";",
"$",
"imageInfo",
"=",
"$",
"this",
"->",
"getImageInfo",
"(",
")",
";",
"switch",
"(",
"$",
"this",
"->",
"... | Get watermark type dimension from a type
@param array
@param array
@param int
@return array | [
"Get",
"watermark",
"type",
"dimension",
"from",
"a",
"type"
] | 95b14bbcd0d7b070070b3c1730360445bc52788c | https://github.com/kaiohken1982/Watermarker/blob/95b14bbcd0d7b070070b3c1730360445bc52788c/src/Watermarker/Watermarker/Watermarker.php#L297-L315 | train |
kaiohken1982/Watermarker | src/Watermarker/Watermarker/Watermarker.php | Watermarker.setWatermarkTmpDir | public function setWatermarkTmpDir($watermarkTmpDir)
{
$watermarkTmpDirCopy = $watermarkTmpDir;
$watermarkTmpDir = realpath($watermarkTmpDir);
// If the provided tmpDir is empty throw exception
if (empty($watermarkTmpDir)) {
throw new \RuntimeException("Watermar... | php | public function setWatermarkTmpDir($watermarkTmpDir)
{
$watermarkTmpDirCopy = $watermarkTmpDir;
$watermarkTmpDir = realpath($watermarkTmpDir);
// If the provided tmpDir is empty throw exception
if (empty($watermarkTmpDir)) {
throw new \RuntimeException("Watermar... | [
"public",
"function",
"setWatermarkTmpDir",
"(",
"$",
"watermarkTmpDir",
")",
"{",
"$",
"watermarkTmpDirCopy",
"=",
"$",
"watermarkTmpDir",
";",
"$",
"watermarkTmpDir",
"=",
"realpath",
"(",
"$",
"watermarkTmpDir",
")",
";",
"// If the provided tmpDir is empty throw exc... | Set the watermark directory
@param string
@throws \RuntimeException
@return \Watermarker\Watermarker\Watermarker | [
"Set",
"the",
"watermark",
"directory"
] | 95b14bbcd0d7b070070b3c1730360445bc52788c | https://github.com/kaiohken1982/Watermarker/blob/95b14bbcd0d7b070070b3c1730360445bc52788c/src/Watermarker/Watermarker/Watermarker.php#L324-L341 | train |
linguisticteam/json-ld | src/Generators/schema_org.php | Thing.check_type | private function check_type(){
$this_class = new \ReflectionClass( $this );
$type = $this_class->getShortName();
if ($type == 'Thing') {
$type = $this->get_type();
unset($this->type);
}
if(!is_null($this->realType)){
$type = $this->realType;
... | php | private function check_type(){
$this_class = new \ReflectionClass( $this );
$type = $this_class->getShortName();
if ($type == 'Thing') {
$type = $this->get_type();
unset($this->type);
}
if(!is_null($this->realType)){
$type = $this->realType;
... | [
"private",
"function",
"check_type",
"(",
")",
"{",
"$",
"this_class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"this",
")",
";",
"$",
"type",
"=",
"$",
"this_class",
"->",
"getShortName",
"(",
")",
";",
"if",
"(",
"$",
"type",
"==",
"'Thing'",
... | In most cases, the name of the object withing json-ld markup will be the class name.
Sometimes though we create a custom object on the fly with an array of properties, but we can't have
the object appear as a "Thing" so we have to set the type manually.
When classes are extended by implementing code, the namespace mi... | [
"In",
"most",
"cases",
"the",
"name",
"of",
"the",
"object",
"withing",
"json",
"-",
"ld",
"markup",
"will",
"be",
"the",
"class",
"name",
"."
] | 354fd518aff5fa52635f435888056fe0bd926566 | https://github.com/linguisticteam/json-ld/blob/354fd518aff5fa52635f435888056fe0bd926566/src/Generators/schema_org.php#L87-L101 | train |
linguisticteam/json-ld | src/Generators/schema_org.php | Thing.format | public function format()
{
$result = array();
$result["@type"] = $this->check_type();
$values = array_filter( get_object_vars( $this ) );
foreach ($values as $key => $value) {
if ($value instanceof ICanBecomeJSONLD) {
$formatted = $value->fo... | php | public function format()
{
$result = array();
$result["@type"] = $this->check_type();
$values = array_filter( get_object_vars( $this ) );
foreach ($values as $key => $value) {
if ($value instanceof ICanBecomeJSONLD) {
$formatted = $value->fo... | [
"public",
"function",
"format",
"(",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"$",
"result",
"[",
"\"@type\"",
"]",
"=",
"$",
"this",
"->",
"check_type",
"(",
")",
";",
"$",
"values",
"=",
"array_filter",
"(",
"get_object_vars",
"(",
"$"... | Creates an array of schema.org attribute ready to be json encoded.
Grabs all properties from the class and uses those that aren't empty.
@return array | [
"Creates",
"an",
"array",
"of",
"schema",
".",
"org",
"attribute",
"ready",
"to",
"be",
"json",
"encoded",
"."
] | 354fd518aff5fa52635f435888056fe0bd926566 | https://github.com/linguisticteam/json-ld/blob/354fd518aff5fa52635f435888056fe0bd926566/src/Generators/schema_org.php#L111-L130 | train |
linguisticteam/json-ld | src/Generators/schema_org.php | Thing.addPotentialAction | protected function addPotentialAction()
{
$class = static::$helper->get_search_action_type();
if (class_exists( $class )) {
$class_test = new \ReflectionClass( $class );
if ($class_test->implementsInterface( 'Lti\Seo\Generators\ICanSearch' )) {
$this->potentia... | php | protected function addPotentialAction()
{
$class = static::$helper->get_search_action_type();
if (class_exists( $class )) {
$class_test = new \ReflectionClass( $class );
if ($class_test->implementsInterface( 'Lti\Seo\Generators\ICanSearch' )) {
$this->potentia... | [
"protected",
"function",
"addPotentialAction",
"(",
")",
"{",
"$",
"class",
"=",
"static",
"::",
"$",
"helper",
"->",
"get_search_action_type",
"(",
")",
";",
"if",
"(",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"$",
"class_test",
"=",
"new",
"\\... | Adds a search potential action if the website supports it. | [
"Adds",
"a",
"search",
"potential",
"action",
"if",
"the",
"website",
"supports",
"it",
"."
] | 354fd518aff5fa52635f435888056fe0bd926566 | https://github.com/linguisticteam/json-ld/blob/354fd518aff5fa52635f435888056fe0bd926566/src/Generators/schema_org.php#L135-L144 | train |
Xsaven/laravel-intelect-admin | src/Addons/GoogleTranslate/Tokens/GoogleTokenGenerator.php | GoogleTokenGenerator.charCodeAt | private function charCodeAt($str, $index)
{
$char = mb_substr($str, $index, 1, 'UTF-8');
if (mb_check_encoding($char, 'UTF-8')) {
$ret = mb_convert_encoding($char, 'UTF-32BE', 'UTF-8');
$result = hexdec(bin2hex($ret));
return $result;
}
return;
... | php | private function charCodeAt($str, $index)
{
$char = mb_substr($str, $index, 1, 'UTF-8');
if (mb_check_encoding($char, 'UTF-8')) {
$ret = mb_convert_encoding($char, 'UTF-32BE', 'UTF-8');
$result = hexdec(bin2hex($ret));
return $result;
}
return;
... | [
"private",
"function",
"charCodeAt",
"(",
"$",
"str",
",",
"$",
"index",
")",
"{",
"$",
"char",
"=",
"mb_substr",
"(",
"$",
"str",
",",
"$",
"index",
",",
"1",
",",
"'UTF-8'",
")",
";",
"if",
"(",
"mb_check_encoding",
"(",
"$",
"char",
",",
"'UTF-8... | Get the Unicode of the character at the specified index in a string.
@param string $str
@param int $index
@return null|number | [
"Get",
"the",
"Unicode",
"of",
"the",
"character",
"at",
"the",
"specified",
"index",
"in",
"a",
"string",
"."
] | 592574633d12c74cf25b43dd6694fee496abefcb | https://github.com/Xsaven/laravel-intelect-admin/blob/592574633d12c74cf25b43dd6694fee496abefcb/src/Addons/GoogleTranslate/Tokens/GoogleTokenGenerator.php#L148-L159 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.