repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
chriswoodford/foursquare-php | lib/TheTwelve/Foursquare/UsersGateway.php | UsersGateway.buildUserResourceUri | protected function buildUserResourceUri($resource, $userId = null)
{
$userId = is_null($userId) ? $this->userId : $userId;
return '/users/' . $userId . '/' . $resource;
} | php | protected function buildUserResourceUri($resource, $userId = null)
{
$userId = is_null($userId) ? $this->userId : $userId;
return '/users/' . $userId . '/' . $resource;
} | [
"protected",
"function",
"buildUserResourceUri",
"(",
"$",
"resource",
",",
"$",
"userId",
"=",
"null",
")",
"{",
"$",
"userId",
"=",
"is_null",
"(",
"$",
"userId",
")",
"?",
"$",
"this",
"->",
"userId",
":",
"$",
"userId",
";",
"return",
"'/users/'",
... | build the resource URI
@param string $resource
@param string|null $userId
@return string | [
"build",
"the",
"resource",
"URI"
] | train | https://github.com/chriswoodford/foursquare-php/blob/edbfcba2993a101ead8f381394742a4689aec398/lib/TheTwelve/Foursquare/UsersGateway.php#L281-L287 |
27cm/password-generator | src/WordList/AbstractStaticArray.php | AbstractStaticArray.get | public function get($random)
{
$length = count(static::$words);
$position = (int) ($random * ($length - 1));
return static::$words[$position];
} | php | public function get($random)
{
$length = count(static::$words);
$position = (int) ($random * ($length - 1));
return static::$words[$position];
} | [
"public",
"function",
"get",
"(",
"$",
"random",
")",
"{",
"$",
"length",
"=",
"count",
"(",
"static",
"::",
"$",
"words",
")",
";",
"$",
"position",
"=",
"(",
"int",
")",
"(",
"$",
"random",
"*",
"(",
"$",
"length",
"-",
"1",
")",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/27cm/password-generator/blob/c7f835f3bc302a91497bf5f659e404e750fb03bf/src/WordList/AbstractStaticArray.php#L20-L25 |
kiwiz/ecl | src/ResultSet.php | ResultSet.& | public function &offsetGet($n) {
if(!$this->offsetExists($n)) {
throw new IndexNotFoundException((string) $n);
}
return $this->data[$n];
} | php | public function &offsetGet($n) {
if(!$this->offsetExists($n)) {
throw new IndexNotFoundException((string) $n);
}
return $this->data[$n];
} | [
"public",
"function",
"&",
"offsetGet",
"(",
"$",
"n",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"offsetExists",
"(",
"$",
"n",
")",
")",
"{",
"throw",
"new",
"IndexNotFoundException",
"(",
"(",
"string",
")",
"$",
"n",
")",
";",
"}",
"return",
... | Get the nth entry.
@param int $n Index.
@return mixed[] Value. | [
"Get",
"the",
"nth",
"entry",
"."
] | train | https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/ResultSet.php#L51-L56 |
matthiasbayer/datadog-client | src/Bayer/DataDogClient/Series/Metric.php | Metric.setType | public function setType($type) {
if (!$this->isValidType($type)) {
throw new InvalidTypeException('Type must be one of Metric::TYPE_*');
}
$this->type = $type;
return $this;
} | php | public function setType($type) {
if (!$this->isValidType($type)) {
throw new InvalidTypeException('Type must be one of Metric::TYPE_*');
}
$this->type = $type;
return $this;
} | [
"public",
"function",
"setType",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isValidType",
"(",
"$",
"type",
")",
")",
"{",
"throw",
"new",
"InvalidTypeException",
"(",
"'Type must be one of Metric::TYPE_*'",
")",
";",
"}",
"$",
"this",... | @param string $type
@throws InvalidTypeException
@return Metric | [
"@param",
"string",
"$type",
"@throws",
"InvalidTypeException"
] | train | https://github.com/matthiasbayer/datadog-client/blob/e625132c34bf36f783077c9ee4ed3214633cd272/src/Bayer/DataDogClient/Series/Metric.php#L107-L114 |
matthiasbayer/datadog-client | src/Bayer/DataDogClient/Series/Metric.php | Metric.addPoint | public function addPoint(array $point) {
// Add timestamp if non provided
if (!isset($point[1])) {
$point = array(time(), $point[0]);
}
if (!is_integer($point[0])) {
throw new InvalidPointException('Timestamp must be an integer');
}
if (!is_int($... | php | public function addPoint(array $point) {
// Add timestamp if non provided
if (!isset($point[1])) {
$point = array(time(), $point[0]);
}
if (!is_integer($point[0])) {
throw new InvalidPointException('Timestamp must be an integer');
}
if (!is_int($... | [
"public",
"function",
"addPoint",
"(",
"array",
"$",
"point",
")",
"{",
"// Add timestamp if non provided",
"if",
"(",
"!",
"isset",
"(",
"$",
"point",
"[",
"1",
"]",
")",
")",
"{",
"$",
"point",
"=",
"array",
"(",
"time",
"(",
")",
",",
"$",
"point"... | Add a new measure point to the metric.
A point consists of an optional timestamp and a numeric value. If
no timestamp is specified, the current timestamp will be used. Order
matters. If a timestamp is specified, it should be the first value.
Examples:
Simple point: array(20)
With timestamp: array(1234567, 20)
@par... | [
"Add",
"a",
"new",
"measure",
"point",
"to",
"the",
"metric",
"."
] | train | https://github.com/matthiasbayer/datadog-client/blob/e625132c34bf36f783077c9ee4ed3214633cd272/src/Bayer/DataDogClient/Series/Metric.php#L169-L186 |
carbontwelve/slim-plates | src/PlatesViewProvider.php | PlatesViewProvider.register | public function register(Container $pimple)
{
$settings = $pimple->get('settings')['renderer'];
if (is_null($settings)) {
throw new InvalidSettingsException('Please configure the renderer settings with valid `template_path` and `template_ext` values.');
}
$engine = new P... | php | public function register(Container $pimple)
{
$settings = $pimple->get('settings')['renderer'];
if (is_null($settings)) {
throw new InvalidSettingsException('Please configure the renderer settings with valid `template_path` and `template_ext` values.');
}
$engine = new P... | [
"public",
"function",
"register",
"(",
"Container",
"$",
"pimple",
")",
"{",
"$",
"settings",
"=",
"$",
"pimple",
"->",
"get",
"(",
"'settings'",
")",
"[",
"'renderer'",
"]",
";",
"if",
"(",
"is_null",
"(",
"$",
"settings",
")",
")",
"{",
"throw",
"n... | @param ContainerInterface|Container $pimple A container instance
@throws InvalidSettingsException
@return Engine | [
"@param",
"ContainerInterface|Container",
"$pimple",
"A",
"container",
"instance"
] | train | https://github.com/carbontwelve/slim-plates/blob/2329f24187666c81d00399850932cd57a055587d/src/PlatesViewProvider.php#L20-L33 |
bdunogier/xmlrpcbundle | XmlRpc/Handler/Custom/RequestParser.php | RequestParser.handleDateParameter | protected function handleDateParameter( $value )
{
$date = DateTime::createFromFormat(
self::XML_RPC_ISO8601, (string)$value, new \DateTimeZone( 'UTC' )
);
// no separators, maybe, try again
if ( $date instanceof DateTime )
{
$date->setTimezone( new D... | php | protected function handleDateParameter( $value )
{
$date = DateTime::createFromFormat(
self::XML_RPC_ISO8601, (string)$value, new \DateTimeZone( 'UTC' )
);
// no separators, maybe, try again
if ( $date instanceof DateTime )
{
$date->setTimezone( new D... | [
"protected",
"function",
"handleDateParameter",
"(",
"$",
"value",
")",
"{",
"$",
"date",
"=",
"DateTime",
"::",
"createFromFormat",
"(",
"self",
"::",
"XML_RPC_ISO8601",
",",
"(",
"string",
")",
"$",
"value",
",",
"new",
"\\",
"DateTimeZone",
"(",
"'UTC'",
... | Parses a dateTime string. ISO-8601 is quite permissive as it makes the separators optional...
What a *great* idea.
@param string
@return DateTime | [
"Parses",
"a",
"dateTime",
"string",
".",
"ISO",
"-",
"8601",
"is",
"quite",
"permissive",
"as",
"it",
"makes",
"the",
"separators",
"optional",
"...",
"What",
"a",
"*",
"great",
"*",
"idea",
"."
] | train | https://github.com/bdunogier/xmlrpcbundle/blob/9a3d59609131d438d259b3ae2c113bb4b813a16b/XmlRpc/Handler/Custom/RequestParser.php#L116-L152 |
bdunogier/xmlrpcbundle | XmlRpc/Handler/Custom/RequestParser.php | RequestParser.handleStructParameter | protected function handleStructParameter( $value )
{
$values = array();
foreach ( $value->member as $value )
{
$values[(string)$value->name] = $this->processParameter( (array)$value->value );
}
return $values;
} | php | protected function handleStructParameter( $value )
{
$values = array();
foreach ( $value->member as $value )
{
$values[(string)$value->name] = $this->processParameter( (array)$value->value );
}
return $values;
} | [
"protected",
"function",
"handleStructParameter",
"(",
"$",
"value",
")",
"{",
"$",
"values",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"value",
"->",
"member",
"as",
"$",
"value",
")",
"{",
"$",
"values",
"[",
"(",
"string",
")",
"$",
"value... | @param $value
@return array | [
"@param",
"$value"
] | train | https://github.com/bdunogier/xmlrpcbundle/blob/9a3d59609131d438d259b3ae2c113bb4b813a16b/XmlRpc/Handler/Custom/RequestParser.php#L159-L168 |
bdunogier/xmlrpcbundle | XmlRpc/Handler/Custom/RequestParser.php | RequestParser.handleArrayParameter | protected function handleArrayParameter( $value )
{
$values = array();
foreach ( $value->data->value as $subValue )
{
if ( $subValue->count() > 0 )
{
$subValue = (array)$subValue;
}
else
{
$subValue =... | php | protected function handleArrayParameter( $value )
{
$values = array();
foreach ( $value->data->value as $subValue )
{
if ( $subValue->count() > 0 )
{
$subValue = (array)$subValue;
}
else
{
$subValue =... | [
"protected",
"function",
"handleArrayParameter",
"(",
"$",
"value",
")",
"{",
"$",
"values",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"value",
"->",
"data",
"->",
"value",
"as",
"$",
"subValue",
")",
"{",
"if",
"(",
"$",
"subValue",
"->",
"c... | @param $value
@return array | [
"@param",
"$value"
] | train | https://github.com/bdunogier/xmlrpcbundle/blob/9a3d59609131d438d259b3ae2c113bb4b813a16b/XmlRpc/Handler/Custom/RequestParser.php#L175-L192 |
bocharsky-bw/FileNamingResolver | src/FileInfo.php | FileInfo.getBasename | public function getBasename($suffix = null)
{
if (null === $suffix) {
$suffix = static::SEPARATOR_EXTENSION.$this->getExtension();
}
return parent::getBasename((string)$suffix);
} | php | public function getBasename($suffix = null)
{
if (null === $suffix) {
$suffix = static::SEPARATOR_EXTENSION.$this->getExtension();
}
return parent::getBasename((string)$suffix);
} | [
"public",
"function",
"getBasename",
"(",
"$",
"suffix",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"suffix",
")",
"{",
"$",
"suffix",
"=",
"static",
"::",
"SEPARATOR_EXTENSION",
".",
"$",
"this",
"->",
"getExtension",
"(",
")",
";",
"}",
... | Returns base name of file without extension (or base name of directory).
@param string $suffix
@return string | [
"Returns",
"base",
"name",
"of",
"file",
"without",
"extension",
"(",
"or",
"base",
"name",
"of",
"directory",
")",
"."
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileInfo.php#L22-L29 |
bocharsky-bw/FileNamingResolver | src/FileInfo.php | FileInfo.createPathname | public static function createPathname($path, $basename, $extension = '')
{
$pathname = ''
.static::purifyPath($path)
.static::SEPARATOR_DIRECTORY
.static::purifyBasename($basename)
;
if ($extension) {
$pathname .= ''
.static::SE... | php | public static function createPathname($path, $basename, $extension = '')
{
$pathname = ''
.static::purifyPath($path)
.static::SEPARATOR_DIRECTORY
.static::purifyBasename($basename)
;
if ($extension) {
$pathname .= ''
.static::SE... | [
"public",
"static",
"function",
"createPathname",
"(",
"$",
"path",
",",
"$",
"basename",
",",
"$",
"extension",
"=",
"''",
")",
"{",
"$",
"pathname",
"=",
"''",
".",
"static",
"::",
"purifyPath",
"(",
"$",
"path",
")",
".",
"static",
"::",
"SEPARATOR_... | Creates full pathname to the file / directory based on its path, basename and extension
@param string $path Directory path to the file (or directory)
@param string $basename Base name of file without extension (or base name of directory)
@param string $extension [OPTIONAL] File extension (empty for directory)
@return... | [
"Creates",
"full",
"pathname",
"to",
"the",
"file",
"/",
"directory",
"based",
"on",
"its",
"path",
"basename",
"and",
"extension"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileInfo.php#L50-L65 |
bocharsky-bw/FileNamingResolver | src/FileInfo.php | FileInfo.purifyPath | public static function purifyPath($path)
{
$path = (string)$path;
$path = trim($path);
$path = rtrim($path, '\\/');
return $path;
} | php | public static function purifyPath($path)
{
$path = (string)$path;
$path = trim($path);
$path = rtrim($path, '\\/');
return $path;
} | [
"public",
"static",
"function",
"purifyPath",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"(",
"string",
")",
"$",
"path",
";",
"$",
"path",
"=",
"trim",
"(",
"$",
"path",
")",
";",
"$",
"path",
"=",
"rtrim",
"(",
"$",
"path",
",",
"'\\\\/'",
... | @param string $path
@return string | [
"@param",
"string",
"$path"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileInfo.php#L72-L79 |
bocharsky-bw/FileNamingResolver | src/FileInfo.php | FileInfo.purifyBasename | public static function purifyBasename($basename)
{
$basename = (string)$basename;
$basename = trim($basename);
$basename = trim($basename, '\\/');
return $basename;
} | php | public static function purifyBasename($basename)
{
$basename = (string)$basename;
$basename = trim($basename);
$basename = trim($basename, '\\/');
return $basename;
} | [
"public",
"static",
"function",
"purifyBasename",
"(",
"$",
"basename",
")",
"{",
"$",
"basename",
"=",
"(",
"string",
")",
"$",
"basename",
";",
"$",
"basename",
"=",
"trim",
"(",
"$",
"basename",
")",
";",
"$",
"basename",
"=",
"trim",
"(",
"$",
"b... | @param string $basename
@return string | [
"@param",
"string",
"$basename"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileInfo.php#L86-L93 |
bocharsky-bw/FileNamingResolver | src/FileInfo.php | FileInfo.purifyExtension | public static function purifyExtension($extension)
{
$extension = (string)$extension;
$extension = trim($extension);
$extension = ltrim($extension, '.');
return $extension;
} | php | public static function purifyExtension($extension)
{
$extension = (string)$extension;
$extension = trim($extension);
$extension = ltrim($extension, '.');
return $extension;
} | [
"public",
"static",
"function",
"purifyExtension",
"(",
"$",
"extension",
")",
"{",
"$",
"extension",
"=",
"(",
"string",
")",
"$",
"extension",
";",
"$",
"extension",
"=",
"trim",
"(",
"$",
"extension",
")",
";",
"$",
"extension",
"=",
"ltrim",
"(",
"... | @param string $extension
@return string | [
"@param",
"string",
"$extension"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileInfo.php#L100-L107 |
bocharsky-bw/FileNamingResolver | src/FileInfo.php | FileInfo.changePath | public function changePath($path)
{
$pathname = $this->createPathname($path, $this->getBasename(), $this->getExtension());
return new static($pathname);
} | php | public function changePath($path)
{
$pathname = $this->createPathname($path, $this->getBasename(), $this->getExtension());
return new static($pathname);
} | [
"public",
"function",
"changePath",
"(",
"$",
"path",
")",
"{",
"$",
"pathname",
"=",
"$",
"this",
"->",
"createPathname",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"getBasename",
"(",
")",
",",
"$",
"this",
"->",
"getExtension",
"(",
")",
")",
";",
... | Changes directory path to the file / directory.
@param string $path
@return FileInfo | [
"Changes",
"directory",
"path",
"to",
"the",
"file",
"/",
"directory",
"."
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileInfo.php#L116-L121 |
bocharsky-bw/FileNamingResolver | src/FileInfo.php | FileInfo.changeBasename | public function changeBasename($basename)
{
$pathname = $this->createPathname($this->getPath(), $basename, $this->getExtension());
return new static($pathname);
} | php | public function changeBasename($basename)
{
$pathname = $this->createPathname($this->getPath(), $basename, $this->getExtension());
return new static($pathname);
} | [
"public",
"function",
"changeBasename",
"(",
"$",
"basename",
")",
"{",
"$",
"pathname",
"=",
"$",
"this",
"->",
"createPathname",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"$",
"basename",
",",
"$",
"this",
"->",
"getExtension",
"(",
")",
")",... | Changes base name of file without extension (or base name of directory).
@param string $basename
@return FileInfo | [
"Changes",
"base",
"name",
"of",
"file",
"without",
"extension",
"(",
"or",
"base",
"name",
"of",
"directory",
")",
"."
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileInfo.php#L130-L135 |
bocharsky-bw/FileNamingResolver | src/FileInfo.php | FileInfo.changeExtension | public function changeExtension($extension)
{
$pathname = $this->createPathname($this->getPath(), $this->getBasename(), $extension);
return new static($pathname);
} | php | public function changeExtension($extension)
{
$pathname = $this->createPathname($this->getPath(), $this->getBasename(), $extension);
return new static($pathname);
} | [
"public",
"function",
"changeExtension",
"(",
"$",
"extension",
")",
"{",
"$",
"pathname",
"=",
"$",
"this",
"->",
"createPathname",
"(",
"$",
"this",
"->",
"getPath",
"(",
")",
",",
"$",
"this",
"->",
"getBasename",
"(",
")",
",",
"$",
"extension",
")... | Changes file extension.
@param string $extension
@return FileInfo | [
"Changes",
"file",
"extension",
"."
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileInfo.php#L144-L149 |
bocharsky-bw/FileNamingResolver | src/FileInfo.php | FileInfo.getPathRelativeTo | public function getPathRelativeTo($basePath)
{
$basePath = $this->purifyPath($basePath).static::SEPARATOR_DIRECTORY;
$relativePath = $this->getPath();
$prefix = mb_substr($relativePath, 0, mb_strlen($basePath));
if ($prefix === $basePath) {
$relativePath = mb_substr($rel... | php | public function getPathRelativeTo($basePath)
{
$basePath = $this->purifyPath($basePath).static::SEPARATOR_DIRECTORY;
$relativePath = $this->getPath();
$prefix = mb_substr($relativePath, 0, mb_strlen($basePath));
if ($prefix === $basePath) {
$relativePath = mb_substr($rel... | [
"public",
"function",
"getPathRelativeTo",
"(",
"$",
"basePath",
")",
"{",
"$",
"basePath",
"=",
"$",
"this",
"->",
"purifyPath",
"(",
"$",
"basePath",
")",
".",
"static",
"::",
"SEPARATOR_DIRECTORY",
";",
"$",
"relativePath",
"=",
"$",
"this",
"->",
"getP... | @param string $basePath
@return string | [
"@param",
"string",
"$basePath"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileInfo.php#L156-L167 |
bocharsky-bw/FileNamingResolver | src/FileInfo.php | FileInfo.getPathnameRelativeTo | public function getPathnameRelativeTo($basePathname)
{
$basePathname = $this->purifyPath($basePathname).static::SEPARATOR_DIRECTORY;
$relativePathname = $this->getPathname();
$prefix = mb_substr($relativePathname, 0, mb_strlen($basePathname));
if ($prefix === $basePathname) {
... | php | public function getPathnameRelativeTo($basePathname)
{
$basePathname = $this->purifyPath($basePathname).static::SEPARATOR_DIRECTORY;
$relativePathname = $this->getPathname();
$prefix = mb_substr($relativePathname, 0, mb_strlen($basePathname));
if ($prefix === $basePathname) {
... | [
"public",
"function",
"getPathnameRelativeTo",
"(",
"$",
"basePathname",
")",
"{",
"$",
"basePathname",
"=",
"$",
"this",
"->",
"purifyPath",
"(",
"$",
"basePathname",
")",
".",
"static",
"::",
"SEPARATOR_DIRECTORY",
";",
"$",
"relativePathname",
"=",
"$",
"th... | @param string $basePathname
@return string | [
"@param",
"string",
"$basePathname"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/FileInfo.php#L174-L185 |
puli/discovery | src/AbstractEditableDiscovery.php | AbstractEditableDiscovery.removeBindings | public function removeBindings($typeName = null, Expression $expr = null)
{
Assert::nullOrStringNotEmpty($typeName, 'The type name must be a non-empty string. Got: %s');
if (null !== $typeName) {
if (null !== $expr) {
$this->removeBindingsWithTypeNameThatMatch($typeName,... | php | public function removeBindings($typeName = null, Expression $expr = null)
{
Assert::nullOrStringNotEmpty($typeName, 'The type name must be a non-empty string. Got: %s');
if (null !== $typeName) {
if (null !== $expr) {
$this->removeBindingsWithTypeNameThatMatch($typeName,... | [
"public",
"function",
"removeBindings",
"(",
"$",
"typeName",
"=",
"null",
",",
"Expression",
"$",
"expr",
"=",
"null",
")",
"{",
"Assert",
"::",
"nullOrStringNotEmpty",
"(",
"$",
"typeName",
",",
"'The type name must be a non-empty string. Got: %s'",
")",
";",
"i... | {@inheritdoc} | [
"{"
] | train | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/AbstractEditableDiscovery.php#L55-L70 |
puli/discovery | src/AbstractEditableDiscovery.php | AbstractEditableDiscovery.hasBindings | public function hasBindings($typeName = null, Expression $expr = null)
{
Assert::nullOrStringNotEmpty($typeName, 'The type class must be a non-empty string. Got: %s');
if (null !== $typeName) {
if (null !== $expr) {
return $this->hasBindingsWithTypeNameThatMatch($typeNam... | php | public function hasBindings($typeName = null, Expression $expr = null)
{
Assert::nullOrStringNotEmpty($typeName, 'The type class must be a non-empty string. Got: %s');
if (null !== $typeName) {
if (null !== $expr) {
return $this->hasBindingsWithTypeNameThatMatch($typeNam... | [
"public",
"function",
"hasBindings",
"(",
"$",
"typeName",
"=",
"null",
",",
"Expression",
"$",
"expr",
"=",
"null",
")",
"{",
"Assert",
"::",
"nullOrStringNotEmpty",
"(",
"$",
"typeName",
",",
"'The type class must be a non-empty string. Got: %s'",
")",
";",
"if"... | {@inheritdoc} | [
"{"
] | train | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/AbstractEditableDiscovery.php#L75-L92 |
puli/discovery | src/AbstractEditableDiscovery.php | AbstractEditableDiscovery.initializeBinding | protected function initializeBinding(Binding $binding)
{
$binding->initialize($this->getBindingType($binding->getTypeName()));
$bindingClass = get_class($binding);
if (!isset($this->initializersByBindingClass[$bindingClass])) {
$this->initializersByBindingClass[$bindingClass] =... | php | protected function initializeBinding(Binding $binding)
{
$binding->initialize($this->getBindingType($binding->getTypeName()));
$bindingClass = get_class($binding);
if (!isset($this->initializersByBindingClass[$bindingClass])) {
$this->initializersByBindingClass[$bindingClass] =... | [
"protected",
"function",
"initializeBinding",
"(",
"Binding",
"$",
"binding",
")",
"{",
"$",
"binding",
"->",
"initialize",
"(",
"$",
"this",
"->",
"getBindingType",
"(",
"$",
"binding",
"->",
"getTypeName",
"(",
")",
")",
")",
";",
"$",
"bindingClass",
"=... | Initializes a binding.
@param Binding $binding The binding to initialize.
@throws BindingNotAcceptedException If the loaded type does not accept
the binding. | [
"Initializes",
"a",
"binding",
"."
] | train | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/AbstractEditableDiscovery.php#L169-L190 |
activecollab/databasestructure | src/Behaviour/AdditionalPropertiesInterface/Implementation.php | Implementation.getAdditionalProperties | public function getAdditionalProperties()
{
if ($this->decoded_additional_properties === false) {
$raw = trim($this->getRawAdditionalProperties());
$this->decoded_additional_properties = empty($raw) ? [] : json_decode($raw, true);
if (!is_array($this->decoded_additional_... | php | public function getAdditionalProperties()
{
if ($this->decoded_additional_properties === false) {
$raw = trim($this->getRawAdditionalProperties());
$this->decoded_additional_properties = empty($raw) ? [] : json_decode($raw, true);
if (!is_array($this->decoded_additional_... | [
"public",
"function",
"getAdditionalProperties",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"decoded_additional_properties",
"===",
"false",
")",
"{",
"$",
"raw",
"=",
"trim",
"(",
"$",
"this",
"->",
"getRawAdditionalProperties",
"(",
")",
")",
";",
"$",
... | Return additional log properties as array.
@return array | [
"Return",
"additional",
"log",
"properties",
"as",
"array",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Behaviour/AdditionalPropertiesInterface/Implementation.php#L28-L40 |
activecollab/databasestructure | src/Behaviour/AdditionalPropertiesInterface/Implementation.php | Implementation.& | public function &setAdditionalProperties(array $value = null)
{
$this->decoded_additional_properties = false; // Reset...
$this->setRawAdditionalProperties(json_encode($value));
return $this;
} | php | public function &setAdditionalProperties(array $value = null)
{
$this->decoded_additional_properties = false; // Reset...
$this->setRawAdditionalProperties(json_encode($value));
return $this;
} | [
"public",
"function",
"&",
"setAdditionalProperties",
"(",
"array",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"decoded_additional_properties",
"=",
"false",
";",
"// Reset...",
"$",
"this",
"->",
"setRawAdditionalProperties",
"(",
"json_encode",
"(",... | Set attributes value.
@param array|null $value
@return $this | [
"Set",
"attributes",
"value",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Behaviour/AdditionalPropertiesInterface/Implementation.php#L48-L55 |
activecollab/databasestructure | src/Behaviour/AdditionalPropertiesInterface/Implementation.php | Implementation.getAdditionalProperty | public function getAdditionalProperty($name, $default = null)
{
$additional_properties = $this->getAdditionalProperties();
return $additional_properties && isset($additional_properties[$name]) ? $additional_properties[$name] : $default;
} | php | public function getAdditionalProperty($name, $default = null)
{
$additional_properties = $this->getAdditionalProperties();
return $additional_properties && isset($additional_properties[$name]) ? $additional_properties[$name] : $default;
} | [
"public",
"function",
"getAdditionalProperty",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"additional_properties",
"=",
"$",
"this",
"->",
"getAdditionalProperties",
"(",
")",
";",
"return",
"$",
"additional_properties",
"&&",
"isset",
... | Returna attribute value.
@param string $name
@param mixed $default
@return mixed | [
"Returna",
"attribute",
"value",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Behaviour/AdditionalPropertiesInterface/Implementation.php#L64-L69 |
activecollab/databasestructure | src/Behaviour/AdditionalPropertiesInterface/Implementation.php | Implementation.& | public function &setAdditionalProperty($name, $value)
{
$additional_properties = $this->getAdditionalProperties();
if ($value === null) {
if (isset($additional_properties[$name])) {
unset($additional_properties[$name]);
}
} else {
$additio... | php | public function &setAdditionalProperty($name, $value)
{
$additional_properties = $this->getAdditionalProperties();
if ($value === null) {
if (isset($additional_properties[$name])) {
unset($additional_properties[$name]);
}
} else {
$additio... | [
"public",
"function",
"&",
"setAdditionalProperty",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"additional_properties",
"=",
"$",
"this",
"->",
"getAdditionalProperties",
"(",
")",
";",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"if",
"("... | Set attribute value.
@param string $name
@param mixed $value
@return $this | [
"Set",
"attribute",
"value",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Behaviour/AdditionalPropertiesInterface/Implementation.php#L78-L93 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Traits/CheckFloatTypes.php | CheckFloatTypes.checkFloatTypes | protected function checkFloatTypes(NumericTypeInterface $a, NumericTypeInterface $b)
{
$a1 = ($a instanceof FloatType ? $a : $a->asFloatType());
$b1 = ($b instanceof FloatType ? $b : $b->asFloatType());
return [$a1, $b1];
} | php | protected function checkFloatTypes(NumericTypeInterface $a, NumericTypeInterface $b)
{
$a1 = ($a instanceof FloatType ? $a : $a->asFloatType());
$b1 = ($b instanceof FloatType ? $b : $b->asFloatType());
return [$a1, $b1];
} | [
"protected",
"function",
"checkFloatTypes",
"(",
"NumericTypeInterface",
"$",
"a",
",",
"NumericTypeInterface",
"$",
"b",
")",
"{",
"$",
"a1",
"=",
"(",
"$",
"a",
"instanceof",
"FloatType",
"?",
"$",
"a",
":",
"$",
"a",
"->",
"asFloatType",
"(",
")",
")"... | Check for float type, converting if necessary
@param NumericTypeInterface $a
@param NumericTypeInterface $b
@return array [FloatType, FloatType] | [
"Check",
"for",
"float",
"type",
"converting",
"if",
"necessary"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Traits/CheckFloatTypes.php#L27-L33 |
chippyash/Math-Type-Calculator | src/Chippyash/Math/Type/Traits/CheckRationalTypes.php | CheckRationalTypes.checkRationalTypes | protected function checkRationalTypes(NumericTypeInterface $a, NumericTypeInterface $b)
{
$a1 = ($a instanceof RationalType ? $a : $a->asRational());
$b1 = ($b instanceof RationalType ? $b : $b->asRational());
return [$a1, $b1];
} | php | protected function checkRationalTypes(NumericTypeInterface $a, NumericTypeInterface $b)
{
$a1 = ($a instanceof RationalType ? $a : $a->asRational());
$b1 = ($b instanceof RationalType ? $b : $b->asRational());
return [$a1, $b1];
} | [
"protected",
"function",
"checkRationalTypes",
"(",
"NumericTypeInterface",
"$",
"a",
",",
"NumericTypeInterface",
"$",
"b",
")",
"{",
"$",
"a1",
"=",
"(",
"$",
"a",
"instanceof",
"RationalType",
"?",
"$",
"a",
":",
"$",
"a",
"->",
"asRational",
"(",
")",
... | Check for rational type, converting if necessary
@param NumericTypeInterface $a
@param NumericTypeInterface $b
@return array [RationalType, RationalType] | [
"Check",
"for",
"rational",
"type",
"converting",
"if",
"necessary"
] | train | https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Traits/CheckRationalTypes.php#L28-L34 |
awesomite/chariot | src/Pattern/PatternRoute.php | PatternRoute.processTokens | private function processTokens()
{
foreach ($this->getTokensStream() as list($string, $name, $pattern, $default)) {
if (!\preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
throw new InvalidArgumentException("Invalid param name “{$name}” (source: {$this->pattern})");
}
... | php | private function processTokens()
{
foreach ($this->getTokensStream() as list($string, $name, $pattern, $default)) {
if (!\preg_match('/^[a-zA-Z0-9_]+$/', $name)) {
throw new InvalidArgumentException("Invalid param name “{$name}” (source: {$this->pattern})");
}
... | [
"private",
"function",
"processTokens",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getTokensStream",
"(",
")",
"as",
"list",
"(",
"$",
"string",
",",
"$",
"name",
",",
"$",
"pattern",
",",
"$",
"default",
")",
")",
"{",
"if",
"(",
"!",
"\\"... | Validates, change pattern name to regex and add pattern's name or null
e.g. ['{{ month :int }}', 'name', '(-?[1-9][0-9]*)|0', null, ':int']
@return \Generator | [
"Validates",
"change",
"pattern",
"name",
"to",
"regex",
"and",
"add",
"pattern",
"s",
"name",
"or",
"null"
] | train | https://github.com/awesomite/chariot/blob/3229e38537b857be1d352308ba340dc530b12afb/src/Pattern/PatternRoute.php#L132-L160 |
awesomite/chariot | src/Pattern/PatternRoute.php | PatternRoute.getTokensStream | private function getTokensStream()
{
$matches = [];
\preg_match_all(static::PATTERN_VAR, $this->pattern, $matches);
foreach ($matches[0] ?? [] as $match) {
$arr = $this->paramStrToArr($match);
if (\count($arr) > 3) {
throw new InvalidArgumentException... | php | private function getTokensStream()
{
$matches = [];
\preg_match_all(static::PATTERN_VAR, $this->pattern, $matches);
foreach ($matches[0] ?? [] as $match) {
$arr = $this->paramStrToArr($match);
if (\count($arr) > 3) {
throw new InvalidArgumentException... | [
"private",
"function",
"getTokensStream",
"(",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"\\",
"preg_match_all",
"(",
"static",
"::",
"PATTERN_VAR",
",",
"$",
"this",
"->",
"pattern",
",",
"$",
"matches",
")",
";",
"foreach",
"(",
"$",
"matches",
"... | e.g. [
// [text, name, pattern, default]
['{{ month :int }}', 'month', ':int', null],
]
@return \Generator | [
"e",
".",
"g",
".",
"[",
"//",
"[",
"text",
"name",
"pattern",
"default",
"]",
"[",
"{{",
"month",
":",
"int",
"}}",
"month",
":",
"int",
"null",
"]",
"]"
] | train | https://github.com/awesomite/chariot/blob/3229e38537b857be1d352308ba340dc530b12afb/src/Pattern/PatternRoute.php#L170-L192 |
awesomite/chariot | src/Pattern/PatternRoute.php | PatternRoute.paramStrToArr | private function paramStrToArr(string $paramString)
{
$str = \substr($paramString, 2, -2);
$result = \array_filter(\preg_split('/\\s+/', $str), function ($a) {
return '' !== \trim($a);
});
$result = \array_values($result);
if (!\in_array(\strpos($result[0], ':'),... | php | private function paramStrToArr(string $paramString)
{
$str = \substr($paramString, 2, -2);
$result = \array_filter(\preg_split('/\\s+/', $str), function ($a) {
return '' !== \trim($a);
});
$result = \array_values($result);
if (!\in_array(\strpos($result[0], ':'),... | [
"private",
"function",
"paramStrToArr",
"(",
"string",
"$",
"paramString",
")",
"{",
"$",
"str",
"=",
"\\",
"substr",
"(",
"$",
"paramString",
",",
"2",
",",
"-",
"2",
")",
";",
"$",
"result",
"=",
"\\",
"array_filter",
"(",
"\\",
"preg_split",
"(",
... | @param string $paramString e.g. {{ id :int }}
@return string[] e.g. ['id', 'int'] | [
"@param",
"string",
"$paramString",
"e",
".",
"g",
".",
"{{",
"id",
":",
"int",
"}}"
] | train | https://github.com/awesomite/chariot/blob/3229e38537b857be1d352308ba340dc530b12afb/src/Pattern/PatternRoute.php#L199-L215 |
awesomite/chariot | src/Pattern/PatternRoute.php | PatternRoute.matchParams | public function matchParams(array $params)
{
$result = [];
foreach ($this->explodedParams as $name => list($default, $pattern, $patternName)) {
if (!\array_key_exists($name, $params)) {
if (\is_null($default)) {
return false;
}
... | php | public function matchParams(array $params)
{
$result = [];
foreach ($this->explodedParams as $name => list($default, $pattern, $patternName)) {
if (!\array_key_exists($name, $params)) {
if (\is_null($default)) {
return false;
}
... | [
"public",
"function",
"matchParams",
"(",
"array",
"$",
"params",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"explodedParams",
"as",
"$",
"name",
"=>",
"list",
"(",
"$",
"default",
",",
"$",
"pattern",
",",
"$",
... | Returns false or converted params
@param string[] $params
@return bool|array | [
"Returns",
"false",
"or",
"converted",
"params"
] | train | https://github.com/awesomite/chariot/blob/3229e38537b857be1d352308ba340dc530b12afb/src/Pattern/PatternRoute.php#L255-L288 |
FrenchFrogs/framework | src/Laravel/Support/Facades/Schema.php | Schema.getSchemaBuilder | static public function getSchemaBuilder($connection)
{
if (get_class($connection) === 'Illuminate\Database\MySqlConnection') {
/** @var \Illuminate\Database\MySqlConnection $connection */
$MySqlGrammar = $connection->withTablePrefix(new MySqlGrammar);
$connection->setSch... | php | static public function getSchemaBuilder($connection)
{
if (get_class($connection) === 'Illuminate\Database\MySqlConnection') {
/** @var \Illuminate\Database\MySqlConnection $connection */
$MySqlGrammar = $connection->withTablePrefix(new MySqlGrammar);
$connection->setSch... | [
"static",
"public",
"function",
"getSchemaBuilder",
"(",
"$",
"connection",
")",
"{",
"if",
"(",
"get_class",
"(",
"$",
"connection",
")",
"===",
"'Illuminate\\Database\\MySqlConnection'",
")",
"{",
"/** @var \\Illuminate\\Database\\MySqlConnection $connection */",
"$",
"... | Get a schema builder instance for the connection.
@param $connection \Illuminate\Database\Connection
@return \FrenchFrogs\Laravel\Database\Schema\MysqlBuilder | [
"Get",
"a",
"schema",
"builder",
"instance",
"for",
"the",
"connection",
"."
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Laravel/Support/Facades/Schema.php#L27-L38 |
mnapoli/assembly | src/Container/DefinitionResolver.php | DefinitionResolver.resolve | public function resolve(DefinitionInterface $definition)
{
switch (true) {
case $definition instanceof ReferenceDefinitionInterface:
return $this->container->get($definition->getTarget());
case $definition instanceof ParameterDefinitionInterface:
retu... | php | public function resolve(DefinitionInterface $definition)
{
switch (true) {
case $definition instanceof ReferenceDefinitionInterface:
return $this->container->get($definition->getTarget());
case $definition instanceof ParameterDefinitionInterface:
retu... | [
"public",
"function",
"resolve",
"(",
"DefinitionInterface",
"$",
"definition",
")",
"{",
"switch",
"(",
"true",
")",
"{",
"case",
"$",
"definition",
"instanceof",
"ReferenceDefinitionInterface",
":",
"return",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
... | Resolve a definition and return the resulting value.
@param DefinitionInterface $definition
@return mixed
@throws UnsupportedDefinition
@throws InvalidDefinition
@throws EntryNotFound A dependency was not found. | [
"Resolve",
"a",
"definition",
"and",
"return",
"the",
"resulting",
"value",
"."
] | train | https://github.com/mnapoli/assembly/blob/bdaff7455d34958f2c2a5a3379de3d88b567b9fc/src/Container/DefinitionResolver.php#L38-L87 |
mnapoli/assembly | src/Container/DefinitionResolver.php | DefinitionResolver.resolveSubDefinition | private function resolveSubDefinition($value)
{
if (is_array($value)) {
return array_map([$this, 'resolveSubDefinition'], $value);
} elseif ($value instanceof DefinitionInterface) {
return $this->resolve($value);
}
return $value;
} | php | private function resolveSubDefinition($value)
{
if (is_array($value)) {
return array_map([$this, 'resolveSubDefinition'], $value);
} elseif ($value instanceof DefinitionInterface) {
return $this->resolve($value);
}
return $value;
} | [
"private",
"function",
"resolveSubDefinition",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"array_map",
"(",
"[",
"$",
"this",
",",
"'resolveSubDefinition'",
"]",
",",
"$",
"value",
")",
";",
"}",
"el... | Resolve a variable that can be a sub-definition.
@param mixed|DefinitionInterface $value
@return mixed | [
"Resolve",
"a",
"variable",
"that",
"can",
"be",
"a",
"sub",
"-",
"definition",
"."
] | train | https://github.com/mnapoli/assembly/blob/bdaff7455d34958f2c2a5a3379de3d88b567b9fc/src/Container/DefinitionResolver.php#L95-L104 |
jan-dolata/crude-crud | src/Http/Requests/CustomActionRequest.php | CustomActionRequest.authorize | public function authorize()
{
$crude = CrudeInstance::get($this->crudeName);
if ($crude == null)
return false;
if ($crude->cannotView())
return false;
$model = $crude->getById($this->id);
$permission = $this->action . 'CustomActionPermission';
... | php | public function authorize()
{
$crude = CrudeInstance::get($this->crudeName);
if ($crude == null)
return false;
if ($crude->cannotView())
return false;
$model = $crude->getById($this->id);
$permission = $this->action . 'CustomActionPermission';
... | [
"public",
"function",
"authorize",
"(",
")",
"{",
"$",
"crude",
"=",
"CrudeInstance",
"::",
"get",
"(",
"$",
"this",
"->",
"crudeName",
")",
";",
"if",
"(",
"$",
"crude",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"$",
"crude",
"->",
"ca... | Determine if the user is authorized to make this request.
@return bool | [
"Determine",
"if",
"the",
"user",
"is",
"authorized",
"to",
"make",
"this",
"request",
"."
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Http/Requests/CustomActionRequest.php#L16-L40 |
drmvc/framework | src/Framework/Containers.php | Containers.set | public function set(string $container, $object, ConfigInterface $config = null): ContainersInterface
{
if (!$this->has($container)) {
if (\is_object($object)) {
$this->setContainer($container, $object);
} else {
$class = '\\DrMVC\\' . $object;
... | php | public function set(string $container, $object, ConfigInterface $config = null): ContainersInterface
{
if (!$this->has($container)) {
if (\is_object($object)) {
$this->setContainer($container, $object);
} else {
$class = '\\DrMVC\\' . $object;
... | [
"public",
"function",
"set",
"(",
"string",
"$",
"container",
",",
"$",
"object",
",",
"ConfigInterface",
"$",
"config",
"=",
"null",
")",
":",
"ContainersInterface",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"container",
")",
")",
"{",
... | PSR-11 set container
@param string $container
@param string|object $object
@param ConfigInterface $config
@return ContainersInterface | [
"PSR",
"-",
"11",
"set",
"container"
] | train | https://github.com/drmvc/framework/blob/6a49aa4e0314b37343a95d7c8ac5d10f72b45d71/src/Framework/Containers.php#L47-L58 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/Router.php | Router.rewrite | function rewrite($route, $action = 'index.php', $options = [])
{
if (is_string($options)) {
$options = [ 'after' => $options ];
} else if (!is_array($options)) {
$options = [];
}
$defaults = [
'permission_callback' => $this->defaultPermissionCallback,
];
$options = array_merge($defaults, $opt... | php | function rewrite($route, $action = 'index.php', $options = [])
{
if (is_string($options)) {
$options = [ 'after' => $options ];
} else if (!is_array($options)) {
$options = [];
}
$defaults = [
'permission_callback' => $this->defaultPermissionCallback,
];
$options = array_merge($defaults, $opt... | [
"function",
"rewrite",
"(",
"$",
"route",
",",
"$",
"action",
"=",
"'index.php'",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"options",
")",
")",
"{",
"$",
"options",
"=",
"[",
"'after'",
"=>",
"$",
"options",
... | Create a new Rewrite rule, either by mapping the matching
components of a regular expression onto the query args submitted
to index.php (the default rewrite mechanism), or by invoking
a callable in response to a matching URL.
@param String The route for matching URLs; can include regex, but we'll also
substitute any {a... | [
"Create",
"a",
"new",
"Rewrite",
"rule",
"either",
"by",
"mapping",
"the",
"matching",
"components",
"of",
"a",
"regular",
"expression",
"onto",
"the",
"query",
"args",
"submitted",
"to",
"index",
".",
"php",
"(",
"the",
"default",
"rewrite",
"mechanism",
")... | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/Router.php#L208-L224 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/Router.php | Router.getControllerClass | protected function getControllerClass($name)
{
$controllerClass = $name;
if (!class_exists($name)) {
$controllerClass = $this->controllerClasspath . '\\' . $name;
if (!class_exists($controllerClass)) {
$controllerClass = '\\FatPanda\\Illuminate\\WordPress\\Http\\Controllers\\' . $name;
if (!class_exi... | php | protected function getControllerClass($name)
{
$controllerClass = $name;
if (!class_exists($name)) {
$controllerClass = $this->controllerClasspath . '\\' . $name;
if (!class_exists($controllerClass)) {
$controllerClass = '\\FatPanda\\Illuminate\\WordPress\\Http\\Controllers\\' . $name;
if (!class_exi... | [
"protected",
"function",
"getControllerClass",
"(",
"$",
"name",
")",
"{",
"$",
"controllerClass",
"=",
"$",
"name",
";",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"name",
")",
")",
"{",
"$",
"controllerClass",
"=",
"$",
"this",
"->",
"controllerClasspath"... | Given the classname of a controller, seek out a proper
namespace; start with the set controller classpath, then
move on to the core default, then try looking for the
class without any classpath at all.
@return The fully-qualified classpath, or, if not found, a
WP_Error object | [
"Given",
"the",
"classname",
"of",
"a",
"controller",
"seek",
"out",
"a",
"proper",
"namespace",
";",
"start",
"with",
"the",
"set",
"controller",
"classpath",
"then",
"move",
"on",
"to",
"the",
"core",
"default",
"then",
"try",
"looking",
"for",
"the",
"c... | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/Router.php#L270-L284 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/Router.php | Router.invokeControllerAction | private function invokeControllerAction($controllerClassNamed, $actionNamed, array $givenArgs = [])
{
if (is_wp_error($controllerClass = $this->getControllerClass($controllerClassNamed))) {
return $controllerClass;
}
$reflection = new \ReflectionClass($controllerClass);
$controller = new $controllerClass($t... | php | private function invokeControllerAction($controllerClassNamed, $actionNamed, array $givenArgs = [])
{
if (is_wp_error($controllerClass = $this->getControllerClass($controllerClassNamed))) {
return $controllerClass;
}
$reflection = new \ReflectionClass($controllerClass);
$controller = new $controllerClass($t... | [
"private",
"function",
"invokeControllerAction",
"(",
"$",
"controllerClassNamed",
",",
"$",
"actionNamed",
",",
"array",
"$",
"givenArgs",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_wp_error",
"(",
"$",
"controllerClass",
"=",
"$",
"this",
"->",
"getControllerCl... | Invoke the given action on the given class, after resolving
an existing Class that matches the given class as named; map
arguments to controller action by dependency injection.
@param String The name of a controller to invoke; presumed to be taken from routes config
@param String The name of the action to invoke; must ... | [
"Invoke",
"the",
"given",
"action",
"on",
"the",
"given",
"class",
"after",
"resolving",
"an",
"existing",
"Class",
"that",
"matches",
"the",
"given",
"class",
"as",
"named",
";",
"map",
"arguments",
"to",
"controller",
"action",
"by",
"dependency",
"injection... | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/Router.php#L296-L342 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/Router.php | Router.route | function route($method, $route, $callback = null, $options = [])
{
if (did_action('rest_api_init') || did_action('process_request')) {
throw new \Exception("Too late to create new routes");
}
// treat strings, when not callable, as "Controller@method"
if (is_string($callback) && !is_callable($callback)) {... | php | function route($method, $route, $callback = null, $options = [])
{
if (did_action('rest_api_init') || did_action('process_request')) {
throw new \Exception("Too late to create new routes");
}
// treat strings, when not callable, as "Controller@method"
if (is_string($callback) && !is_callable($callback)) {... | [
"function",
"route",
"(",
"$",
"method",
",",
"$",
"route",
",",
"$",
"callback",
"=",
"null",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"did_action",
"(",
"'rest_api_init'",
")",
"||",
"did_action",
"(",
"'process_request'",
")",
")",
... | Create a new route; note, you should probably use Router::resource()
or Router::api() instead.
@param String Comma-separated list of request methods, e.g., 'GET, POST'
@param String The URL path
@param mixed A callable
@param array Options that get passed through to register_rest_route(); note
that Router and Router of... | [
"Create",
"a",
"new",
"route",
";",
"note",
"you",
"should",
"probably",
"use",
"Router",
"::",
"resource",
"()",
"or",
"Router",
"::",
"api",
"()",
"instead",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/Router.php#L357-L393 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/Router.php | Router.substituteUrlArgTokens | static function substituteUrlArgTokens($route)
{
$orig = $route;
$tokens = [];
// look for things like this {id} and like this {id?},
// optionally preceeded by a forward slash
while(preg_match('#/?({([\w\_]+)\??})#i', $route, $matches)) {
// get the argument name:
$arg = $matches[2];
$tokens[] = $... | php | static function substituteUrlArgTokens($route)
{
$orig = $route;
$tokens = [];
// look for things like this {id} and like this {id?},
// optionally preceeded by a forward slash
while(preg_match('#/?({([\w\_]+)\??})#i', $route, $matches)) {
// get the argument name:
$arg = $matches[2];
$tokens[] = $... | [
"static",
"function",
"substituteUrlArgTokens",
"(",
"$",
"route",
")",
"{",
"$",
"orig",
"=",
"$",
"route",
";",
"$",
"tokens",
"=",
"[",
"]",
";",
"// look for things like this {id} and like this {id?},",
"// optionally preceeded by a forward slash",
"while",
"(",
"... | Transform {arg} into regular expression garbage.
@param string The route, expressed with mustache-wrapped args
@return string Regular expression garbage... yay. | [
"Transform",
"{",
"arg",
"}",
"into",
"regular",
"expression",
"garbage",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/Router.php#L470-L497 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/Router.php | Router.api | function api($name, $controllerClass, $options = [])
{
$options = array_merge(
['only' => ['index', 'show', 'store', 'update', 'destroy']],
$options
);
return $this->resource($name, $controllerClass, $options);
} | php | function api($name, $controllerClass, $options = [])
{
$options = array_merge(
['only' => ['index', 'show', 'store', 'update', 'destroy']],
$options
);
return $this->resource($name, $controllerClass, $options);
} | [
"function",
"api",
"(",
"$",
"name",
",",
"$",
"controllerClass",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"options",
"=",
"array_merge",
"(",
"[",
"'only'",
"=>",
"[",
"'index'",
",",
"'show'",
",",
"'store'",
",",
"'update'",
",",
"'destr... | Create a resource endpoint set, bound to the given controller
for handling all requests, but with just the basic state-change
operations + index: index, show, store, update and destory.
@param String The name for the resource, e.g., "photo"; this becomes
the base for each REST route, e.g., "photo/{photo}"
@param String... | [
"Create",
"a",
"resource",
"endpoint",
"set",
"bound",
"to",
"the",
"given",
"controller",
"for",
"handling",
"all",
"requests",
"but",
"with",
"just",
"the",
"basic",
"state",
"-",
"change",
"operations",
"+",
"index",
":",
"index",
"show",
"store",
"update... | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/Router.php#L513-L520 |
withfatpanda/illuminate-wordpress | src/WordPress/Http/Router.php | Router.resource | function resource($name, $controllerClass, $options = [])
{
if (empty($options['idString'])) {
$options['idString'] = '{id}'; // == (?P<id>.+?)";
}
// by default, create routes for all known actions
$actions = array_keys($this->resourceActions);
if (!empty($options['only'])) {
$actions = $options['... | php | function resource($name, $controllerClass, $options = [])
{
if (empty($options['idString'])) {
$options['idString'] = '{id}'; // == (?P<id>.+?)";
}
// by default, create routes for all known actions
$actions = array_keys($this->resourceActions);
if (!empty($options['only'])) {
$actions = $options['... | [
"function",
"resource",
"(",
"$",
"name",
",",
"$",
"controllerClass",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"options",
"[",
"'idString'",
"]",
")",
")",
"{",
"$",
"options",
"[",
"'idString'",
"]",
"=",
"'{id}... | Create a resource endpoint set, bound to the given controller
for handling all requests
@param String The name for the resource, e.g., "photo"; this becomes
the base for each REST route, e.g., "photo/{photo}"
@param String The class name or class object of the Controller
that should be used to handle the routes; pro-ti... | [
"Create",
"a",
"resource",
"endpoint",
"set",
"bound",
"to",
"the",
"given",
"controller",
"for",
"handling",
"all",
"requests"
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/WordPress/Http/Router.php#L539-L591 |
baleen/cli | src/Provider/ConfigProvider.php | ConfigProvider.register | public function register()
{
$baseDir = getcwd();
$baleenBaseDir = $this->getContainer()->get(Services::BALEEN_BASE_DIR);
$this->getContainer()->singleton(Services::CONFIG_STORAGE, function () use ($baseDir, $baleenBaseDir) {
$configFiles = glob(implode(DIRECTORY_SEPARATOR, [$bal... | php | public function register()
{
$baseDir = getcwd();
$baleenBaseDir = $this->getContainer()->get(Services::BALEEN_BASE_DIR);
$this->getContainer()->singleton(Services::CONFIG_STORAGE, function () use ($baseDir, $baleenBaseDir) {
$configFiles = glob(implode(DIRECTORY_SEPARATOR, [$bal... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"baseDir",
"=",
"getcwd",
"(",
")",
";",
"$",
"baleenBaseDir",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
"->",
"get",
"(",
"Services",
"::",
"BALEEN_BASE_DIR",
")",
";",
"$",
"this",
"->",
... | Use the register method to register items with the container via the
protected $this->container property or the `getContainer` method
from the ContainerAwareTrait. | [
"Use",
"the",
"register",
"method",
"to",
"register",
"items",
"with",
"the",
"container",
"via",
"the",
"protected",
"$this",
"-",
">",
"container",
"property",
"or",
"the",
"getContainer",
"method",
"from",
"the",
"ContainerAwareTrait",
"."
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/Provider/ConfigProvider.php#L46-L62 |
heyday/heystack | src/State/Traits/DataObjectSerializableTrait.php | DataObjectSerializableTrait.unserialize | public function unserialize($data)
{
$injector = \Injector::inst();
$extraData = null;
if (empty(self::$objectConstructorReflectionMethods[__CLASS__])) {
self::$objectConstructorReflectionMethods[__CLASS__] = new \ReflectionMethod(__CLASS__, '__construct');
}
i... | php | public function unserialize($data)
{
$injector = \Injector::inst();
$extraData = null;
if (empty(self::$objectConstructorReflectionMethods[__CLASS__])) {
self::$objectConstructorReflectionMethods[__CLASS__] = new \ReflectionMethod(__CLASS__, '__construct');
}
i... | [
"public",
"function",
"unserialize",
"(",
"$",
"data",
")",
"{",
"$",
"injector",
"=",
"\\",
"Injector",
"::",
"inst",
"(",
")",
";",
"$",
"extraData",
"=",
"null",
";",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"objectConstructorReflectionMethods",
"[... | This routine simulates what would happen when a object is constructed
@param string $data
@return void | [
"This",
"routine",
"simulates",
"what",
"would",
"happen",
"when",
"a",
"object",
"is",
"constructed"
] | train | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/State/Traits/DataObjectSerializableTrait.php#L41-L81 |
stubbles/stubbles-webapp-core | src/main/php/routing/api/Links.php | Links.add | public function add(string $rel, HttpUri $uri): Link
{
$link = new Link($rel, $uri);
if (isset($this->links[$rel])) {
if (!is_array($this->links[$rel])) {
$this->links[$rel] = [$this->links[$rel]];
}
$this->links[$rel][] = $link;
} else {
... | php | public function add(string $rel, HttpUri $uri): Link
{
$link = new Link($rel, $uri);
if (isset($this->links[$rel])) {
if (!is_array($this->links[$rel])) {
$this->links[$rel] = [$this->links[$rel]];
}
$this->links[$rel][] = $link;
} else {
... | [
"public",
"function",
"add",
"(",
"string",
"$",
"rel",
",",
"HttpUri",
"$",
"uri",
")",
":",
"Link",
"{",
"$",
"link",
"=",
"new",
"Link",
"(",
"$",
"rel",
",",
"$",
"uri",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"links",
"[",
... | adds link to collection of links
@param string $rel
@param \stubbles\peer\http\HttpUri $uri
@return \stubbles\webapp\routing\api\Link | [
"adds",
"link",
"to",
"collection",
"of",
"links"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/api/Links.php#L53-L67 |
stubbles/stubbles-webapp-core | src/main/php/routing/api/Links.php | Links.with | public function with(string $rel): array
{
if (isset($this->links[$rel])) {
if (is_array($this->links[$rel])) {
return $this->links[$rel];
}
return [$this->links[$rel]];
}
return [];
} | php | public function with(string $rel): array
{
if (isset($this->links[$rel])) {
if (is_array($this->links[$rel])) {
return $this->links[$rel];
}
return [$this->links[$rel]];
}
return [];
} | [
"public",
"function",
"with",
"(",
"string",
"$",
"rel",
")",
":",
"array",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"links",
"[",
"$",
"rel",
"]",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"links",
"[",
"$",
"rel",
... | returns all links with given relation
@param string $rel
@return \stubbles\webapp\routing\api\Link[] | [
"returns",
"all",
"links",
"with",
"given",
"relation"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/api/Links.php#L75-L86 |
stubbles/stubbles-webapp-core | src/main/php/routing/api/Links.php | Links.getIterator | public function getIterator(): \Traversable
{
$result = [];
foreach ($this->links as $link) {
if (is_array($link)) {
$result = array_merge($result, $link);
} else {
$result[] = $link;
}
}
return new \ArrayIterator($... | php | public function getIterator(): \Traversable
{
$result = [];
foreach ($this->links as $link) {
if (is_array($link)) {
$result = array_merge($result, $link);
} else {
$result[] = $link;
}
}
return new \ArrayIterator($... | [
"public",
"function",
"getIterator",
"(",
")",
":",
"\\",
"Traversable",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"links",
"as",
"$",
"link",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"link",
")",
")",
"{",
"$",... | allows to iterate over all resources
@return \Traversable | [
"allows",
"to",
"iterate",
"over",
"all",
"resources"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/api/Links.php#L93-L105 |
yosmanyga/resource | src/Yosmanyga/Resource/Normalizer/SuddenAnnotationFileDelegatorNormalizer.php | SuddenAnnotationFileDelegatorNormalizer.supports | public function supports($data, Resource $resource)
{
if ($resource->hasType('type') && 'annotation' == $resource->getType()) {
return true;
}
return false;
} | php | public function supports($data, Resource $resource)
{
if ($resource->hasType('type') && 'annotation' == $resource->getType()) {
return true;
}
return false;
} | [
"public",
"function",
"supports",
"(",
"$",
"data",
",",
"Resource",
"$",
"resource",
")",
"{",
"if",
"(",
"$",
"resource",
"->",
"hasType",
"(",
"'type'",
")",
"&&",
"'annotation'",
"==",
"$",
"resource",
"->",
"getType",
"(",
")",
")",
"{",
"return",... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Normalizer/SuddenAnnotationFileDelegatorNormalizer.php#L12-L19 |
aindong/pluggables | src/Aindong/Pluggables/PluggablesServiceProvider.php | PluggablesServiceProvider.register | public function register()
{
// Merge our config file with the application's copy of config file, to allow user to
// just override the configuration that they wanted to make and keep the defaults that are
// not touched
$this->mergeConfigFrom(
__DIR__.'/../../config/plug... | php | public function register()
{
// Merge our config file with the application's copy of config file, to allow user to
// just override the configuration that they wanted to make and keep the defaults that are
// not touched
$this->mergeConfigFrom(
__DIR__.'/../../config/plug... | [
"public",
"function",
"register",
"(",
")",
"{",
"// Merge our config file with the application's copy of config file, to allow user to",
"// just override the configuration that they wanted to make and keep the defaults that are",
"// not touched",
"$",
"this",
"->",
"mergeConfigFrom",
"(... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/PluggablesServiceProvider.php#L35-L57 |
aindong/pluggables | src/Aindong/Pluggables/PluggablesServiceProvider.php | PluggablesServiceProvider.registerServices | private function registerServices()
{
$this->app->singleton('pluggables', function ($app) {
return new Pluggables($app['config'], $app['files']);
});
$this->app->booting(function ($app) {
$app['pluggables']->register();
});
} | php | private function registerServices()
{
$this->app->singleton('pluggables', function ($app) {
return new Pluggables($app['config'], $app['files']);
});
$this->app->booting(function ($app) {
$app['pluggables']->register();
});
} | [
"private",
"function",
"registerServices",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'pluggables'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"Pluggables",
"(",
"$",
"app",
"[",
"'config'",
"]",
",",
"$",
"app... | Register services of the package.
@return void | [
"Register",
"services",
"of",
"the",
"package",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/PluggablesServiceProvider.php#L74-L83 |
aindong/pluggables | src/Aindong/Pluggables/PluggablesServiceProvider.php | PluggablesServiceProvider.registerRepository | private function registerRepository()
{
$this->app->singleton('migration.repository', function ($app) {
$table = $app['config']['database.migrations'];
return new DatabaseMigrationRepository($app['db'], $table);
});
} | php | private function registerRepository()
{
$this->app->singleton('migration.repository', function ($app) {
$table = $app['config']['database.migrations'];
return new DatabaseMigrationRepository($app['db'], $table);
});
} | [
"private",
"function",
"registerRepository",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'migration.repository'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"table",
"=",
"$",
"app",
"[",
"'config'",
"]",
"[",
"'database.migrati... | Register the repository service. | [
"Register",
"the",
"repository",
"service",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/PluggablesServiceProvider.php#L88-L95 |
aindong/pluggables | src/Aindong/Pluggables/PluggablesServiceProvider.php | PluggablesServiceProvider.registerConsoleCommands | private function registerConsoleCommands()
{
$this->registerMakeCommand();
$this->registerEnableCommand();
$this->registerDisableCommand();
$this->registerListCommand();
$this->registerMigrateCommand();
$this->registerMigrateRefreshCommand();
$this->registerMa... | php | private function registerConsoleCommands()
{
$this->registerMakeCommand();
$this->registerEnableCommand();
$this->registerDisableCommand();
$this->registerListCommand();
$this->registerMigrateCommand();
$this->registerMigrateRefreshCommand();
$this->registerMa... | [
"private",
"function",
"registerConsoleCommands",
"(",
")",
"{",
"$",
"this",
"->",
"registerMakeCommand",
"(",
")",
";",
"$",
"this",
"->",
"registerEnableCommand",
"(",
")",
";",
"$",
"this",
"->",
"registerDisableCommand",
"(",
")",
";",
"$",
"this",
"->"... | Register the package console commands.
@return void | [
"Register",
"the",
"package",
"console",
"commands",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/PluggablesServiceProvider.php#L116-L139 |
aindong/pluggables | src/Aindong/Pluggables/PluggablesServiceProvider.php | PluggablesServiceProvider.registerMakeCommand | protected function registerMakeCommand()
{
$this->app->singleton('pluggables.make', function ($app) {
$handler = new Handlers\PluggableMakeHandler($app['pluggables'], $app['files']);
return new Console\PluggableMakeCommand($handler);
});
} | php | protected function registerMakeCommand()
{
$this->app->singleton('pluggables.make', function ($app) {
$handler = new Handlers\PluggableMakeHandler($app['pluggables'], $app['files']);
return new Console\PluggableMakeCommand($handler);
});
} | [
"protected",
"function",
"registerMakeCommand",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'pluggables.make'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"handler",
"=",
"new",
"Handlers",
"\\",
"PluggableMakeHandler",
"(",
"$",
... | Register the "pluggables:make" console command.
@return Console\PluggableMakeCommand | [
"Register",
"the",
"pluggables",
":",
"make",
"console",
"command",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/PluggablesServiceProvider.php#L148-L155 |
aindong/pluggables | src/Aindong/Pluggables/PluggablesServiceProvider.php | PluggablesServiceProvider.registerMakeMigrationCommand | protected function registerMakeMigrationCommand()
{
$this->app->singleton('pluggables.makeMigration', function ($app) {
$handler = new Handlers\PluggableMakeMigrationHandler($app['pluggables'], $app['files']);
return new Console\PluggableMakeMigrationCommand($handler);
});
... | php | protected function registerMakeMigrationCommand()
{
$this->app->singleton('pluggables.makeMigration', function ($app) {
$handler = new Handlers\PluggableMakeMigrationHandler($app['pluggables'], $app['files']);
return new Console\PluggableMakeMigrationCommand($handler);
});
... | [
"protected",
"function",
"registerMakeMigrationCommand",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'pluggables.makeMigration'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"handler",
"=",
"new",
"Handlers",
"\\",
"PluggableMakeMigrat... | Register the "pluggables:make:migration" console command.
@return Console\PluggableMakeMigrationCommand | [
"Register",
"the",
"pluggables",
":",
"make",
":",
"migration",
"console",
"command",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/PluggablesServiceProvider.php#L217-L224 |
aindong/pluggables | src/Aindong/Pluggables/PluggablesServiceProvider.php | PluggablesServiceProvider.registerMakeRequestCommand | protected function registerMakeRequestCommand()
{
$this->app->singleton('pluggables.make.request', function ($app) {
$handler = new Handlers\PluggableMakeRequestHandler($app['pluggables'], $app['files']);
return new Console\PluggableMakeRequestCommand($handler);
});
} | php | protected function registerMakeRequestCommand()
{
$this->app->singleton('pluggables.make.request', function ($app) {
$handler = new Handlers\PluggableMakeRequestHandler($app['pluggables'], $app['files']);
return new Console\PluggableMakeRequestCommand($handler);
});
} | [
"protected",
"function",
"registerMakeRequestCommand",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'pluggables.make.request'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"handler",
"=",
"new",
"Handlers",
"\\",
"PluggableMakeRequestHa... | Register the "pluggables:make:migration" console command.
@return Console\PluggableMakeRequestCommand | [
"Register",
"the",
"pluggables",
":",
"make",
":",
"migration",
"console",
"command",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/PluggablesServiceProvider.php#L231-L238 |
aindong/pluggables | src/Aindong/Pluggables/PluggablesServiceProvider.php | PluggablesServiceProvider.registerMakeModelCommand | protected function registerMakeModelCommand()
{
$this->app->singleton('pluggables.make.model', function ($app) {
$handler = new Handlers\PluggableMakeModelHandler($app['pluggables'], $app['files']);
return new Console\PluggableMakeModelCommand($handler);
});
} | php | protected function registerMakeModelCommand()
{
$this->app->singleton('pluggables.make.model', function ($app) {
$handler = new Handlers\PluggableMakeModelHandler($app['pluggables'], $app['files']);
return new Console\PluggableMakeModelCommand($handler);
});
} | [
"protected",
"function",
"registerMakeModelCommand",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'pluggables.make.model'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"handler",
"=",
"new",
"Handlers",
"\\",
"PluggableMakeModelHandler"... | Register the "pluggables:make:model" console command.
@return Console\PluggableMakeModelCommand | [
"Register",
"the",
"pluggables",
":",
"make",
":",
"model",
"console",
"command",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/PluggablesServiceProvider.php#L245-L252 |
puli/discovery | src/Binding/AbstractBinding.php | AbstractBinding.initialize | public function initialize(BindingType $type)
{
if ($this->typeName !== $type->getName()) {
throw new InvalidArgumentException(sprintf(
'The passed type "%s" does not match the configured type "%s".',
$type->getName(),
$this->typeName
)... | php | public function initialize(BindingType $type)
{
if ($this->typeName !== $type->getName()) {
throw new InvalidArgumentException(sprintf(
'The passed type "%s" does not match the configured type "%s".',
$type->getName(),
$this->typeName
)... | [
"public",
"function",
"initialize",
"(",
"BindingType",
"$",
"type",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"typeName",
"!==",
"$",
"type",
"->",
"getName",
"(",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'The passed ... | {@inheritdoc} | [
"{"
] | train | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Binding/AbstractBinding.php#L83-L104 |
puli/discovery | src/Binding/AbstractBinding.php | AbstractBinding.hasParameterValues | public function hasParameterValues($includeDefault = true)
{
if ($includeDefault) {
return count($this->parameterValues) > 0;
}
return count($this->userParameterValues) > 0;
} | php | public function hasParameterValues($includeDefault = true)
{
if ($includeDefault) {
return count($this->parameterValues) > 0;
}
return count($this->userParameterValues) > 0;
} | [
"public",
"function",
"hasParameterValues",
"(",
"$",
"includeDefault",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"includeDefault",
")",
"{",
"return",
"count",
"(",
"$",
"this",
"->",
"parameterValues",
")",
">",
"0",
";",
"}",
"return",
"count",
"(",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Binding/AbstractBinding.php#L149-L156 |
puli/discovery | src/Binding/AbstractBinding.php | AbstractBinding.getParameterValue | public function getParameterValue($parameterName, $includeDefault = true)
{
$parameterValues = $includeDefault ? $this->parameterValues : $this->userParameterValues;
if (!array_key_exists($parameterName, $parameterValues)) {
throw NoSuchParameterException::forParameterName($parameterNam... | php | public function getParameterValue($parameterName, $includeDefault = true)
{
$parameterValues = $includeDefault ? $this->parameterValues : $this->userParameterValues;
if (!array_key_exists($parameterName, $parameterValues)) {
throw NoSuchParameterException::forParameterName($parameterNam... | [
"public",
"function",
"getParameterValue",
"(",
"$",
"parameterName",
",",
"$",
"includeDefault",
"=",
"true",
")",
"{",
"$",
"parameterValues",
"=",
"$",
"includeDefault",
"?",
"$",
"this",
"->",
"parameterValues",
":",
"$",
"this",
"->",
"userParameterValues",... | {@inheritdoc} | [
"{"
] | train | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Binding/AbstractBinding.php#L161-L170 |
puli/discovery | src/Binding/AbstractBinding.php | AbstractBinding.hasParameterValue | public function hasParameterValue($parameterName, $includeDefault = true)
{
if ($includeDefault) {
return array_key_exists($parameterName, $this->parameterValues);
}
return array_key_exists($parameterName, $this->userParameterValues);
} | php | public function hasParameterValue($parameterName, $includeDefault = true)
{
if ($includeDefault) {
return array_key_exists($parameterName, $this->parameterValues);
}
return array_key_exists($parameterName, $this->userParameterValues);
} | [
"public",
"function",
"hasParameterValue",
"(",
"$",
"parameterName",
",",
"$",
"includeDefault",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"includeDefault",
")",
"{",
"return",
"array_key_exists",
"(",
"$",
"parameterName",
",",
"$",
"this",
"->",
"parameterValu... | {@inheritdoc} | [
"{"
] | train | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Binding/AbstractBinding.php#L175-L182 |
puli/discovery | src/Binding/AbstractBinding.php | AbstractBinding.equals | public function equals(Binding $other)
{
if (get_class($this) !== get_class($other)) {
return false;
}
/** @var AbstractBinding $other */
if ($this->typeName !== $other->typeName) {
return false;
}
return $this->userParameterValues === $other... | php | public function equals(Binding $other)
{
if (get_class($this) !== get_class($other)) {
return false;
}
/** @var AbstractBinding $other */
if ($this->typeName !== $other->typeName) {
return false;
}
return $this->userParameterValues === $other... | [
"public",
"function",
"equals",
"(",
"Binding",
"$",
"other",
")",
"{",
"if",
"(",
"get_class",
"(",
"$",
"this",
")",
"!==",
"get_class",
"(",
"$",
"other",
")",
")",
"{",
"return",
"false",
";",
"}",
"/** @var AbstractBinding $other */",
"if",
"(",
"$"... | {@inheritdoc} | [
"{"
] | train | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Binding/AbstractBinding.php#L209-L221 |
nkt/flame | src/Grammar/Grammar.php | Grammar.buildId | public function buildId($id)
{
$parts = explode(' ', $id, 2);
if (count($parts) === 2) {
return $this->buildIdWithAlias($parts[0], $parts[1]);
}
return $this->wrap($id);
} | php | public function buildId($id)
{
$parts = explode(' ', $id, 2);
if (count($parts) === 2) {
return $this->buildIdWithAlias($parts[0], $parts[1]);
}
return $this->wrap($id);
} | [
"public",
"function",
"buildId",
"(",
"$",
"id",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"' '",
",",
"$",
"id",
",",
"2",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"===",
"2",
")",
"{",
"return",
"$",
"this",
"->",
"buildIdWith... | @param string $id
@return string | [
"@param",
"string",
"$id"
] | train | https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/Grammar/Grammar.php#L20-L28 |
nkt/flame | src/Grammar/Grammar.php | Grammar.buildDateTime | public function buildDateTime($value)
{
if ($value instanceof \DateTime) {
return $value->format(static::DATE_TIME_FORMAT);
} elseif (is_int($value)) {
$date = new \DateTime();
$date->setTimestamp($value);
return $date->format(static::DATE_TIME_FORMAT... | php | public function buildDateTime($value)
{
if ($value instanceof \DateTime) {
return $value->format(static::DATE_TIME_FORMAT);
} elseif (is_int($value)) {
$date = new \DateTime();
$date->setTimestamp($value);
return $date->format(static::DATE_TIME_FORMAT... | [
"public",
"function",
"buildDateTime",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"\\",
"DateTime",
")",
"{",
"return",
"$",
"value",
"->",
"format",
"(",
"static",
"::",
"DATE_TIME_FORMAT",
")",
";",
"}",
"elseif",
"(",
"is_int"... | @param \DateTime|int|string $value
@return string
@throws \InvalidArgumentException | [
"@param",
"\\",
"DateTime|int|string",
"$value"
] | train | https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/Grammar/Grammar.php#L47-L62 |
nkt/flame | src/Grammar/Grammar.php | Grammar.buildTime | public function buildTime($value)
{
if ($value instanceof \DateTime) {
return $value->format(static::TIME_FORMAT);
} elseif (is_int($value)) {
$date = new \DateTime();
$date->setTimestamp($value);
return $date->format(static::TIME_FORMAT);
} e... | php | public function buildTime($value)
{
if ($value instanceof \DateTime) {
return $value->format(static::TIME_FORMAT);
} elseif (is_int($value)) {
$date = new \DateTime();
$date->setTimestamp($value);
return $date->format(static::TIME_FORMAT);
} e... | [
"public",
"function",
"buildTime",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"instanceof",
"\\",
"DateTime",
")",
"{",
"return",
"$",
"value",
"->",
"format",
"(",
"static",
"::",
"TIME_FORMAT",
")",
";",
"}",
"elseif",
"(",
"is_int",
"(",
... | @param \DateTime|int|string $value
@return string
@throws \InvalidArgumentException | [
"@param",
"\\",
"DateTime|int|string",
"$value"
] | train | https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/Grammar/Grammar.php#L70-L85 |
nkt/flame | src/Grammar/Grammar.php | Grammar.wrap | protected function wrap($id)
{
return join('.', array_map(function ($id) {
return static::QUOTE_CHAR . $id . static::QUOTE_CHAR;
}, explode('.', $id, 3)));
} | php | protected function wrap($id)
{
return join('.', array_map(function ($id) {
return static::QUOTE_CHAR . $id . static::QUOTE_CHAR;
}, explode('.', $id, 3)));
} | [
"protected",
"function",
"wrap",
"(",
"$",
"id",
")",
"{",
"return",
"join",
"(",
"'.'",
",",
"array_map",
"(",
"function",
"(",
"$",
"id",
")",
"{",
"return",
"static",
"::",
"QUOTE_CHAR",
".",
"$",
"id",
".",
"static",
"::",
"QUOTE_CHAR",
";",
"}",... | @param string $id
@return string | [
"@param",
"string",
"$id"
] | train | https://github.com/nkt/flame/blob/16f9f172db5a8a618b628429e0986eacb089d217/src/Grammar/Grammar.php#L92-L97 |
tonicospinelli/class-generation | src/ClassGeneration/Constant.php | Constant.setValue | public function setValue($value)
{
if (!is_string($value) && !is_numeric($value)) {
throw new \InvalidArgumentException('The constant value must be a string or number');
}
$this->value = $value;
return $this;
} | php | public function setValue($value)
{
if (!is_string($value) && !is_numeric($value)) {
throw new \InvalidArgumentException('The constant value must be a string or number');
}
$this->value = $value;
return $this;
} | [
"public",
"function",
"setValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"&&",
"!",
"is_numeric",
"(",
"$",
"value",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The constant value must ... | {@inheritdoc} | [
"{"
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Constant.php#L77-L85 |
tonicospinelli/class-generation | src/ClassGeneration/Constant.php | Constant.toString | public function toString()
{
$constant = $this->getDocBlock()->toString()
. $this->getTabulationFormatted()
. 'const '
. mb_strtoupper($this->getName())
. ' = ' . var_export($this->getValue(), true)
. ';' . PHP_EOL;
return $constant;
} | php | public function toString()
{
$constant = $this->getDocBlock()->toString()
. $this->getTabulationFormatted()
. 'const '
. mb_strtoupper($this->getName())
. ' = ' . var_export($this->getValue(), true)
. ';' . PHP_EOL;
return $constant;
} | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"constant",
"=",
"$",
"this",
"->",
"getDocBlock",
"(",
")",
"->",
"toString",
"(",
")",
".",
"$",
"this",
"->",
"getTabulationFormatted",
"(",
")",
".",
"'const '",
".",
"mb_strtoupper",
"(",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/tonicospinelli/class-generation/blob/eee63bdb68c066b25b885b57b23656e809381a76/src/ClassGeneration/Constant.php#L135-L145 |
Srokap/code_review | classes/code_review.php | code_review.initConfig | public static function initConfig(array $options) {
self::$config = $options;
$names = array(
'T_NAMESPACE',
'T_NS_C',
'T_NS_SEPARATOR',
);
foreach ($names as $name) {
if (!defined($name)) {
// just define it with value unused by tokenizer to avoid errors on old PHP versions
define($name, ... | php | public static function initConfig(array $options) {
self::$config = $options;
$names = array(
'T_NAMESPACE',
'T_NS_C',
'T_NS_SEPARATOR',
);
foreach ($names as $name) {
if (!defined($name)) {
// just define it with value unused by tokenizer to avoid errors on old PHP versions
define($name, ... | [
"public",
"static",
"function",
"initConfig",
"(",
"array",
"$",
"options",
")",
"{",
"self",
"::",
"$",
"config",
"=",
"$",
"options",
";",
"$",
"names",
"=",
"array",
"(",
"'T_NAMESPACE'",
",",
"'T_NS_C'",
",",
"'T_NS_SEPARATOR'",
",",
")",
";",
"forea... | @param array $options
@todo Move into \CodeReview\Config instead | [
"@param",
"array",
"$options"
] | train | https://github.com/Srokap/code_review/blob/c79c619f99279cf15713b118ae19b0ef017db362/classes/code_review.php#L49-L64 |
Srokap/code_review | classes/code_review.php | code_review.getDeprecatedFunctionsFromTokens | private static function getDeprecatedFunctionsFromTokens(\CodeReview\PhpFileParser $tokens, \SplFileInfo $file, $version, $maxVersion) {
$namespace = '';
$className = null;
$functs = array();
foreach ($tokens as $key => $token) {
if ($tokens->isEqualToToken(T_INTERFACE, $key)) {
//we don't process interf... | php | private static function getDeprecatedFunctionsFromTokens(\CodeReview\PhpFileParser $tokens, \SplFileInfo $file, $version, $maxVersion) {
$namespace = '';
$className = null;
$functs = array();
foreach ($tokens as $key => $token) {
if ($tokens->isEqualToToken(T_INTERFACE, $key)) {
//we don't process interf... | [
"private",
"static",
"function",
"getDeprecatedFunctionsFromTokens",
"(",
"\\",
"CodeReview",
"\\",
"PhpFileParser",
"$",
"tokens",
",",
"\\",
"SplFileInfo",
"$",
"file",
",",
"$",
"version",
",",
"$",
"maxVersion",
")",
"{",
"$",
"namespace",
"=",
"''",
";",
... | Redurns deprecated functions from particular file.
@param \CodeReview\PhpFileParser $tokens
@param \SplFileInfo $file
@param $version
@param $maxVersion max version to return
@return array | [
"Redurns",
"deprecated",
"functions",
"from",
"particular",
"file",
"."
] | train | https://github.com/Srokap/code_review/blob/c79c619f99279cf15713b118ae19b0ef017db362/classes/code_review.php#L299-L375 |
Srokap/code_review | classes/code_review.php | code_review.getPrivateFunctionsFromTokens | private static function getPrivateFunctionsFromTokens(\CodeReview\PhpFileParser $tokens, \SplFileInfo $file) {
$namespace = '';
$className = null;
$functs = array();
foreach ($tokens as $key => $token) {
if ($tokens->isEqualToToken(T_INTERFACE, $key)) {
//we don't process interfaces for deprecated functi... | php | private static function getPrivateFunctionsFromTokens(\CodeReview\PhpFileParser $tokens, \SplFileInfo $file) {
$namespace = '';
$className = null;
$functs = array();
foreach ($tokens as $key => $token) {
if ($tokens->isEqualToToken(T_INTERFACE, $key)) {
//we don't process interfaces for deprecated functi... | [
"private",
"static",
"function",
"getPrivateFunctionsFromTokens",
"(",
"\\",
"CodeReview",
"\\",
"PhpFileParser",
"$",
"tokens",
",",
"\\",
"SplFileInfo",
"$",
"file",
")",
"{",
"$",
"namespace",
"=",
"''",
";",
"$",
"className",
"=",
"null",
";",
"$",
"func... | Redurns deprecated functions from particular file.
@param \CodeReview\PhpFileParser $tokens
@param \SplFileInfo $file
@param $version
@return array | [
"Redurns",
"deprecated",
"functions",
"from",
"particular",
"file",
"."
] | train | https://github.com/Srokap/code_review/blob/c79c619f99279cf15713b118ae19b0ef017db362/classes/code_review.php#L385-L448 |
Srokap/code_review | classes/code_review.php | code_review.getPluginDirsInDir | public static function getPluginDirsInDir($dir = null) {
if ($dir === null) {
$dir = self::$config['pluginspath'];
}
$plugin_dirs = array();
$handle = opendir($dir);
if ($handle) {
while ($plugin_dir = readdir($handle)) {
// must be directory and not begin with a .
if (substr($plugin_dir, 0, 1... | php | public static function getPluginDirsInDir($dir = null) {
if ($dir === null) {
$dir = self::$config['pluginspath'];
}
$plugin_dirs = array();
$handle = opendir($dir);
if ($handle) {
while ($plugin_dir = readdir($handle)) {
// must be directory and not begin with a .
if (substr($plugin_dir, 0, 1... | [
"public",
"static",
"function",
"getPluginDirsInDir",
"(",
"$",
"dir",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"dir",
"===",
"null",
")",
"{",
"$",
"dir",
"=",
"self",
"::",
"$",
"config",
"[",
"'pluginspath'",
"]",
";",
"}",
"$",
"plugin_dirs",
"=",
... | Returns a list of plugin directory names from a base directory.
Copied from 1.9 core due to elgg_get_plugin_ids_in_dir removal in 1.9
@param string $dir A dir to scan for plugins. Defaults to config's plugins_path.
Must have a trailing slash.
@return array Array of directory names (not full paths) | [
"Returns",
"a",
"list",
"of",
"plugin",
"directory",
"names",
"from",
"a",
"base",
"directory",
".",
"Copied",
"from",
"1",
".",
"9",
"core",
"due",
"to",
"elgg_get_plugin_ids_in_dir",
"removal",
"in",
"1",
".",
"9"
] | train | https://github.com/Srokap/code_review/blob/c79c619f99279cf15713b118ae19b0ef017db362/classes/code_review.php#L459-L479 |
gdbots/pbjx-bundle-php | src/Command/PbjxAwareCommandTrait.php | PbjxAwareCommandTrait.createConsoleRequest | protected function createConsoleRequest(): Request
{
$requestStack = $this->getRequestStack();
$request = $requestStack->getCurrentRequest();
if (!$request instanceof Request) {
$request = new Request();
$requestStack->push($request);
}
$request->attr... | php | protected function createConsoleRequest(): Request
{
$requestStack = $this->getRequestStack();
$request = $requestStack->getCurrentRequest();
if (!$request instanceof Request) {
$request = new Request();
$requestStack->push($request);
}
$request->attr... | [
"protected",
"function",
"createConsoleRequest",
"(",
")",
":",
"Request",
"{",
"$",
"requestStack",
"=",
"$",
"this",
"->",
"getRequestStack",
"(",
")",
";",
"$",
"request",
"=",
"$",
"requestStack",
"->",
"getCurrentRequest",
"(",
")",
";",
"if",
"(",
"!... | Some pbjx binders, validators, etc. expect a request to exist.
Create one if nothing has been created yet.
@return Request | [
"Some",
"pbjx",
"binders",
"validators",
"etc",
".",
"expect",
"a",
"request",
"to",
"exist",
".",
"Create",
"one",
"if",
"nothing",
"has",
"been",
"created",
"yet",
"."
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Command/PbjxAwareCommandTrait.php#L69-L82 |
gdbots/pbjx-bundle-php | src/Command/PbjxAwareCommandTrait.php | PbjxAwareCommandTrait.useInMemoryTransports | protected function useInMemoryTransports(InputInterface $input, ?SymfonyStyle $io = null): void
{
if ($input->getOption('in-memory')) {
$locator = $this->getPbjxServiceLocator();
if ($locator instanceof ContainerAwareServiceLocator) {
$locator->forceTransportsToInMemo... | php | protected function useInMemoryTransports(InputInterface $input, ?SymfonyStyle $io = null): void
{
if ($input->getOption('in-memory')) {
$locator = $this->getPbjxServiceLocator();
if ($locator instanceof ContainerAwareServiceLocator) {
$locator->forceTransportsToInMemo... | [
"protected",
"function",
"useInMemoryTransports",
"(",
"InputInterface",
"$",
"input",
",",
"?",
"SymfonyStyle",
"$",
"io",
"=",
"null",
")",
":",
"void",
"{",
"if",
"(",
"$",
"input",
"->",
"getOption",
"(",
"'in-memory'",
")",
")",
"{",
"$",
"locator",
... | Running transports "in-memory" means the command/request handlers and event
subscribers to pbjx messages will happen in this process and not run through
kinesis, gearman, sqs, etc.
@param InputInterface $input
@param SymfonyStyle $io | [
"Running",
"transports",
"in",
"-",
"memory",
"means",
"the",
"command",
"/",
"request",
"handlers",
"and",
"event",
"subscribers",
"to",
"pbjx",
"messages",
"will",
"happen",
"in",
"this",
"process",
"and",
"not",
"run",
"through",
"kinesis",
"gearman",
"sqs"... | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Command/PbjxAwareCommandTrait.php#L92-L103 |
gdbots/pbjx-bundle-php | src/Command/PbjxAwareCommandTrait.php | PbjxAwareCommandTrait.readyForPbjxTraffic | protected function readyForPbjxTraffic(SymfonyStyle $io, string $message = 'Aborting replay of events.'): bool
{
$container = $this->getContainer();
$question = sprintf(
'Have you prepared your event store [%s], transports [%s,%s] and your devops team for the added traffic? ',
... | php | protected function readyForPbjxTraffic(SymfonyStyle $io, string $message = 'Aborting replay of events.'): bool
{
$container = $this->getContainer();
$question = sprintf(
'Have you prepared your event store [%s], transports [%s,%s] and your devops team for the added traffic? ',
... | [
"protected",
"function",
"readyForPbjxTraffic",
"(",
"SymfonyStyle",
"$",
"io",
",",
"string",
"$",
"message",
"=",
"'Aborting replay of events.'",
")",
":",
"bool",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"$",
"question",... | @param SymfonyStyle $io
@param string $message
@return bool | [
"@param",
"SymfonyStyle",
"$io",
"@param",
"string",
"$message"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Command/PbjxAwareCommandTrait.php#L111-L127 |
gdbots/pbjx-bundle-php | src/Command/PbjxAwareCommandTrait.php | PbjxAwareCommandTrait.getSchemasUsingMixin | protected function getSchemasUsingMixin(Mixin $mixin, ?string $qname = null): array
{
$curie = $mixin->getId()->getCurieMajor();
if (null === $qname) {
$schemas = $mixin::findAll();
} else {
/** @var Message $class */
$class = MessageResolver::resolveCuri... | php | protected function getSchemasUsingMixin(Mixin $mixin, ?string $qname = null): array
{
$curie = $mixin->getId()->getCurieMajor();
if (null === $qname) {
$schemas = $mixin::findAll();
} else {
/** @var Message $class */
$class = MessageResolver::resolveCuri... | [
"protected",
"function",
"getSchemasUsingMixin",
"(",
"Mixin",
"$",
"mixin",
",",
"?",
"string",
"$",
"qname",
"=",
"null",
")",
":",
"array",
"{",
"$",
"curie",
"=",
"$",
"mixin",
"->",
"getId",
"(",
")",
"->",
"getCurieMajor",
"(",
")",
";",
"if",
... | @param Mixin $mixin
@param string $qname
@return Schema[] | [
"@param",
"Mixin",
"$mixin",
"@param",
"string",
"$qname"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/Command/PbjxAwareCommandTrait.php#L135-L158 |
dragosprotung/stc-core | src/Workout/Track.php | Track.lastTrackPoint | public function lastTrackPoint(): TrackPoint
{
$lastTrackPoint = end($this->trackPoints);
if (!$lastTrackPoint instanceof TrackPoint) {
throw new \OutOfBoundsException('No track points points defined.');
}
reset($this->trackPoints);
return $lastTrackPoint;
... | php | public function lastTrackPoint(): TrackPoint
{
$lastTrackPoint = end($this->trackPoints);
if (!$lastTrackPoint instanceof TrackPoint) {
throw new \OutOfBoundsException('No track points points defined.');
}
reset($this->trackPoints);
return $lastTrackPoint;
... | [
"public",
"function",
"lastTrackPoint",
"(",
")",
":",
"TrackPoint",
"{",
"$",
"lastTrackPoint",
"=",
"end",
"(",
"$",
"this",
"->",
"trackPoints",
")",
";",
"if",
"(",
"!",
"$",
"lastTrackPoint",
"instanceof",
"TrackPoint",
")",
"{",
"throw",
"new",
"\\",... | Get the last track point.
@return TrackPoint
@throws \OutOfBoundsException If no track points are defined. | [
"Get",
"the",
"last",
"track",
"point",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Track.php#L90-L101 |
dragosprotung/stc-core | src/Workout/Track.php | Track.recomputeStartDateTime | private function recomputeStartDateTime(): \DateTimeImmutable
{
$this->startDateTime = null;
foreach ($this->trackPoints() as $trackPoint) {
if ($this->startDateTime === null || $this->startDateTime > $trackPoint->dateTime()) {
$this->startDateTime = clone $trackPoint->da... | php | private function recomputeStartDateTime(): \DateTimeImmutable
{
$this->startDateTime = null;
foreach ($this->trackPoints() as $trackPoint) {
if ($this->startDateTime === null || $this->startDateTime > $trackPoint->dateTime()) {
$this->startDateTime = clone $trackPoint->da... | [
"private",
"function",
"recomputeStartDateTime",
"(",
")",
":",
"\\",
"DateTimeImmutable",
"{",
"$",
"this",
"->",
"startDateTime",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"trackPoints",
"(",
")",
"as",
"$",
"trackPoint",
")",
"{",
"if",
"(",
... | Recompute the start date and time of the track.
@return \DateTimeImmutable | [
"Recompute",
"the",
"start",
"date",
"and",
"time",
"of",
"the",
"track",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Track.php#L122-L132 |
dragosprotung/stc-core | src/Workout/Track.php | Track.recomputeEndDateTime | private function recomputeEndDateTime(): \DateTimeImmutable
{
$this->endDateTime = null;
foreach ($this->trackPoints() as $trackPoint) {
if ($this->startDateTime === null || $this->endDateTime < $trackPoint->dateTime()) {
$this->endDateTime = clone $trackPoint->dateTime()... | php | private function recomputeEndDateTime(): \DateTimeImmutable
{
$this->endDateTime = null;
foreach ($this->trackPoints() as $trackPoint) {
if ($this->startDateTime === null || $this->endDateTime < $trackPoint->dateTime()) {
$this->endDateTime = clone $trackPoint->dateTime()... | [
"private",
"function",
"recomputeEndDateTime",
"(",
")",
":",
"\\",
"DateTimeImmutable",
"{",
"$",
"this",
"->",
"endDateTime",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"trackPoints",
"(",
")",
"as",
"$",
"trackPoint",
")",
"{",
"if",
"(",
"$... | Recompute the start date and time of the track.
@return \DateTimeImmutable | [
"Recompute",
"the",
"start",
"date",
"and",
"time",
"of",
"the",
"track",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Track.php#L153-L163 |
dragosprotung/stc-core | src/Workout/Track.php | Track.duration | public function duration()
{
$start = $this->startDateTime();
$end = $this->endDateTime();
$dateDifference = $start->diff($end);
$dateInterval = new DateInterval('PT1S');
$dateInterval->y = $dateDifference->y;
$dateInterval->m = $dateDifference->m;
$dateInte... | php | public function duration()
{
$start = $this->startDateTime();
$end = $this->endDateTime();
$dateDifference = $start->diff($end);
$dateInterval = new DateInterval('PT1S');
$dateInterval->y = $dateDifference->y;
$dateInterval->m = $dateDifference->m;
$dateInte... | [
"public",
"function",
"duration",
"(",
")",
"{",
"$",
"start",
"=",
"$",
"this",
"->",
"startDateTime",
"(",
")",
";",
"$",
"end",
"=",
"$",
"this",
"->",
"endDateTime",
"(",
")",
";",
"$",
"dateDifference",
"=",
"$",
"start",
"->",
"diff",
"(",
"$... | Get the duration of the track.
@return DateInterval | [
"Get",
"the",
"duration",
"of",
"the",
"track",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Track.php#L170-L188 |
dragosprotung/stc-core | src/Workout/Track.php | Track.length | public function length(): float
{
if ($this->length === 0) {
$this->length = $this->recomputeLength();
}
return $this->length;
} | php | public function length(): float
{
if ($this->length === 0) {
$this->length = $this->recomputeLength();
}
return $this->length;
} | [
"public",
"function",
"length",
"(",
")",
":",
"float",
"{",
"if",
"(",
"$",
"this",
"->",
"length",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"length",
"=",
"$",
"this",
"->",
"recomputeLength",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"l... | Get the length of the track in meters.
@return float | [
"Get",
"the",
"length",
"of",
"the",
"track",
"in",
"meters",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Track.php#L206-L214 |
dragosprotung/stc-core | src/Workout/Track.php | Track.recomputeLength | private function recomputeLength(): float
{
$this->length = 0;
$trackPoints = $this->trackPoints();
$trackPointsCount = count($trackPoints);
if ($trackPointsCount < 2) {
return 0;
}
for ($i = 1; $i < $trackPointsCount; $i++) {
$previousTrack ... | php | private function recomputeLength(): float
{
$this->length = 0;
$trackPoints = $this->trackPoints();
$trackPointsCount = count($trackPoints);
if ($trackPointsCount < 2) {
return 0;
}
for ($i = 1; $i < $trackPointsCount; $i++) {
$previousTrack ... | [
"private",
"function",
"recomputeLength",
"(",
")",
":",
"float",
"{",
"$",
"this",
"->",
"length",
"=",
"0",
";",
"$",
"trackPoints",
"=",
"$",
"this",
"->",
"trackPoints",
"(",
")",
";",
"$",
"trackPointsCount",
"=",
"count",
"(",
"$",
"trackPoints",
... | Recompute the length of the track.
@return float | [
"Recompute",
"the",
"length",
"of",
"the",
"track",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Track.php#L221-L241 |
nicoSWD/put.io-api-v2 | src/PutIO/Engines/PutIO/OauthEngine.php | OauthEngine.verifyCode | public function verifyCode($clientID, $clientSecret, $redirectURI, $code)
{
$response = $this->get('oauth2/access_token', [
'client_id' => $clientID,
'client_secret' => $clientSecret,
'grant_type' => 'authorization_code',
'redirect_uri' => $redirectURI... | php | public function verifyCode($clientID, $clientSecret, $redirectURI, $code)
{
$response = $this->get('oauth2/access_token', [
'client_id' => $clientID,
'client_secret' => $clientSecret,
'grant_type' => 'authorization_code',
'redirect_uri' => $redirectURI... | [
"public",
"function",
"verifyCode",
"(",
"$",
"clientID",
",",
"$",
"clientSecret",
",",
"$",
"redirectURI",
",",
"$",
"code",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"get",
"(",
"'oauth2/access_token'",
",",
"[",
"'client_id'",
"=>",
"$",
"cl... | Second step of OAuth. This verifies the code obtained by the first
function. If valid, this function returns the user's access token, which
you need to save for all upcoming API requests.
@param int $clientID App ID
@param string $clientSecret App secret
@param string $redirectURI Redirect URI
@param str... | [
"Second",
"step",
"of",
"OAuth",
".",
"This",
"verifies",
"the",
"code",
"obtained",
"by",
"the",
"first",
"function",
".",
"If",
"valid",
"this",
"function",
"returns",
"the",
"user",
"s",
"access",
"token",
"which",
"you",
"need",
"to",
"save",
"for",
... | train | https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Engines/PutIO/OauthEngine.php#L52-L69 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.serialize | public function serialize($object): string
{
if (is_object($object) === false) {
throw new InvalidObject('Argument is not an object (passed argument type is ' . gettype($object) . ')');
}
$jsonEncoded = json_encode($this->setArray($object));
return $jsonEncoded;
} | php | public function serialize($object): string
{
if (is_object($object) === false) {
throw new InvalidObject('Argument is not an object (passed argument type is ' . gettype($object) . ')');
}
$jsonEncoded = json_encode($this->setArray($object));
return $jsonEncoded;
} | [
"public",
"function",
"serialize",
"(",
"$",
"object",
")",
":",
"string",
"{",
"if",
"(",
"is_object",
"(",
"$",
"object",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidObject",
"(",
"'Argument is not an object (passed argument type is '",
".",
"gettyp... | Serialize object
@param object $object
@return string
@throws InvalidObject | [
"Serialize",
"object"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L41-L50 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.setArray | private function setArray($object): array
{
$data = [];
$configurationObject = $this->configuration->getConfigurationObjectForClass(new ClassName(get_class($object)));
$identifier = $configurationObject->getIdentifier();
if ($identifier !== '') {
$data[$this->configurati... | php | private function setArray($object): array
{
$data = [];
$configurationObject = $this->configuration->getConfigurationObjectForClass(new ClassName(get_class($object)));
$identifier = $configurationObject->getIdentifier();
if ($identifier !== '') {
$data[$this->configurati... | [
"private",
"function",
"setArray",
"(",
"$",
"object",
")",
":",
"array",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"configurationObject",
"=",
"$",
"this",
"->",
"configuration",
"->",
"getConfigurationObjectForClass",
"(",
"new",
"ClassName",
"(",
"get_cl... | Create array from object
@param object $object
@return mixed[] | [
"Create",
"array",
"from",
"object"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L59-L75 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.processSerializeForType | private function processSerializeForType(Configuration\TypeInterface $type, $object, array $data, $attribute): array
{
if ($type instanceof Type\Method) {
$data = $this->processSerializeTypeMethod($type, $object, $data, $attribute);
} elseif ($type instanceof Type\Object) {
$... | php | private function processSerializeForType(Configuration\TypeInterface $type, $object, array $data, $attribute): array
{
if ($type instanceof Type\Method) {
$data = $this->processSerializeTypeMethod($type, $object, $data, $attribute);
} elseif ($type instanceof Type\Object) {
$... | [
"private",
"function",
"processSerializeForType",
"(",
"Configuration",
"\\",
"TypeInterface",
"$",
"type",
",",
"$",
"object",
",",
"array",
"$",
"data",
",",
"$",
"attribute",
")",
":",
"array",
"{",
"if",
"(",
"$",
"type",
"instanceof",
"Type",
"\\",
"M... | @param Configuration\TypeInterface $type
@param object $object
@param mixed[] $data
@param string $attribute
@return mixed[] | [
"@param",
"Configuration",
"\\",
"TypeInterface",
"$type",
"@param",
"object",
"$object",
"@param",
"mixed",
"[]",
"$data",
"@param",
"string",
"$attribute"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L85-L102 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.processSerializeTypeMethod | private function processSerializeTypeMethod(Type\Method $method, $object, array $data, string $attribute): array
{
$value = $object->{$method->getter()}();
if ($this->checkNullForAttribute($value, $attribute) === false) {
$data[$attribute] = $value;
}
return $data;
... | php | private function processSerializeTypeMethod(Type\Method $method, $object, array $data, string $attribute): array
{
$value = $object->{$method->getter()}();
if ($this->checkNullForAttribute($value, $attribute) === false) {
$data[$attribute] = $value;
}
return $data;
... | [
"private",
"function",
"processSerializeTypeMethod",
"(",
"Type",
"\\",
"Method",
"$",
"method",
",",
"$",
"object",
",",
"array",
"$",
"data",
",",
"string",
"$",
"attribute",
")",
":",
"array",
"{",
"$",
"value",
"=",
"$",
"object",
"->",
"{",
"$",
"... | @param Type\Method $method
@param object $object
@param mixed[] $data
@param string $attribute
@return mixed[] | [
"@param",
"Type",
"\\",
"Method",
"$method",
"@param",
"object",
"$object",
"@param",
"mixed",
"[]",
"$data",
"@param",
"string",
"$attribute"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L112-L121 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.processSerializeTypeObject | private function processSerializeTypeObject(Type\Object $objectType, $object, array $data, string $attribute): array
{
return $this->setArrayAndCheckNull($data, $object->{$objectType->getter()}(), $attribute);
} | php | private function processSerializeTypeObject(Type\Object $objectType, $object, array $data, string $attribute): array
{
return $this->setArrayAndCheckNull($data, $object->{$objectType->getter()}(), $attribute);
} | [
"private",
"function",
"processSerializeTypeObject",
"(",
"Type",
"\\",
"Object",
"$",
"objectType",
",",
"$",
"object",
",",
"array",
"$",
"data",
",",
"string",
"$",
"attribute",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"setArrayAndCheckNull",
... | @param Type\Object $objectType
@param object $object
@param mixed[] $data
@param string $attribute
@return mixed[] | [
"@param",
"Type",
"\\",
"Object",
"$objectType",
"@param",
"object",
"$object",
"@param",
"mixed",
"[]",
"$data",
"@param",
"string",
"$attribute"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L131-L134 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.processSerializeTypeCollectionObject | private function processSerializeTypeCollectionObject($objectType, $object, array $data, string $attribute): array
{
$subData = $object->{$objectType->getter()}();
if ($this->checkNullForAttribute($subData, $attribute) === true) {
return $data;
}
foreach ($subData as $ke... | php | private function processSerializeTypeCollectionObject($objectType, $object, array $data, string $attribute): array
{
$subData = $object->{$objectType->getter()}();
if ($this->checkNullForAttribute($subData, $attribute) === true) {
return $data;
}
foreach ($subData as $ke... | [
"private",
"function",
"processSerializeTypeCollectionObject",
"(",
"$",
"objectType",
",",
"$",
"object",
",",
"array",
"$",
"data",
",",
"string",
"$",
"attribute",
")",
":",
"array",
"{",
"$",
"subData",
"=",
"$",
"object",
"->",
"{",
"$",
"objectType",
... | @param Type\Collection\Object|Type\Collection\IdentifiedObject $objectType
@param object $object
@param mixed[] $data
@param string $attribute
@return mixed[] | [
"@param",
"Type",
"\\",
"Collection",
"\\",
"Object|Type",
"\\",
"Collection",
"\\",
"IdentifiedObject",
"$objectType",
"@param",
"object",
"$object",
"@param",
"mixed",
"[]",
"$data",
"@param",
"string",
"$attribute"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L144-L156 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.processSerializeTypeIdentifiedObject | private function processSerializeTypeIdentifiedObject(
Type\IdentifiedObject $objectType,
$object,
array $data,
string $attribute
): array {
return $this->setArrayAndCheckNull($data, $object->{$objectType->getter()}(), $attribute);
} | php | private function processSerializeTypeIdentifiedObject(
Type\IdentifiedObject $objectType,
$object,
array $data,
string $attribute
): array {
return $this->setArrayAndCheckNull($data, $object->{$objectType->getter()}(), $attribute);
} | [
"private",
"function",
"processSerializeTypeIdentifiedObject",
"(",
"Type",
"\\",
"IdentifiedObject",
"$",
"objectType",
",",
"$",
"object",
",",
"array",
"$",
"data",
",",
"string",
"$",
"attribute",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"setAr... | @param Type\IdentifiedObject $objectType
@param object $object
@param mixed[] $data
@param string $attribute
@return mixed[] | [
"@param",
"Type",
"\\",
"IdentifiedObject",
"$objectType",
"@param",
"object",
"$object",
"@param",
"mixed",
"[]",
"$data",
"@param",
"string",
"$attribute"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L166-L173 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.setArrayAndCheckNull | private function setArrayAndCheckNull(array $data, $object, $attribute): array
{
$value = $this->setArray($object);
if ($this->checkNullForAttribute($value, $attribute) === false) {
$data[$attribute] = $value;
}
return $data;
} | php | private function setArrayAndCheckNull(array $data, $object, $attribute): array
{
$value = $this->setArray($object);
if ($this->checkNullForAttribute($value, $attribute) === false) {
$data[$attribute] = $value;
}
return $data;
} | [
"private",
"function",
"setArrayAndCheckNull",
"(",
"array",
"$",
"data",
",",
"$",
"object",
",",
"$",
"attribute",
")",
":",
"array",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"setArray",
"(",
"$",
"object",
")",
";",
"if",
"(",
"$",
"this",
"->",... | @param mixed[] $data
@param object $object
@param string $attribute
@return mixed[] | [
"@param",
"mixed",
"[]",
"$data",
"@param",
"object",
"$object",
"@param",
"string",
"$attribute"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L182-L191 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.setArrayAndCheckNullWithKey | private function setArrayAndCheckNullWithKey(array $data, $object, $key, $attribute): array
{
$value = $this->setArray($object);
if ($this->checkNullForAttribute($value, $key) === false) {
$data[$attribute][$key] = $value;
}
return $data;
} | php | private function setArrayAndCheckNullWithKey(array $data, $object, $key, $attribute): array
{
$value = $this->setArray($object);
if ($this->checkNullForAttribute($value, $key) === false) {
$data[$attribute][$key] = $value;
}
return $data;
} | [
"private",
"function",
"setArrayAndCheckNullWithKey",
"(",
"array",
"$",
"data",
",",
"$",
"object",
",",
"$",
"key",
",",
"$",
"attribute",
")",
":",
"array",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"setArray",
"(",
"$",
"object",
")",
";",
"if",
... | @param mixed[] $data
@param object $object
@param mixed $key
@param string $attribute
@return mixed[] | [
"@param",
"mixed",
"[]",
"$data",
"@param",
"object",
"$object",
"@param",
"mixed",
"$key",
"@param",
"string",
"$attribute"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L201-L210 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.processSerializeTypeHandler | private function processSerializeTypeHandler(Type\Handler $handler, $object, array $data, string $attribute): array
{
$value = $handler->serializer()->serialize($object);
if ($this->checkNullForAttribute($value, $attribute) === false) {
$data[$attribute] = $value;
}
ret... | php | private function processSerializeTypeHandler(Type\Handler $handler, $object, array $data, string $attribute): array
{
$value = $handler->serializer()->serialize($object);
if ($this->checkNullForAttribute($value, $attribute) === false) {
$data[$attribute] = $value;
}
ret... | [
"private",
"function",
"processSerializeTypeHandler",
"(",
"Type",
"\\",
"Handler",
"$",
"handler",
",",
"$",
"object",
",",
"array",
"$",
"data",
",",
"string",
"$",
"attribute",
")",
":",
"array",
"{",
"$",
"value",
"=",
"$",
"handler",
"->",
"serializer... | @param Type\Handler $handler
@param object $object
@param mixed[] $data
@param string $attribute
@return mixed[] | [
"@param",
"Type",
"\\",
"Handler",
"$handler",
"@param",
"object",
"$object",
"@param",
"mixed",
"[]",
"$data",
"@param",
"string",
"$attribute"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L220-L229 |
blackprism/serializer | src/Blackprism/Serializer/Json/Serialize.php | Serialize.checkNullForAttribute | protected function checkNullForAttribute($value, $attribute): bool
{
// We don't use $attribute here, we want filter all value with the same behavior
if ($value === null) {
return true;
}
if (is_array($value) === true && $value === []) {
return true;
... | php | protected function checkNullForAttribute($value, $attribute): bool
{
// We don't use $attribute here, we want filter all value with the same behavior
if ($value === null) {
return true;
}
if (is_array($value) === true && $value === []) {
return true;
... | [
"protected",
"function",
"checkNullForAttribute",
"(",
"$",
"value",
",",
"$",
"attribute",
")",
":",
"bool",
"{",
"// We don't use $attribute here, we want filter all value with the same behavior",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"return",
"true",
"... | Set attribute with value when value is not considered as a null value
@param mixed $value
@param string $attribute
@return bool | [
"Set",
"attribute",
"with",
"value",
"when",
"value",
"is",
"not",
"considered",
"as",
"a",
"null",
"value"
] | train | https://github.com/blackprism/serializer/blob/f5bd6ebeec802d2ad747daba7c9211b252ee4776/src/Blackprism/Serializer/Json/Serialize.php#L239-L255 |
comodojo/dispatcher.framework | src/Comodojo/Dispatcher/Response/Preprocessor/Status304.php | Status304.consolidate | public function consolidate(Response $response) {
$cleanup = [
'Allow',
'Content-Encoding',
'Content-Language',
'Content-Length',
'Content-MD5',
'Content-Type',
'Last-Modified'
];
foreach ($cleanup as $header)... | php | public function consolidate(Response $response) {
$cleanup = [
'Allow',
'Content-Encoding',
'Content-Language',
'Content-Length',
'Content-MD5',
'Content-Type',
'Last-Modified'
];
foreach ($cleanup as $header)... | [
"public",
"function",
"consolidate",
"(",
"Response",
"$",
"response",
")",
"{",
"$",
"cleanup",
"=",
"[",
"'Allow'",
",",
"'Content-Encoding'",
",",
"'Content-Language'",
",",
"'Content-Length'",
",",
"'Content-MD5'",
",",
"'Content-Type'",
",",
"'Last-Modified'",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/comodojo/dispatcher.framework/blob/5093297dcb7441a8d8f79cbb2429c93232e16d1c/src/Comodojo/Dispatcher/Response/Preprocessor/Status304.php#L28-L47 |
dragosprotung/stc-core | src/Workout/TrackPoint.php | TrackPoint.extension | public function extension($idExtension): ExtensionInterface
{
if ($this->hasExtension($idExtension) !== true) {
throw new \OutOfBoundsException(sprintf('Extension "%s" not found.', $idExtension));
}
return $this->extensions[$idExtension];
} | php | public function extension($idExtension): ExtensionInterface
{
if ($this->hasExtension($idExtension) !== true) {
throw new \OutOfBoundsException(sprintf('Extension "%s" not found.', $idExtension));
}
return $this->extensions[$idExtension];
} | [
"public",
"function",
"extension",
"(",
"$",
"idExtension",
")",
":",
"ExtensionInterface",
"{",
"if",
"(",
"$",
"this",
"->",
"hasExtension",
"(",
"$",
"idExtension",
")",
"!==",
"true",
")",
"{",
"throw",
"new",
"\\",
"OutOfBoundsException",
"(",
"sprintf"... | Get an extension by ID.
@param string $idExtension The ID of the extension.
@return ExtensionInterface
@throws \OutOfBoundsException If the extension is not found. | [
"Get",
"an",
"extension",
"by",
"ID",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/TrackPoint.php#L147-L154 |
dragosprotung/stc-core | src/Workout/TrackPoint.php | TrackPoint.distanceFromPoint | public function distanceFromPoint(TrackPoint $trackPoint): float
{
$earthRadius = 6371000;
$latFrom = deg2rad($this->latitude());
$lonFrom = deg2rad($this->longitude());
$latTo = deg2rad($trackPoint->latitude());
$lonTo = deg2rad($trackPoint->longitude());
$latDelta... | php | public function distanceFromPoint(TrackPoint $trackPoint): float
{
$earthRadius = 6371000;
$latFrom = deg2rad($this->latitude());
$lonFrom = deg2rad($this->longitude());
$latTo = deg2rad($trackPoint->latitude());
$lonTo = deg2rad($trackPoint->longitude());
$latDelta... | [
"public",
"function",
"distanceFromPoint",
"(",
"TrackPoint",
"$",
"trackPoint",
")",
":",
"float",
"{",
"$",
"earthRadius",
"=",
"6371000",
";",
"$",
"latFrom",
"=",
"deg2rad",
"(",
"$",
"this",
"->",
"latitude",
"(",
")",
")",
";",
"$",
"lonFrom",
"=",... | Get the distance between this point and another point in meters.
@param TrackPoint $trackPoint The other point.
@return float The distance in meters. | [
"Get",
"the",
"distance",
"between",
"this",
"point",
"and",
"another",
"point",
"in",
"meters",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/TrackPoint.php#L192-L212 |
dragosprotung/stc-core | src/Workout/TrackPoint.php | TrackPoint.speed | public function speed(TrackPoint $trackPoint): float
{
$start = $this->dateTime();
$end = $trackPoint->dateTime();
$dateDiff = $start->diff($end);
$secondsDifference = ($dateDiff->days * 86400) + ($dateDiff->h * 3600) + ($dateDiff->i * 60) + $dateDiff->s;
if ($secondsDiffere... | php | public function speed(TrackPoint $trackPoint): float
{
$start = $this->dateTime();
$end = $trackPoint->dateTime();
$dateDiff = $start->diff($end);
$secondsDifference = ($dateDiff->days * 86400) + ($dateDiff->h * 3600) + ($dateDiff->i * 60) + $dateDiff->s;
if ($secondsDiffere... | [
"public",
"function",
"speed",
"(",
"TrackPoint",
"$",
"trackPoint",
")",
":",
"float",
"{",
"$",
"start",
"=",
"$",
"this",
"->",
"dateTime",
"(",
")",
";",
"$",
"end",
"=",
"$",
"trackPoint",
"->",
"dateTime",
"(",
")",
";",
"$",
"dateDiff",
"=",
... | Get the speed between this point and another point in km/h.
@param TrackPoint $trackPoint The other point.
@return float | [
"Get",
"the",
"speed",
"between",
"this",
"point",
"and",
"another",
"point",
"in",
"km",
"/",
"h",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/TrackPoint.php#L220-L234 |
alexpts/psr15-middlewares | src/StaticHeader.php | StaticHeader.process | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
return $this->withStaticHeaders($response, $this->headers);
} | php | public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);
return $this->withStaticHeaders($response, $this->headers);
} | [
"public",
"function",
"process",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"RequestHandlerInterface",
"$",
"handler",
")",
":",
"ResponseInterface",
"{",
"$",
"response",
"=",
"$",
"handler",
"->",
"handle",
"(",
"$",
"request",
")",
";",
"return",
"... | @param ServerRequestInterface $request
@param RequestHandlerInterface $handler
@return ResponseInterface
@throws \InvalidArgumentException | [
"@param",
"ServerRequestInterface",
"$request",
"@param",
"RequestHandlerInterface",
"$handler"
] | train | https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/StaticHeader.php#L28-L33 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.