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 |
|---|---|---|---|---|---|---|---|---|---|---|
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.getUserCustomerRelationsJoinCustomer | public function getUserCustomerRelationsJoinCustomer($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = UserCustomerRelationQuery::create(null, $criteria);
$query->joinWith('Customer', $join_behavior);
return $this->getUserCustomerRelations($query, $con);
} | php | public function getUserCustomerRelationsJoinCustomer($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
{
$query = UserCustomerRelationQuery::create(null, $criteria);
$query->joinWith('Customer', $join_behavior);
return $this->getUserCustomerRelations($query, $con);
} | [
"public",
"function",
"getUserCustomerRelationsJoinCustomer",
"(",
"$",
"criteria",
"=",
"null",
",",
"$",
"con",
"=",
"null",
",",
"$",
"join_behavior",
"=",
"Criteria",
"::",
"LEFT_JOIN",
")",
"{",
"$",
"query",
"=",
"UserCustomerRelationQuery",
"::",
"create"... | If this collection has already been initialized with
an identical criteria, it returns the collection.
Otherwise if this User is new, it will return
an empty collection; or if this User has previously
been saved, it will retrieve related UserCustomerRelations from storage.
This method is protected by default in order ... | [
"If",
"this",
"collection",
"has",
"already",
"been",
"initialized",
"with",
"an",
"identical",
"criteria",
"it",
"returns",
"the",
"collection",
".",
"Otherwise",
"if",
"this",
"User",
"is",
"new",
"it",
"will",
"return",
"an",
"empty",
"collection",
";",
"... | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1849-L1855 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.getUserRoles | public function getUserRoles($criteria = null, PropelPDO $con = null)
{
$partial = $this->collUserRolesPartial && !$this->isNew();
if (null === $this->collUserRoles || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUserRoles) {
// return empt... | php | public function getUserRoles($criteria = null, PropelPDO $con = null)
{
$partial = $this->collUserRolesPartial && !$this->isNew();
if (null === $this->collUserRoles || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUserRoles) {
// return empt... | [
"public",
"function",
"getUserRoles",
"(",
"$",
"criteria",
"=",
"null",
",",
"PropelPDO",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collUserRolesPartial",
"&&",
"!",
"$",
"this",
"->",
"isNew",
"(",
")",
";",
"if",
... | Gets an array of UserRole objects which contain a foreign key that references this object.
If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Next time the same method is called without $criteria, the ... | [
"Gets",
"an",
"array",
"of",
"UserRole",
"objects",
"which",
"contain",
"a",
"foreign",
"key",
"that",
"references",
"this",
"object",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1919-L1962 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.clear | public function clear()
{
$this->id = null;
$this->username = null;
$this->password = null;
$this->salt = null;
$this->firstname = null;
$this->lastname = null;
$this->email = null;
$this->phone = null;
$this->memo = null;
$this->activa... | php | public function clear()
{
$this->id = null;
$this->username = null;
$this->password = null;
$this->salt = null;
$this->firstname = null;
$this->lastname = null;
$this->email = null;
$this->phone = null;
$this->memo = null;
$this->activa... | [
"public",
"function",
"clear",
"(",
")",
"{",
"$",
"this",
"->",
"id",
"=",
"null",
";",
"$",
"this",
"->",
"username",
"=",
"null",
";",
"$",
"this",
"->",
"password",
"=",
"null",
";",
"$",
"this",
"->",
"salt",
"=",
"null",
";",
"$",
"this",
... | Clears the current object and sets all attributes to their default values | [
"Clears",
"the",
"current",
"object",
"and",
"sets",
"all",
"attributes",
"to",
"their",
"default",
"values"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L2113-L2136 |
slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.clearAllReferences | public function clearAllReferences($deep = false)
{
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
if ($this->collUserCustomerRelations) {
foreach ($this->collUserCustomerRelations as $o) {
$o... | php | public function clearAllReferences($deep = false)
{
if ($deep && !$this->alreadyInClearAllReferencesDeep) {
$this->alreadyInClearAllReferencesDeep = true;
if ($this->collUserCustomerRelations) {
foreach ($this->collUserCustomerRelations as $o) {
$o... | [
"public",
"function",
"clearAllReferences",
"(",
"$",
"deep",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"deep",
"&&",
"!",
"$",
"this",
"->",
"alreadyInClearAllReferencesDeep",
")",
"{",
"$",
"this",
"->",
"alreadyInClearAllReferencesDeep",
"=",
"true",
";",
"... | Resets all references to other model objects or collections of model objects.
This method is a user-space workaround for PHP's inability to garbage collect
objects with circular references (even in PHP 5.3). This is currently necessary
when using Propel in certain daemon or large-volume/high-memory operations.
@param... | [
"Resets",
"all",
"references",
"to",
"other",
"model",
"objects",
"or",
"collections",
"of",
"model",
"objects",
"."
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L2147-L2173 |
ClanCats/Core | src/classes/CCProfiler.php | CCProfiler._init | public static function _init()
{
// is the profiler enabled?
if ( !static::$_enabled = ClanCats::$config->get( 'profiler.enabled' ) )
{
return;
}
// enable profiling only in development mode
if ( ClanCats::in_development() )
{
// add a hook to the resposne so that we can
// append a t... | php | public static function _init()
{
// is the profiler enabled?
if ( !static::$_enabled = ClanCats::$config->get( 'profiler.enabled' ) )
{
return;
}
// enable profiling only in development mode
if ( ClanCats::in_development() )
{
// add a hook to the resposne so that we can
// append a t... | [
"public",
"static",
"function",
"_init",
"(",
")",
"{",
"// is the profiler enabled?",
"if",
"(",
"!",
"static",
"::",
"$",
"_enabled",
"=",
"ClanCats",
"::",
"$",
"config",
"->",
"get",
"(",
"'profiler.enabled'",
")",
")",
"{",
"return",
";",
"}",
"// ena... | The Autoloader initialisation
@return void | [
"The",
"Autoloader",
"initialisation"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCProfiler.php#L34-L87 |
ClanCats/Core | src/classes/CCProfiler.php | CCProfiler.memory | public static function memory( $format = false )
{
$memory = memory_get_usage() - CCF_PROFILER_MEM;
if ( $format )
{
return CCStr::bytes( $memory );
}
return $memory;
} | php | public static function memory( $format = false )
{
$memory = memory_get_usage() - CCF_PROFILER_MEM;
if ( $format )
{
return CCStr::bytes( $memory );
}
return $memory;
} | [
"public",
"static",
"function",
"memory",
"(",
"$",
"format",
"=",
"false",
")",
"{",
"$",
"memory",
"=",
"memory_get_usage",
"(",
")",
"-",
"CCF_PROFILER_MEM",
";",
"if",
"(",
"$",
"format",
")",
"{",
"return",
"CCStr",
"::",
"bytes",
"(",
"$",
"memor... | returns current memory usage
@param bool $format
@return string | [
"returns",
"current",
"memory",
"usage"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCProfiler.php#L135-L145 |
ClanCats/Core | src/classes/CCProfiler.php | CCProfiler.time | public static function time( $format = false )
{
$time = microtime( true ) - CCF_PROFILER_TME;
if ( $format )
{
return CCStr::microtime( $time );
}
return $time;
} | php | public static function time( $format = false )
{
$time = microtime( true ) - CCF_PROFILER_TME;
if ( $format )
{
return CCStr::microtime( $time );
}
return $time;
} | [
"public",
"static",
"function",
"time",
"(",
"$",
"format",
"=",
"false",
")",
"{",
"$",
"time",
"=",
"microtime",
"(",
"true",
")",
"-",
"CCF_PROFILER_TME",
";",
"if",
"(",
"$",
"format",
")",
"{",
"return",
"CCStr",
"::",
"microtime",
"(",
"$",
"ti... | returns current execution time
@param bool $format
@return string | [
"returns",
"current",
"execution",
"time"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCProfiler.php#L153-L163 |
PortaText/php-sdk | src/PortaText/Command/Api/Jobs.php | Jobs.getEndpoint | protected function getEndpoint($method)
{
$endpoint = "jobs";
$jobId = $this->getArgument("id");
if (!is_null($jobId)) {
$endpoint .= "/$jobId";
$this->delArgument("id");
}
$page = $this->getArgument("page");
$this->delArgument("page");
... | php | protected function getEndpoint($method)
{
$endpoint = "jobs";
$jobId = $this->getArgument("id");
if (!is_null($jobId)) {
$endpoint .= "/$jobId";
$this->delArgument("id");
}
$page = $this->getArgument("page");
$this->delArgument("page");
... | [
"protected",
"function",
"getEndpoint",
"(",
"$",
"method",
")",
"{",
"$",
"endpoint",
"=",
"\"jobs\"",
";",
"$",
"jobId",
"=",
"$",
"this",
"->",
"getArgument",
"(",
"\"id\"",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"jobId",
")",
")",
"{",
... | Returns a string with the endpoint for the given command.
@param string $method Method for this command.
@return string | [
"Returns",
"a",
"string",
"with",
"the",
"endpoint",
"for",
"the",
"given",
"command",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Jobs.php#L63-L80 |
miisieq/InfaktClient | src/Infakt/Mapper/VatRateMapper.php | VatRateMapper.map | public function map($data)
{
return (new VatRate())
->setId((int) $data['id'])
->setRate((float) $data['rate'])
->setName($data['name'])
->setSymbol($data['symbol']);
} | php | public function map($data)
{
return (new VatRate())
->setId((int) $data['id'])
->setRate((float) $data['rate'])
->setName($data['name'])
->setSymbol($data['symbol']);
} | [
"public",
"function",
"map",
"(",
"$",
"data",
")",
"{",
"return",
"(",
"new",
"VatRate",
"(",
")",
")",
"->",
"setId",
"(",
"(",
"int",
")",
"$",
"data",
"[",
"'id'",
"]",
")",
"->",
"setRate",
"(",
"(",
"float",
")",
"$",
"data",
"[",
"'rate'... | {@inheritdoc}
@param $data
@return VatRate | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/miisieq/InfaktClient/blob/5f0ae58c7be32580f3c92c2a7e7a7808d83d4e81/src/Infakt/Mapper/VatRateMapper.php#L18-L25 |
kherge-abandoned/php-wise | src/lib/Herrera/Wise/Loader/AbstractFileLoader.php | AbstractFileLoader.doReplace | public function doReplace($input, $data, $global)
{
preg_match_all(
'/%(?P<reference>[^%]+)%/',
$input,
$matches
);
if (false === empty($matches['reference'])) {
foreach ($matches['reference'] as $reference) {
try {
... | php | public function doReplace($input, $data, $global)
{
preg_match_all(
'/%(?P<reference>[^%]+)%/',
$input,
$matches
);
if (false === empty($matches['reference'])) {
foreach ($matches['reference'] as $reference) {
try {
... | [
"public",
"function",
"doReplace",
"(",
"$",
"input",
",",
"$",
"data",
",",
"$",
"global",
")",
"{",
"preg_match_all",
"(",
"'/%(?P<reference>[^%]+)%/'",
",",
"$",
"input",
",",
"$",
"matches",
")",
";",
"if",
"(",
"false",
"===",
"empty",
"(",
"$",
"... | Replace the placeholder value(s).
@param mixed $input The input.
@param array $data The data the input is from.
@param array $global The global values.
@return mixed The result.
@throws InvalidReferenceException If an invalid reference is used. | [
"Replace",
"the",
"placeholder",
"value",
"(",
"s",
")",
"."
] | train | https://github.com/kherge-abandoned/php-wise/blob/7621e0be7dbb2a015d68197d290fe8469f539a4d/src/lib/Herrera/Wise/Loader/AbstractFileLoader.php#L48-L86 |
kherge-abandoned/php-wise | src/lib/Herrera/Wise/Loader/AbstractFileLoader.php | AbstractFileLoader.load | public function load($resource, $type = null)
{
$file = $this->locator->locate($resource, $type);
if ($this->collector) {
$this->collector->addResource(new FileResource($file));
}
$data = $this->doLoad($file);
return $this->process($data, $resource);
} | php | public function load($resource, $type = null)
{
$file = $this->locator->locate($resource, $type);
if ($this->collector) {
$this->collector->addResource(new FileResource($file));
}
$data = $this->doLoad($file);
return $this->process($data, $resource);
} | [
"public",
"function",
"load",
"(",
"$",
"resource",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"locator",
"->",
"locate",
"(",
"$",
"resource",
",",
"$",
"type",
")",
";",
"if",
"(",
"$",
"this",
"->",
"collecto... | {@inheritDoc} | [
"{"
] | train | https://github.com/kherge-abandoned/php-wise/blob/7621e0be7dbb2a015d68197d290fe8469f539a4d/src/lib/Herrera/Wise/Loader/AbstractFileLoader.php#L107-L118 |
kherge-abandoned/php-wise | src/lib/Herrera/Wise/Loader/AbstractFileLoader.php | AbstractFileLoader.process | public function process($data, $file)
{
if (empty($data)) {
return array();
}
if (isset($data['imports'])) {
if (false === is_array($data['imports'])) {
throw ImportException::format(
'The "imports" value is not valid in "%s".',
... | php | public function process($data, $file)
{
if (empty($data)) {
return array();
}
if (isset($data['imports'])) {
if (false === is_array($data['imports'])) {
throw ImportException::format(
'The "imports" value is not valid in "%s".',
... | [
"public",
"function",
"process",
"(",
"$",
"data",
",",
"$",
"file",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"data",
"[",
"'imports'",
"]",
")",
")",
... | Imports other configuration files and resolves references.
@param array $data The data.
@param string $file The file source.
@return array The processed data.
@throws ImportException If "imports" is invalid.
@throws InvalidReferenceException If an invalid reference is used. | [
"Imports",
"other",
"configuration",
"files",
"and",
"resolves",
"references",
"."
] | train | https://github.com/kherge-abandoned/php-wise/blob/7621e0be7dbb2a015d68197d290fe8469f539a4d/src/lib/Herrera/Wise/Loader/AbstractFileLoader.php#L131-L195 |
kherge-abandoned/php-wise | src/lib/Herrera/Wise/Loader/AbstractFileLoader.php | AbstractFileLoader.resolveReference | public function resolveReference($reference, $values)
{
foreach (explode('.', $reference) as $leaf) {
if ((!is_array($values) && !($values instanceof ArrayAccess))
|| (is_array($values) && !array_key_exists($leaf, $values))
|| (($values instanceof ArrayAccess) && ... | php | public function resolveReference($reference, $values)
{
foreach (explode('.', $reference) as $leaf) {
if ((!is_array($values) && !($values instanceof ArrayAccess))
|| (is_array($values) && !array_key_exists($leaf, $values))
|| (($values instanceof ArrayAccess) && ... | [
"public",
"function",
"resolveReference",
"(",
"$",
"reference",
",",
"$",
"values",
")",
"{",
"foreach",
"(",
"explode",
"(",
"'.'",
",",
"$",
"reference",
")",
"as",
"$",
"leaf",
")",
"{",
"if",
"(",
"(",
"!",
"is_array",
"(",
"$",
"values",
")",
... | Resolves the reference and returns its value.
@param string $reference A reference.
@param array|ArrayAccess $values A list of values.
@return mixed The referenced value.
@throws InvalidReferenceException If the reference is not valid. | [
"Resolves",
"the",
"reference",
"and",
"returns",
"its",
"value",
"."
] | train | https://github.com/kherge-abandoned/php-wise/blob/7621e0be7dbb2a015d68197d290fe8469f539a4d/src/lib/Herrera/Wise/Loader/AbstractFileLoader.php#L207-L224 |
nyeholt/silverstripe-external-content | code/model/ExternalContent.php | ExternalContent.getDataObjectFor | public static function getDataObjectFor($id) {
if ($id == 'root') {
return null;
}
$obj = null;
if (preg_match(self::ID_FORMAT, $id, $matches)) {
$id = $matches[1];
$composed = isset($matches[2]) ? trim($matches[2], self::ID_SEPARATOR) : null;
$obj = DataObject::get_by_id(self::DEFAULT_CLASS, $id)... | php | public static function getDataObjectFor($id) {
if ($id == 'root') {
return null;
}
$obj = null;
if (preg_match(self::ID_FORMAT, $id, $matches)) {
$id = $matches[1];
$composed = isset($matches[2]) ? trim($matches[2], self::ID_SEPARATOR) : null;
$obj = DataObject::get_by_id(self::DEFAULT_CLASS, $id)... | [
"public",
"static",
"function",
"getDataObjectFor",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"id",
"==",
"'root'",
")",
"{",
"return",
"null",
";",
"}",
"$",
"obj",
"=",
"null",
";",
"if",
"(",
"preg_match",
"(",
"self",
"::",
"ID_FORMAT",
",",
"$... | Get the actual object based on a composite ID
Don't really want to use a static, but SS's data object
retrieval system doesn't really provide a nice override
mechanism other than useCustomObject
@param String $id
The compound ID to get a data object for
@return DataObject | [
"Get",
"the",
"actual",
"object",
"based",
"on",
"a",
"composite",
"ID"
] | train | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContent.php#L47-L66 |
alphayax/phpdoc_md | src/MdGen.php | MdGen.loadClasses | protected function loadClasses(){
if( ! is_dir( $this->srcDirectory)){
throw new \Exception( 'Source directory not found : '. $this->srcDirectory);
}
$objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator( $this->srcDirectory), \RecursiveIteratorIterator::SELF_FIR... | php | protected function loadClasses(){
if( ! is_dir( $this->srcDirectory)){
throw new \Exception( 'Source directory not found : '. $this->srcDirectory);
}
$objects = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator( $this->srcDirectory), \RecursiveIteratorIterator::SELF_FIR... | [
"protected",
"function",
"loadClasses",
"(",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"srcDirectory",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Source directory not found : '",
".",
"$",
"this",
"->",
"srcDirectory",
")",
... | Load class in the source directory | [
"Load",
"class",
"in",
"the",
"source",
"directory"
] | train | https://github.com/alphayax/phpdoc_md/blob/326da10b837161591a32ab4f36f9b2f4feabbe65/src/MdGen.php#L39-L56 |
alphayax/phpdoc_md | src/MdGen.php | MdGen.filterNamespace | public function filterNamespace( $namespaceName) {
$FilteredClasses = [];
foreach( $this->loadedClasses as $loadedClass){
if( 0 == substr_compare( $loadedClass, $namespaceName, 0, strlen( $namespaceName))){
$FilteredClasses[] = $loadedClass;
}
}
$t... | php | public function filterNamespace( $namespaceName) {
$FilteredClasses = [];
foreach( $this->loadedClasses as $loadedClass){
if( 0 == substr_compare( $loadedClass, $namespaceName, 0, strlen( $namespaceName))){
$FilteredClasses[] = $loadedClass;
}
}
$t... | [
"public",
"function",
"filterNamespace",
"(",
"$",
"namespaceName",
")",
"{",
"$",
"FilteredClasses",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadedClasses",
"as",
"$",
"loadedClass",
")",
"{",
"if",
"(",
"0",
"==",
"substr_compare",
"(",
... | Filter class who are in a specific namespace
@param $namespaceName | [
"Filter",
"class",
"who",
"are",
"in",
"a",
"specific",
"namespace"
] | train | https://github.com/alphayax/phpdoc_md/blob/326da10b837161591a32ab4f36f9b2f4feabbe65/src/MdGen.php#L62-L70 |
alphayax/phpdoc_md | src/MdGen.php | MdGen.filterSubClasses | public function filterSubClasses( $className) {
$FilteredClasses = [];
foreach( $this->loadedClasses as $loadedClass){
if( is_subclass_of( $loadedClass, $className)){
$FilteredClasses[] = $loadedClass;
}
}
$this->loadedClasses = $FilteredClasses;
... | php | public function filterSubClasses( $className) {
$FilteredClasses = [];
foreach( $this->loadedClasses as $loadedClass){
if( is_subclass_of( $loadedClass, $className)){
$FilteredClasses[] = $loadedClass;
}
}
$this->loadedClasses = $FilteredClasses;
... | [
"public",
"function",
"filterSubClasses",
"(",
"$",
"className",
")",
"{",
"$",
"FilteredClasses",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadedClasses",
"as",
"$",
"loadedClass",
")",
"{",
"if",
"(",
"is_subclass_of",
"(",
"$",
"loadedCla... | Filter class who are sub-classes of a specific class
@param $className | [
"Filter",
"class",
"who",
"are",
"sub",
"-",
"classes",
"of",
"a",
"specific",
"class"
] | train | https://github.com/alphayax/phpdoc_md/blob/326da10b837161591a32ab4f36f9b2f4feabbe65/src/MdGen.php#L76-L84 |
alphayax/phpdoc_md | src/MdGen.php | MdGen.generate | public function generate( $directory = '.'){
$chapters = $this->generateClassMdFromLoadedClasses();
$this->rootPage = new models\NamespaceMd( $this->rootNamespace, $chapters);
$this->rootPage->setDirectory( $directory);
$this->rootPage->write();
} | php | public function generate( $directory = '.'){
$chapters = $this->generateClassMdFromLoadedClasses();
$this->rootPage = new models\NamespaceMd( $this->rootNamespace, $chapters);
$this->rootPage->setDirectory( $directory);
$this->rootPage->write();
} | [
"public",
"function",
"generate",
"(",
"$",
"directory",
"=",
"'.'",
")",
"{",
"$",
"chapters",
"=",
"$",
"this",
"->",
"generateClassMdFromLoadedClasses",
"(",
")",
";",
"$",
"this",
"->",
"rootPage",
"=",
"new",
"models",
"\\",
"NamespaceMd",
"(",
"$",
... | Generate markdown files
@param string $directory | [
"Generate",
"markdown",
"files"
] | train | https://github.com/alphayax/phpdoc_md/blob/326da10b837161591a32ab4f36f9b2f4feabbe65/src/MdGen.php#L102-L107 |
Chill-project/Main | Controller/CenterController.php | CenterController.createCreateForm | private function createCreateForm(Center $center)
{
$form = $this->createForm(new CenterType(), $center, array(
'action' => $this->generateUrl('admin_center_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Create'));
return ... | php | private function createCreateForm(Center $center)
{
$form = $this->createForm(new CenterType(), $center, array(
'action' => $this->generateUrl('admin_center_create'),
'method' => 'POST',
));
$form->add('submit', 'submit', array('label' => 'Create'));
return ... | [
"private",
"function",
"createCreateForm",
"(",
"Center",
"$",
"center",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"CenterType",
"(",
")",
",",
"$",
"center",
",",
"array",
"(",
"'action'",
"=>",
"$",
"this",
"->",
"gener... | Creates a form to create a Center entity.
@param Center $center The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"create",
"a",
"Center",
"entity",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/CenterController.php#L63-L73 |
Chill-project/Main | Controller/CenterController.php | CenterController.newAction | public function newAction()
{
$center = new Center();
$form = $this->createCreateForm($center);
return $this->render('ChillMainBundle:Center:new.html.twig', array(
'entity' => $center,
'form' => $form->createView(),
));
} | php | public function newAction()
{
$center = new Center();
$form = $this->createCreateForm($center);
return $this->render('ChillMainBundle:Center:new.html.twig', array(
'entity' => $center,
'form' => $form->createView(),
));
} | [
"public",
"function",
"newAction",
"(",
")",
"{",
"$",
"center",
"=",
"new",
"Center",
"(",
")",
";",
"$",
"form",
"=",
"$",
"this",
"->",
"createCreateForm",
"(",
"$",
"center",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"'ChillMainBundle:C... | Displays a form to create a new Center entity. | [
"Displays",
"a",
"form",
"to",
"create",
"a",
"new",
"Center",
"entity",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/CenterController.php#L79-L88 |
Chill-project/Main | Controller/CenterController.php | CenterController.createEditForm | private function createEditForm(Center $center)
{
$form = $this->createForm(new CenterType(), $center, array(
'action' => $this->generateUrl('admin_center_update', array('id' => $center->getId())),
'method' => 'PUT',
));
$form->add('submit', 'submit', array('label' =... | php | private function createEditForm(Center $center)
{
$form = $this->createForm(new CenterType(), $center, array(
'action' => $this->generateUrl('admin_center_update', array('id' => $center->getId())),
'method' => 'PUT',
));
$form->add('submit', 'submit', array('label' =... | [
"private",
"function",
"createEditForm",
"(",
"Center",
"$",
"center",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"CenterType",
"(",
")",
",",
"$",
"center",
",",
"array",
"(",
"'action'",
"=>",
"$",
"this",
"->",
"generat... | Creates a form to edit a Center entity.
@param Center $center The entity
@return \Symfony\Component\Form\Form The form | [
"Creates",
"a",
"form",
"to",
"edit",
"a",
"Center",
"entity",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/CenterController.php#L137-L147 |
Chill-project/Main | Controller/CenterController.php | CenterController.updateAction | public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$center = $em->getRepository('ChillMainBundle:Center')->find($id);
if (!$center) {
throw $this->createNotFoundException('Unable to find Center entity.');
}
$editForm... | php | public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$center = $em->getRepository('ChillMainBundle:Center')->find($id);
if (!$center) {
throw $this->createNotFoundException('Unable to find Center entity.');
}
$editForm... | [
"public",
"function",
"updateAction",
"(",
"Request",
"$",
"request",
",",
"$",
"id",
")",
"{",
"$",
"em",
"=",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
";",
"$",
"center",
"=",
"$",
"em",
"->",
"getRepository",
"(",
... | Edits an existing Center entity. | [
"Edits",
"an",
"existing",
"Center",
"entity",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/CenterController.php#L152-L175 |
shinjin/freezer | src/Freezer.php | Freezer.freeze | public function freeze($object, array &$objects = array())
{
if (!is_object($object)) {
throw new InvalidArgumentException(1, 'object');
}
if ($object instanceof LazyProxy) {
if ($object->isThawed()) {
$object = $object->getObject();
} els... | php | public function freeze($object, array &$objects = array())
{
if (!is_object($object)) {
throw new InvalidArgumentException(1, 'object');
}
if ($object instanceof LazyProxy) {
if ($object->isThawed()) {
$object = $object->getObject();
} els... | [
"public",
"function",
"freeze",
"(",
"$",
"object",
",",
"array",
"&",
"$",
"objects",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"1",
",",
"'obje... | Freezes an object.
@param object $object The object that is to be frozen.
@param array $objects Only used internally.
@return array The frozen object(s).
@throws InvalidArgumentException | [
"Freezes",
"an",
"object",
"."
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Freezer.php#L54-L112 |
shinjin/freezer | src/Freezer.php | Freezer.freezeArray | protected function freezeArray(array &$array, array &$objects)
{
foreach ($array as &$value) {
if (is_array($value)) {
$this->freezeArray($value, $objects);
} elseif (is_object($value)) {
list($id,) = array_values($this->freeze($value, $objects));
... | php | protected function freezeArray(array &$array, array &$objects)
{
foreach ($array as &$value) {
if (is_array($value)) {
$this->freezeArray($value, $objects);
} elseif (is_object($value)) {
list($id,) = array_values($this->freeze($value, $objects));
... | [
"protected",
"function",
"freezeArray",
"(",
"array",
"&",
"$",
"array",
",",
"array",
"&",
"$",
"objects",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"... | Freezes an array.
@param array $array The array that is to be frozen.
@param array $objects Only used internally. | [
"Freezes",
"an",
"array",
"."
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Freezer.php#L120-L130 |
shinjin/freezer | src/Freezer.php | Freezer.thaw | public function thaw(array $frozenObject, $root = null, array &$objects = array())
{
foreach ($frozenObject['objects'] as $object) {
if (!class_exists($object['class'], $this->useAutoload)) {
throw new \RuntimeException(
sprintf('Class "%s" could not be found.... | php | public function thaw(array $frozenObject, $root = null, array &$objects = array())
{
foreach ($frozenObject['objects'] as $object) {
if (!class_exists($object['class'], $this->useAutoload)) {
throw new \RuntimeException(
sprintf('Class "%s" could not be found.... | [
"public",
"function",
"thaw",
"(",
"array",
"$",
"frozenObject",
",",
"$",
"root",
"=",
"null",
",",
"array",
"&",
"$",
"objects",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"frozenObject",
"[",
"'objects'",
"]",
"as",
"$",
"object",
")",... | Thaws an object.
@param array $frozenObject The frozen object that should be thawed.
@param string $root The UUID of the object that should be
treated as the root object when multiple
objects are present in $frozenObject.
@param array $objects Only used internally.
@return object Th... | [
"Thaws",
"an",
"object",
"."
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Freezer.php#L143-L193 |
shinjin/freezer | src/Freezer.php | Freezer.generateHash | public function generateHash($object)
{
if (!is_object($object)) {
throw new InvalidArgumentException(1, 'object');
}
$properties = call_user_func($this->propertyReader, $object);
ksort($properties);
if (isset($properties['__freezer'])) {
unset($prop... | php | public function generateHash($object)
{
if (!is_object($object)) {
throw new InvalidArgumentException(1, 'object');
}
$properties = call_user_func($this->propertyReader, $object);
ksort($properties);
if (isset($properties['__freezer'])) {
unset($prop... | [
"public",
"function",
"generateHash",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"1",
",",
"'object'",
")",
";",
"}",
"$",
"properties",
"=",
"call_user_f... | Hashes an object using the SHA1 hashing function on the property values
of an object without recursing into aggregated arrays or objects.
@param object $object The object that is to be hashed.
@return string
@throws InvalidArgumentException | [
"Hashes",
"an",
"object",
"using",
"the",
"SHA1",
"hashing",
"function",
"on",
"the",
"property",
"values",
"of",
"an",
"object",
"without",
"recursing",
"into",
"aggregated",
"arrays",
"or",
"objects",
"."
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Freezer.php#L301-L329 |
shinjin/freezer | src/Freezer.php | Freezer.generateId | public function generateId()
{
$data = openssl_random_pseudo_bytes(16);
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
} | php | public function generateId()
{
$data = openssl_random_pseudo_bytes(16);
$data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100
$data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
} | [
"public",
"function",
"generateId",
"(",
")",
"{",
"$",
"data",
"=",
"openssl_random_pseudo_bytes",
"(",
"16",
")",
";",
"$",
"data",
"[",
"6",
"]",
"=",
"chr",
"(",
"ord",
"(",
"$",
"data",
"[",
"6",
"]",
")",
"&",
"0x0f",
"|",
"0x40",
")",
";",... | This implementation of UUID generation is based on code from an answer
on stackoverflow.
@return string
@link https://stackoverflow.com/a/15875555 | [
"This",
"implementation",
"of",
"UUID",
"generation",
"is",
"based",
"on",
"code",
"from",
"an",
"answer",
"on",
"stackoverflow",
"."
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Freezer.php#L338-L345 |
shinjin/freezer | src/Freezer.php | Freezer.isDirty | public function isDirty($object, $rehash = false)
{
if (!is_object($object)) {
throw new InvalidArgumentException(1, 'object');
}
if (!is_bool($rehash)) {
throw new InvalidArgumentException(2, 'boolean');
}
$isDirty = true;
if (isset($object... | php | public function isDirty($object, $rehash = false)
{
if (!is_object($object)) {
throw new InvalidArgumentException(1, 'object');
}
if (!is_bool($rehash)) {
throw new InvalidArgumentException(2, 'boolean');
}
$isDirty = true;
if (isset($object... | [
"public",
"function",
"isDirty",
"(",
"$",
"object",
",",
"$",
"rehash",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"1",
",",
"'object'",
")",
";",
"}",
"if... | Checks whether an object is dirty, ie. if its SHA1 hash is still valid.
Returns true when the object's __freezer['hash'] value is no longer
valid or does not exist.
Returns false when the object's __freezer['hash'] value is still valid.
@param object $object The object that is to be checked.
@param boolean $rehash... | [
"Checks",
"whether",
"an",
"object",
"is",
"dirty",
"ie",
".",
"if",
"its",
"SHA1",
"hash",
"is",
"still",
"valid",
"."
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Freezer.php#L359-L385 |
shinjin/freezer | src/Freezer.php | Freezer.readProperties | public function readProperties($object)
{
if (!is_object($object)) {
throw new InvalidArgumentException(1, 'object');
}
$reflector = new \ReflectionObject($object);
$result = array();
// Iterate over the properties of the object.
foreach ($reflector->... | php | public function readProperties($object)
{
if (!is_object($object)) {
throw new InvalidArgumentException(1, 'object');
}
$reflector = new \ReflectionObject($object);
$result = array();
// Iterate over the properties of the object.
foreach ($reflector->... | [
"public",
"function",
"readProperties",
"(",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"is_object",
"(",
"$",
"object",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"1",
",",
"'object'",
")",
";",
"}",
"$",
"reflector",
"=",
"new",
"\... | Returns an associative array of all properties of an object,
including those declared as protected or private.
@param object $object The object for which all properties are returned.
@return array
@throws InvalidArgumentException | [
"Returns",
"an",
"associative",
"array",
"of",
"all",
"properties",
"of",
"an",
"object",
"including",
"those",
"declared",
"as",
"protected",
"or",
"private",
"."
] | train | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Freezer.php#L395-L411 |
SignpostMarv/daft-object | src/DefinitionAssistant.php | DefinitionAssistant.RegisterAbstractDaftObjectType | public static function RegisterAbstractDaftObjectType(string $maybe) : string
{
/**
* @var array<int, string>
*/
$props = $maybe::DaftObjectProperties();
/**
* @psalm-var class-string<A>
*/
$maybe = static::RegisterDaftObjectTypeFromTypeAndProps($mayb... | php | public static function RegisterAbstractDaftObjectType(string $maybe) : string
{
/**
* @var array<int, string>
*/
$props = $maybe::DaftObjectProperties();
/**
* @psalm-var class-string<A>
*/
$maybe = static::RegisterDaftObjectTypeFromTypeAndProps($mayb... | [
"public",
"static",
"function",
"RegisterAbstractDaftObjectType",
"(",
"string",
"$",
"maybe",
")",
":",
"string",
"{",
"/**\n * @var array<int, string>\n */",
"$",
"props",
"=",
"$",
"maybe",
"::",
"DaftObjectProperties",
"(",
")",
";",
"/**\n * @p... | @template A as AbstractDaftObject
@psalm-param class-string<A> $maybe
@psalm-return class-string<A> | [
"@template",
"A",
"as",
"AbstractDaftObject"
] | train | https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/DefinitionAssistant.php#L41-L54 |
SignpostMarv/daft-object | src/DefinitionAssistant.php | DefinitionAssistant.ObtainExpectedProperties | public static function ObtainExpectedProperties($maybe) : array
{
/**
* @psalm-var class-string<T>
*/
$maybe = is_string($maybe) ? $maybe : get_class($maybe);
$maybe = self::MaybeRegisterAdditionalTypes($maybe);
return parent::ObtainExpectedProperties($maybe);
} | php | public static function ObtainExpectedProperties($maybe) : array
{
/**
* @psalm-var class-string<T>
*/
$maybe = is_string($maybe) ? $maybe : get_class($maybe);
$maybe = self::MaybeRegisterAdditionalTypes($maybe);
return parent::ObtainExpectedProperties($maybe);
} | [
"public",
"static",
"function",
"ObtainExpectedProperties",
"(",
"$",
"maybe",
")",
":",
"array",
"{",
"/**\n * @psalm-var class-string<T>\n */",
"$",
"maybe",
"=",
"is_string",
"(",
"$",
"maybe",
")",
"?",
"$",
"maybe",
":",
"get_class",
"(",
"$",
... | {@inheritdoc}
@psalm-param class-string<T>|T $maybe | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/DefinitionAssistant.php#L61-L71 |
SignpostMarv/daft-object | src/DefinitionAssistant.php | DefinitionAssistant.MaybeThrowIfValueDoesNotMatchMultiTypedArray | public static function MaybeThrowIfValueDoesNotMatchMultiTypedArray(
bool $autoTrimStrings,
bool $throwIfNotUnique,
$value,
string ...$types
) : array {
if ( ! is_array($value)) {
throw new InvalidArgumentException(
'Argument 3 passed to ' .
... | php | public static function MaybeThrowIfValueDoesNotMatchMultiTypedArray(
bool $autoTrimStrings,
bool $throwIfNotUnique,
$value,
string ...$types
) : array {
if ( ! is_array($value)) {
throw new InvalidArgumentException(
'Argument 3 passed to ' .
... | [
"public",
"static",
"function",
"MaybeThrowIfValueDoesNotMatchMultiTypedArray",
"(",
"bool",
"$",
"autoTrimStrings",
",",
"bool",
"$",
"throwIfNotUnique",
",",
"$",
"value",
",",
"string",
"...",
"$",
"types",
")",
":",
"array",
"{",
"if",
"(",
"!",
"is_array",
... | @param scalar|array|object|null $value
@return array<int, scalar|array|object|null> filtered $value | [
"@param",
"scalar|array|object|null",
"$value"
] | train | https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/DefinitionAssistant.php#L102-L129 |
SignpostMarv/daft-object | src/DefinitionAssistant.php | DefinitionAssistant.RegisterDaftObjectTypeFromTypeAndProps | protected static function RegisterDaftObjectTypeFromTypeAndProps(
string $maybe,
string $prop,
string ...$props
) : string {
array_unshift($props, $prop);
$args = static::TypeAndGetterAndSetterClosureWithProps($maybe, ...$props);
/**
* @var array<int, string... | php | protected static function RegisterDaftObjectTypeFromTypeAndProps(
string $maybe,
string $prop,
string ...$props
) : string {
array_unshift($props, $prop);
$args = static::TypeAndGetterAndSetterClosureWithProps($maybe, ...$props);
/**
* @var array<int, string... | [
"protected",
"static",
"function",
"RegisterDaftObjectTypeFromTypeAndProps",
"(",
"string",
"$",
"maybe",
",",
"string",
"$",
"prop",
",",
"string",
"...",
"$",
"props",
")",
":",
"string",
"{",
"array_unshift",
"(",
"$",
"props",
",",
"$",
"prop",
")",
";",... | @psalm-param class-string<T> $maybe
@psalm-return class-string<T> | [
"@psalm",
"-",
"param",
"class",
"-",
"string<T",
">",
"$maybe"
] | train | https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/DefinitionAssistant.php#L136-L155 |
SignpostMarv/daft-object | src/DefinitionAssistant.php | DefinitionAssistant.TypeAndGetterAndSetterClosureWithProps | private static function TypeAndGetterAndSetterClosureWithProps(
string $type,
string ...$props
) : array {
/**
* @psalm-var array{0:class-string<T>, 1:null|Closure(string):?string, 2:null|Closure(string):?string, 4:string}
*/
$out = array_merge(
[
... | php | private static function TypeAndGetterAndSetterClosureWithProps(
string $type,
string ...$props
) : array {
/**
* @psalm-var array{0:class-string<T>, 1:null|Closure(string):?string, 2:null|Closure(string):?string, 4:string}
*/
$out = array_merge(
[
... | [
"private",
"static",
"function",
"TypeAndGetterAndSetterClosureWithProps",
"(",
"string",
"$",
"type",
",",
"string",
"...",
"$",
"props",
")",
":",
"array",
"{",
"/**\n * @psalm-var array{0:class-string<T>, 1:null|Closure(string):?string, 2:null|Closure(string):?string, 4:s... | @psalm-param class-string<T> $type
@psalm-return array{0:class-string<T>, 1:null|Closure(string):?string, 2:null|Closure(string):?string, 4:string} | [
"@psalm",
"-",
"param",
"class",
"-",
"string<T",
">",
"$type"
] | train | https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/DefinitionAssistant.php#L172-L189 |
SignpostMarv/daft-object | src/DefinitionAssistant.php | DefinitionAssistant.MaybeThrowIfValueDoesNotMatchMultiTypedArrayValueArray | private static function MaybeThrowIfValueDoesNotMatchMultiTypedArrayValueArray(
bool $autoTrimStrings,
bool $throwIfNotUnique,
array $value,
string ...$types
) : array {
$value = static::MaybeThrowIfNotArrayIntKeys($value);
$value = static::MaybeThrowIfValueArrayDoesN... | php | private static function MaybeThrowIfValueDoesNotMatchMultiTypedArrayValueArray(
bool $autoTrimStrings,
bool $throwIfNotUnique,
array $value,
string ...$types
) : array {
$value = static::MaybeThrowIfNotArrayIntKeys($value);
$value = static::MaybeThrowIfValueArrayDoesN... | [
"private",
"static",
"function",
"MaybeThrowIfValueDoesNotMatchMultiTypedArrayValueArray",
"(",
"bool",
"$",
"autoTrimStrings",
",",
"bool",
"$",
"throwIfNotUnique",
",",
"array",
"$",
"value",
",",
"string",
"...",
"$",
"types",
")",
":",
"array",
"{",
"$",
"valu... | @param (scalar|array|object|null)[] $value
@return array<int, scalar|array|object|null> filtered $value | [
"@param",
"(",
"scalar|array|object|null",
")",
"[]",
"$value"
] | train | https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/DefinitionAssistant.php#L196-L232 |
SignpostMarv/daft-object | src/DefinitionAssistant.php | DefinitionAssistant.MaybeThrowIfValueArrayDoesNotMatchTypes | private static function MaybeThrowIfValueArrayDoesNotMatchTypes(
array $value,
string ...$types
) : array {
$initialCount = count($value);
$value = array_filter(
$value,
/**
* @param scalar|array|object|null $maybe
*/
funct... | php | private static function MaybeThrowIfValueArrayDoesNotMatchTypes(
array $value,
string ...$types
) : array {
$initialCount = count($value);
$value = array_filter(
$value,
/**
* @param scalar|array|object|null $maybe
*/
funct... | [
"private",
"static",
"function",
"MaybeThrowIfValueArrayDoesNotMatchTypes",
"(",
"array",
"$",
"value",
",",
"string",
"...",
"$",
"types",
")",
":",
"array",
"{",
"$",
"initialCount",
"=",
"count",
"(",
"$",
"value",
")",
";",
"$",
"value",
"=",
"array_filt... | @param array<int, scalar|array|object|null> $value
@return array<int, scalar|array|object|null> filtered $value | [
"@param",
"array<int",
"scalar|array|object|null",
">",
"$value"
] | train | https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/DefinitionAssistant.php#L262-L301 |
SignpostMarv/daft-object | src/DefinitionAssistant.php | DefinitionAssistant.MaybeRemapStringsToTrimmedStrings | private static function MaybeRemapStringsToTrimmedStrings(
array $value,
bool $autoTrimStrings,
string ...$types
) : array {
if (
$autoTrimStrings &&
in_array('string', $types, DefinitionAssistant::IN_ARRAY_STRICT_MODE)
) {
$value = array_m... | php | private static function MaybeRemapStringsToTrimmedStrings(
array $value,
bool $autoTrimStrings,
string ...$types
) : array {
if (
$autoTrimStrings &&
in_array('string', $types, DefinitionAssistant::IN_ARRAY_STRICT_MODE)
) {
$value = array_m... | [
"private",
"static",
"function",
"MaybeRemapStringsToTrimmedStrings",
"(",
"array",
"$",
"value",
",",
"bool",
"$",
"autoTrimStrings",
",",
"string",
"...",
"$",
"types",
")",
":",
"array",
"{",
"if",
"(",
"$",
"autoTrimStrings",
"&&",
"in_array",
"(",
"'strin... | @param array<int, scalar|array|object|null> $value
@return array<int, scalar|array|object|null> | [
"@param",
"array<int",
"scalar|array|object|null",
">",
"$value"
] | train | https://github.com/SignpostMarv/daft-object/blob/514886592b64986cc637040045f098335e27c037/src/DefinitionAssistant.php#L308-L331 |
krzysztofmazur/php-object-mapper | src/KrzysztofMazur/ObjectMapper/Mapping/Field/Field.php | Field.map | public function map($source, $target)
{
$this->writer->write($target, $this->reader->read($source));
} | php | public function map($source, $target)
{
$this->writer->write($target, $this->reader->read($source));
} | [
"public",
"function",
"map",
"(",
"$",
"source",
",",
"$",
"target",
")",
"{",
"$",
"this",
"->",
"writer",
"->",
"write",
"(",
"$",
"target",
",",
"$",
"this",
"->",
"reader",
"->",
"read",
"(",
"$",
"source",
")",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/krzysztofmazur/php-object-mapper/blob/2c22acad9634cfe8e9a75d72e665d450ada8d4e3/src/KrzysztofMazur/ObjectMapper/Mapping/Field/Field.php#L58-L61 |
danrevah/shortify-punit | src/Verify/Verify.php | Verify.getChainedMockCounter | private function getChainedMockCounter($methods)
{
$mockReturnValues = ShortifyPunit::getReturnValues();
$mockResponse = $mockReturnValues[$this->mockedClass][$this->instanceId];
foreach ($methods as $method)
{
$methodName = key($method);
$args = $method[$me... | php | private function getChainedMockCounter($methods)
{
$mockReturnValues = ShortifyPunit::getReturnValues();
$mockResponse = $mockReturnValues[$this->mockedClass][$this->instanceId];
foreach ($methods as $method)
{
$methodName = key($method);
$args = $method[$me... | [
"private",
"function",
"getChainedMockCounter",
"(",
"$",
"methods",
")",
"{",
"$",
"mockReturnValues",
"=",
"ShortifyPunit",
"::",
"getReturnValues",
"(",
")",
";",
"$",
"mockResponse",
"=",
"$",
"mockReturnValues",
"[",
"$",
"this",
"->",
"mockedClass",
"]",
... | Getting the call counter for the specific chained
stubbing methods
@param $methods
@return int | [
"Getting",
"the",
"call",
"counter",
"for",
"the",
"specific",
"chained",
"stubbing",
"methods"
] | train | https://github.com/danrevah/shortify-punit/blob/cedd08f31de8e7409a07d2630701ef4e924cc5f0/src/Verify/Verify.php#L121-L151 |
tylerjuniorcollege/slim-layout | src/Layout.php | Layout.setLayout | public function setLayout($template) {
$layout = $this->getTemplatePathname($template);
if(!is_file($layout)) {
throw new \RuntimeException("Layout file `$template` does not exist.");
} else {
$this->layout = $template;
}
} | php | public function setLayout($template) {
$layout = $this->getTemplatePathname($template);
if(!is_file($layout)) {
throw new \RuntimeException("Layout file `$template` does not exist.");
} else {
$this->layout = $template;
}
} | [
"public",
"function",
"setLayout",
"(",
"$",
"template",
")",
"{",
"$",
"layout",
"=",
"$",
"this",
"->",
"getTemplatePathname",
"(",
"$",
"template",
")",
";",
"if",
"(",
"!",
"is_file",
"(",
"$",
"layout",
")",
")",
"{",
"throw",
"new",
"\\",
"Runt... | Layout Configuration Getters and Setters | [
"Layout",
"Configuration",
"Getters",
"and",
"Setters"
] | train | https://github.com/tylerjuniorcollege/slim-layout/blob/60939b9f7502b90bf319fe741a747dd40ef61bfe/src/Layout.php#L40-L47 |
tylerjuniorcollege/slim-layout | src/Layout.php | Layout.render | public function render($template, $data = array()) {
if(!is_null($this->layout) && $this->enabled === TRUE) { // Render the layout!!
$this->setLayoutData('content', parent::render($template, array_merge($this->layoutData, (array)$data)));
$this->setLayoutData('js', $this->jsAssets->render());
$this->setLayou... | php | public function render($template, $data = array()) {
if(!is_null($this->layout) && $this->enabled === TRUE) { // Render the layout!!
$this->setLayoutData('content', parent::render($template, array_merge($this->layoutData, (array)$data)));
$this->setLayoutData('js', $this->jsAssets->render());
$this->setLayou... | [
"public",
"function",
"render",
"(",
"$",
"template",
",",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"layout",
")",
"&&",
"$",
"this",
"->",
"enabled",
"===",
"TRUE",
")",
"{",
"// Render the ... | Overloading render() function to inject the layout. | [
"Overloading",
"render",
"()",
"function",
"to",
"inject",
"the",
"layout",
"."
] | train | https://github.com/tylerjuniorcollege/slim-layout/blob/60939b9f7502b90bf319fe741a747dd40ef61bfe/src/Layout.php#L169-L180 |
tylerjuniorcollege/slim-layout | src/Layout.php | Layout.renderJson | public function renderJson($data, $status = 200) {
$app = \Slim\Slim::getInstance();
$app->response()->status($status);
$app->response()->header('Content-Type', 'application/json');
$body = json_encode($data);
$app->response()->body($body);
$app->stop();
} | php | public function renderJson($data, $status = 200) {
$app = \Slim\Slim::getInstance();
$app->response()->status($status);
$app->response()->header('Content-Type', 'application/json');
$body = json_encode($data);
$app->response()->body($body);
$app->stop();
} | [
"public",
"function",
"renderJson",
"(",
"$",
"data",
",",
"$",
"status",
"=",
"200",
")",
"{",
"$",
"app",
"=",
"\\",
"Slim",
"\\",
"Slim",
"::",
"getInstance",
"(",
")",
";",
"$",
"app",
"->",
"response",
"(",
")",
"->",
"status",
"(",
"$",
"st... | New function for pre-rendering JSON without having to call disableLayout AND other rendering code. | [
"New",
"function",
"for",
"pre",
"-",
"rendering",
"JSON",
"without",
"having",
"to",
"call",
"disableLayout",
"AND",
"other",
"rendering",
"code",
"."
] | train | https://github.com/tylerjuniorcollege/slim-layout/blob/60939b9f7502b90bf319fe741a747dd40ef61bfe/src/Layout.php#L183-L192 |
tylerjuniorcollege/slim-layout | src/Layout.php | Layout.partial | public function partial($template, $data = array()) {
return parent::render($template, array_merge($this->layoutData, (array)$data));
} | php | public function partial($template, $data = array()) {
return parent::render($template, array_merge($this->layoutData, (array)$data));
} | [
"public",
"function",
"partial",
"(",
"$",
"template",
",",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"return",
"parent",
"::",
"render",
"(",
"$",
"template",
",",
"array_merge",
"(",
"$",
"this",
"->",
"layoutData",
",",
"(",
"array",
")",
"$"... | Function for rendering partial content. This WILL inject the layout parameters. | [
"Function",
"for",
"rendering",
"partial",
"content",
".",
"This",
"WILL",
"inject",
"the",
"layout",
"parameters",
"."
] | train | https://github.com/tylerjuniorcollege/slim-layout/blob/60939b9f7502b90bf319fe741a747dd40ef61bfe/src/Layout.php#L195-L197 |
fsi-open/doctrine-extensions-bundle | Form/Type/FSi/FileType.php | FileType.buildView | public function buildView(FormView $view, FormInterface $form, array $options)
{
if (!$form->getData() instanceof FSiFile) {
return;
}
if (isset($options['file_url'])) {
$fileUrlCallable = $options['file_url'];
$view->vars['file_url'] = $fileUrlCallable($... | php | public function buildView(FormView $view, FormInterface $form, array $options)
{
if (!$form->getData() instanceof FSiFile) {
return;
}
if (isset($options['file_url'])) {
$fileUrlCallable = $options['file_url'];
$view->vars['file_url'] = $fileUrlCallable($... | [
"public",
"function",
"buildView",
"(",
"FormView",
"$",
"view",
",",
"FormInterface",
"$",
"form",
",",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"$",
"form",
"->",
"getData",
"(",
")",
"instanceof",
"FSiFile",
")",
"{",
"return",
";",
"}",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/fsi-open/doctrine-extensions-bundle/blob/1b9c01e0b216b2c1b2af087de233abbf3c84b9fe/Form/Type/FSi/FileType.php#L80-L92 |
fsi-open/doctrine-extensions-bundle | Form/Type/FSi/FileType.php | FileType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => FSiFile::class,
'constraints' => [new File()]
]);
$resolver->setDefined('file_url');
$resolver->setAllowedTypes('file_url', ['null', 'callable']);
} | php | public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults([
'data_class' => FSiFile::class,
'constraints' => [new File()]
]);
$resolver->setDefined('file_url');
$resolver->setAllowedTypes('file_url', ['null', 'callable']);
} | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"resolver",
"->",
"setDefaults",
"(",
"[",
"'data_class'",
"=>",
"FSiFile",
"::",
"class",
",",
"'constraints'",
"=>",
"[",
"new",
"File",
"(",
")",
"]",
"]",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/fsi-open/doctrine-extensions-bundle/blob/1b9c01e0b216b2c1b2af087de233abbf3c84b9fe/Form/Type/FSi/FileType.php#L105-L113 |
ClanCats/Core | src/classes/CCRoute.php | CCRoute.factory | public static function factory( $callback, $params = array() ) {
$route = new static();
$route->callback = $callback;
$route->params = $params;
return $route;
} | php | public static function factory( $callback, $params = array() ) {
$route = new static();
$route->callback = $callback;
$route->params = $params;
return $route;
} | [
"public",
"static",
"function",
"factory",
"(",
"$",
"callback",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"route",
"=",
"new",
"static",
"(",
")",
";",
"$",
"route",
"->",
"callback",
"=",
"$",
"callback",
";",
"$",
"route",
"->",... | static route factory
@param callback $callback
@param array $params
@return CCRoute | [
"static",
"route",
"factory"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCRoute.php#L22-L27 |
redaigbaria/oauth2 | src/Util/RedirectUri.php | RedirectUri.make | public static function make($uri, $params = [], $queryDelimeter = '?')
{
$uri .= (strstr($uri, $queryDelimeter) === false) ? $queryDelimeter : '&';
return $uri.http_build_query($params);
} | php | public static function make($uri, $params = [], $queryDelimeter = '?')
{
$uri .= (strstr($uri, $queryDelimeter) === false) ? $queryDelimeter : '&';
return $uri.http_build_query($params);
} | [
"public",
"static",
"function",
"make",
"(",
"$",
"uri",
",",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"queryDelimeter",
"=",
"'?'",
")",
"{",
"$",
"uri",
".=",
"(",
"strstr",
"(",
"$",
"uri",
",",
"$",
"queryDelimeter",
")",
"===",
"false",
")",
... | Generate a new redirect uri
@param string $uri The base URI
@param array $params The query string parameters
@param string $queryDelimeter The query string delimeter (default: "?")
@return string The updated URI | [
"Generate",
"a",
"new",
"redirect",
"uri"
] | train | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Util/RedirectUri.php#L28-L33 |
VincentChalnot/SidusEAVFilterBundle | Filter/Type/AbstractSimpleFilterType.php | AbstractSimpleFilterType.handleData | public function handleData(QueryHandlerInterface $queryHandler, FilterInterface $filter, $data): void
{
if (!$queryHandler instanceof EAVQueryHandlerInterface) {
throw new BadQueryHandlerException($queryHandler, EAVQueryHandlerInterface::class);
}
if (!$queryHandler->isEAVFilter(... | php | public function handleData(QueryHandlerInterface $queryHandler, FilterInterface $filter, $data): void
{
if (!$queryHandler instanceof EAVQueryHandlerInterface) {
throw new BadQueryHandlerException($queryHandler, EAVQueryHandlerInterface::class);
}
if (!$queryHandler->isEAVFilter(... | [
"public",
"function",
"handleData",
"(",
"QueryHandlerInterface",
"$",
"queryHandler",
",",
"FilterInterface",
"$",
"filter",
",",
"$",
"data",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"queryHandler",
"instanceof",
"EAVQueryHandlerInterface",
")",
"{",
"throw... | {@inheritdoc}
@throws \LogicException
@throws \UnexpectedValueException | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/VincentChalnot/SidusEAVFilterBundle/blob/25a9e0495fae30cb96ecded56c50cf7fe70c9032/Filter/Type/AbstractSimpleFilterType.php#L25-L50 |
webforge-labs/psc-cms | lib/Psc/Inflector.php | Inflector.propertyName | public function propertyName($className) {
if (!is_string($className) || mb_strpos($className, '\\') !== FALSE) {
throw new \InvalidArgumentException(sprintf("ClassName %s kann nicht zu propertyName umgewandelt werden. Er muss ein String sein und darf nur der ClassName sein", \Psc\Code\Code::varInfo($classNam... | php | public function propertyName($className) {
if (!is_string($className) || mb_strpos($className, '\\') !== FALSE) {
throw new \InvalidArgumentException(sprintf("ClassName %s kann nicht zu propertyName umgewandelt werden. Er muss ein String sein und darf nur der ClassName sein", \Psc\Code\Code::varInfo($classNam... | [
"public",
"function",
"propertyName",
"(",
"$",
"className",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"className",
")",
"||",
"mb_strpos",
"(",
"$",
"className",
",",
"'\\\\'",
")",
"!==",
"FALSE",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgument... | Gibt den (lcfirst) LowerCase Name für einen Klassennamen zurück
OID => oid
OIDMeta => oidMeta
SomeClassName => someClassName
@param $className ohne Namespace | [
"Gibt",
"den",
"(",
"lcfirst",
")",
"LowerCase",
"Name",
"für",
"einen",
"Klassennamen",
"zurück"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Inflector.php#L98-L121 |
ARCANEDEV/Agent | src/Agent.php | Agent.getDetectionRulesExtended | public function getDetectionRulesExtended()
{
static $rules;
if ( ! $rules) {
$rules = $this->mergeRules(
static::$additionalDevices, // NEW
static::getPhoneDevices(),
static::getTabletDevices(),
static::getOperatingSystems... | php | public function getDetectionRulesExtended()
{
static $rules;
if ( ! $rules) {
$rules = $this->mergeRules(
static::$additionalDevices, // NEW
static::getPhoneDevices(),
static::getTabletDevices(),
static::getOperatingSystems... | [
"public",
"function",
"getDetectionRulesExtended",
"(",
")",
"{",
"static",
"$",
"rules",
";",
"if",
"(",
"!",
"$",
"rules",
")",
"{",
"$",
"rules",
"=",
"$",
"this",
"->",
"mergeRules",
"(",
"static",
"::",
"$",
"additionalDevices",
",",
"// NEW",
"stat... | Get all detection rules. These rules include the additional
platforms and browsers.
@return array | [
"Get",
"all",
"detection",
"rules",
".",
"These",
"rules",
"include",
"the",
"additional",
"platforms",
"and",
"browsers",
"."
] | train | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L121-L139 |
ARCANEDEV/Agent | src/Agent.php | Agent.device | public function device($userAgent = null)
{
// Get device rules
$rules = $this->mergeRules(
static::$additionalDevices, // NEW
static::$phoneDevices,
static::$tabletDevices,
static::$utilities
);
return $this->findDetectionRulesAgainst... | php | public function device($userAgent = null)
{
// Get device rules
$rules = $this->mergeRules(
static::$additionalDevices, // NEW
static::$phoneDevices,
static::$tabletDevices,
static::$utilities
);
return $this->findDetectionRulesAgainst... | [
"public",
"function",
"device",
"(",
"$",
"userAgent",
"=",
"null",
")",
"{",
"// Get device rules",
"$",
"rules",
"=",
"$",
"this",
"->",
"mergeRules",
"(",
"static",
"::",
"$",
"additionalDevices",
",",
"// NEW",
"static",
"::",
"$",
"phoneDevices",
",",
... | Get the device name.
@param string|null $userAgent
@return string | [
"Get",
"the",
"device",
"name",
"."
] | train | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L160-L171 |
ARCANEDEV/Agent | src/Agent.php | Agent.browser | public function browser($userAgent = null)
{
// Get browser rules
$rules = $this->mergeRules(
static::$additionalBrowsers, // NEW
static::$browsers
);
return $this->findDetectionRulesAgainstUA($rules, $userAgent);
} | php | public function browser($userAgent = null)
{
// Get browser rules
$rules = $this->mergeRules(
static::$additionalBrowsers, // NEW
static::$browsers
);
return $this->findDetectionRulesAgainstUA($rules, $userAgent);
} | [
"public",
"function",
"browser",
"(",
"$",
"userAgent",
"=",
"null",
")",
"{",
"// Get browser rules",
"$",
"rules",
"=",
"$",
"this",
"->",
"mergeRules",
"(",
"static",
"::",
"$",
"additionalBrowsers",
",",
"// NEW",
"static",
"::",
"$",
"browsers",
")",
... | Get the browser name.
@param string|null $userAgent
@return string | [
"Get",
"the",
"browser",
"name",
"."
] | train | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L180-L189 |
ARCANEDEV/Agent | src/Agent.php | Agent.robot | public function robot($userAgent = null)
{
return $this->isRobot($userAgent)
? ucfirst($this->getCrawlerDetector()->getMatches())
: false;
} | php | public function robot($userAgent = null)
{
return $this->isRobot($userAgent)
? ucfirst($this->getCrawlerDetector()->getMatches())
: false;
} | [
"public",
"function",
"robot",
"(",
"$",
"userAgent",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"isRobot",
"(",
"$",
"userAgent",
")",
"?",
"ucfirst",
"(",
"$",
"this",
"->",
"getCrawlerDetector",
"(",
")",
"->",
"getMatches",
"(",
")",
")",
... | Get the robot name.
@param string|null $userAgent
@return string | [
"Get",
"the",
"robot",
"name",
"."
] | train | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L198-L203 |
ARCANEDEV/Agent | src/Agent.php | Agent.platform | public function platform($userAgent = null)
{
// Get platform rules
$rules = $this->mergeRules(
static::$operatingSystems,
static::$additionalOperatingSystems // NEW
);
return $this->findDetectionRulesAgainstUA($rules, $userAgent);
} | php | public function platform($userAgent = null)
{
// Get platform rules
$rules = $this->mergeRules(
static::$operatingSystems,
static::$additionalOperatingSystems // NEW
);
return $this->findDetectionRulesAgainstUA($rules, $userAgent);
} | [
"public",
"function",
"platform",
"(",
"$",
"userAgent",
"=",
"null",
")",
"{",
"// Get platform rules",
"$",
"rules",
"=",
"$",
"this",
"->",
"mergeRules",
"(",
"static",
"::",
"$",
"operatingSystems",
",",
"static",
"::",
"$",
"additionalOperatingSystems",
"... | Get the platform name.
@param string|null $userAgent
@return string | [
"Get",
"the",
"platform",
"name",
"."
] | train | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L212-L221 |
ARCANEDEV/Agent | src/Agent.php | Agent.version | public function version($propertyName, $type = self::VERSION_TYPE_STRING)
{
$check = key(static::$additionalProperties);
// Check if the additional properties have been added already
if ( ! array_key_exists($check, static::$properties)) {
// TODO: why is mergeRules not working h... | php | public function version($propertyName, $type = self::VERSION_TYPE_STRING)
{
$check = key(static::$additionalProperties);
// Check if the additional properties have been added already
if ( ! array_key_exists($check, static::$properties)) {
// TODO: why is mergeRules not working h... | [
"public",
"function",
"version",
"(",
"$",
"propertyName",
",",
"$",
"type",
"=",
"self",
"::",
"VERSION_TYPE_STRING",
")",
"{",
"$",
"check",
"=",
"key",
"(",
"static",
"::",
"$",
"additionalProperties",
")",
";",
"// Check if the additional properties have been ... | Check the version of the given property in the User-Agent.
Will return a float number. (eg. 2_0 will return 2.0, 4.3.1 will return 4.31)
@param string $propertyName The name of the property. See self::getProperties() array
keys for all possible properties.
@param string $type Either self::VERSION_TYPE_ST... | [
"Check",
"the",
"version",
"of",
"the",
"given",
"property",
"in",
"the",
"User",
"-",
"Agent",
".",
"Will",
"return",
"a",
"float",
"number",
".",
"(",
"eg",
".",
"2_0",
"will",
"return",
"2",
".",
"0",
"4",
".",
"3",
".",
"1",
"will",
"return",
... | train | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L294-L308 |
ARCANEDEV/Agent | src/Agent.php | Agent.mergeRules | protected function mergeRules(...$rulesGroups)
{
$merged = [];
foreach ($rulesGroups as $rules) {
foreach ($rules as $key => $value) {
if (empty($merged[$key]))
$merged[$key] = $value;
elseif (is_array($merged[$key]))
... | php | protected function mergeRules(...$rulesGroups)
{
$merged = [];
foreach ($rulesGroups as $rules) {
foreach ($rules as $key => $value) {
if (empty($merged[$key]))
$merged[$key] = $value;
elseif (is_array($merged[$key]))
... | [
"protected",
"function",
"mergeRules",
"(",
"...",
"$",
"rulesGroups",
")",
"{",
"$",
"merged",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"rulesGroups",
"as",
"$",
"rules",
")",
"{",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"key",
"=>",
"$",
"value",
... | Merge multiple rules into one array.
@param array $rulesGroups
@return array | [
"Merge",
"multiple",
"rules",
"into",
"one",
"array",
"."
] | train | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L359-L375 |
picamator/CacheManager | src/Data/EventBuilder.php | EventBuilder.setOperationResult | public function setOperationResult($operationResult) : EventBuilderInterface
{
if (!is_null($operationResult)
&& !is_bool($operationResult)
&& !is_a($operationResult, '\Picamator\CacheManager\Api\Data\SearchResultInterface')
) {
throw new InvalidArgumentException(... | php | public function setOperationResult($operationResult) : EventBuilderInterface
{
if (!is_null($operationResult)
&& !is_bool($operationResult)
&& !is_a($operationResult, '\Picamator\CacheManager\Api\Data\SearchResultInterface')
) {
throw new InvalidArgumentException(... | [
"public",
"function",
"setOperationResult",
"(",
"$",
"operationResult",
")",
":",
"EventBuilderInterface",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"operationResult",
")",
"&&",
"!",
"is_bool",
"(",
"$",
"operationResult",
")",
"&&",
"!",
"is_a",
"(",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/Data/EventBuilder.php#L85-L102 |
OpenClassrooms/CacheBundle | DependencyInjection/OpenClassroomsCacheExtension.php | OpenClassroomsCacheExtension.load | public function load(array $config, ContainerBuilder $container)
{
$config = $this->processConfiguration(new Configuration(), $config);
$provider = $config['provider'];
$container->setParameter(
'openclassrooms.cache.default_lifetime',
$config['default_lifetime']
... | php | public function load(array $config, ContainerBuilder $container)
{
$config = $this->processConfiguration(new Configuration(), $config);
$provider = $config['provider'];
$container->setParameter(
'openclassrooms.cache.default_lifetime',
$config['default_lifetime']
... | [
"public",
"function",
"load",
"(",
"array",
"$",
"config",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"processConfiguration",
"(",
"new",
"Configuration",
"(",
")",
",",
"$",
"config",
")",
";",
"$",
"prov... | Loads a specific configuration.
@param array $config An array of configuration values
@param ContainerBuilder $container A ContainerBuilder instance
@throws \InvalidArgumentException When provided tag is not defined in this extension
@api | [
"Loads",
"a",
"specific",
"configuration",
"."
] | train | https://github.com/OpenClassrooms/CacheBundle/blob/a8b9226b4370bba12190b821b45d46eb848ca34b/DependencyInjection/OpenClassroomsCacheExtension.php#L26-L54 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/ManiaHome/ManialinkPublisher.php | ManialinkPublisher.postPublicEvent | function postPublicEvent($message, $eventDate, $link = null, $titleIdString = null, $mediaURL = null)
{
$e = new Event();
$e->senderName = $this->manialink;
$e->message = $message;
$e->link = $link;
$e->eventDate = $eventDate;
$e->titleId = $titleIdString;
$e->mediaURL = $mediaURL;
return $this->execut... | php | function postPublicEvent($message, $eventDate, $link = null, $titleIdString = null, $mediaURL = null)
{
$e = new Event();
$e->senderName = $this->manialink;
$e->message = $message;
$e->link = $link;
$e->eventDate = $eventDate;
$e->titleId = $titleIdString;
$e->mediaURL = $mediaURL;
return $this->execut... | [
"function",
"postPublicEvent",
"(",
"$",
"message",
",",
"$",
"eventDate",
",",
"$",
"link",
"=",
"null",
",",
"$",
"titleIdString",
"=",
"null",
",",
"$",
"mediaURL",
"=",
"null",
")",
"{",
"$",
"e",
"=",
"new",
"Event",
"(",
")",
";",
"$",
"e",
... | Create an event visible by all players who bookmarked your Manialink
@param string $message The message itself. If you send a public notification to a player, the
message will be prepended with its nickname. Max length is 255 chars, you
can use Maniaplanet special chars.
@param int $eventDate The UNIX Timestamp of the ... | [
"Create",
"an",
"event",
"visible",
"by",
"all",
"players",
"who",
"bookmarked",
"your",
"Manialink"
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome/ManialinkPublisher.php#L161-L171 |
webforge-labs/psc-cms | lib/Psc/CMS/Service/StandardControllerService.php | StandardControllerService.routeController | public function routeController(ServiceRequest $request) {
$parts = $request->getParts();
$r = new RequestMatcher($request);
/* Class */
$class = $this->getControllerClass($r->matchNES(), $check = TRUE);
/* Method */
$method = $r->shift(); // method ist optional (kann index sein)
if ($... | php | public function routeController(ServiceRequest $request) {
$parts = $request->getParts();
$r = new RequestMatcher($request);
/* Class */
$class = $this->getControllerClass($r->matchNES(), $check = TRUE);
/* Method */
$method = $r->shift(); // method ist optional (kann index sein)
if ($... | [
"public",
"function",
"routeController",
"(",
"ServiceRequest",
"$",
"request",
")",
"{",
"$",
"parts",
"=",
"$",
"request",
"->",
"getParts",
"(",
")",
";",
"$",
"r",
"=",
"new",
"RequestMatcher",
"(",
"$",
"request",
")",
";",
"/* Class */",
"$",
"clas... | Findet den Controller anhand des Requests
unsere StandardStrategie ist hier:
1.Part => Klassenname: $className in <$this->getControllersNamespace()>\\<ucfirst($className)>Controller
oder (nicht implementiert) 1.Part => Schlüssel in $this->controllersMap
oder (whatever)
2.Part => Name der Methode des Controllers
3-x.Pa... | [
"Findet",
"den",
"Controller",
"anhand",
"des",
"Requests"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Service/StandardControllerService.php#L47-L83 |
PeekAndPoke/psi | src/Operation/Intermediate/Functional/SkipOperation.php | SkipOperation.apply | public function apply($input, $index, IntermediateContext $context)
{
if (! $context->memory->contains($this)) {
$context->memory->offsetSet($this, 0);
}
$count = $context->memory->offsetGet($this);
$context->memory->offsetSet($this, $count+1);
$takeIt = $count ... | php | public function apply($input, $index, IntermediateContext $context)
{
if (! $context->memory->contains($this)) {
$context->memory->offsetSet($this, 0);
}
$count = $context->memory->offsetGet($this);
$context->memory->offsetSet($this, $count+1);
$takeIt = $count ... | [
"public",
"function",
"apply",
"(",
"$",
"input",
",",
"$",
"index",
",",
"IntermediateContext",
"$",
"context",
")",
"{",
"if",
"(",
"!",
"$",
"context",
"->",
"memory",
"->",
"contains",
"(",
"$",
"this",
")",
")",
"{",
"$",
"context",
"->",
"memor... | @param mixed $input The element in the stream
@param mixed $index The index in the input iterator
@param IntermediateContext $context The solving context
@return mixed | [
"@param",
"mixed",
"$input",
"The",
"element",
"in",
"the",
"stream",
"@param",
"mixed",
"$index",
"The",
"index",
"in",
"the",
"input",
"iterator",
"@param",
"IntermediateContext",
"$context",
"The",
"solving",
"context"
] | train | https://github.com/PeekAndPoke/psi/blob/cfd45d995d3a2c2ea6ba5b1ce7b5fcc71179456f/src/Operation/Intermediate/Functional/SkipOperation.php#L36-L51 |
JBZoo/Less | src/Driver/Leafo.php | Leafo._initCompiler | protected function _initCompiler()
{
if ($this->_compiler) {
return $this->_compiler;
}
$this->_compiler = new \lessc();
if (class_exists('\lessc_formatter_lessjs')) {
$formatter = new \lessc_formatter_lessjs();
// configurate css view
... | php | protected function _initCompiler()
{
if ($this->_compiler) {
return $this->_compiler;
}
$this->_compiler = new \lessc();
if (class_exists('\lessc_formatter_lessjs')) {
$formatter = new \lessc_formatter_lessjs();
// configurate css view
... | [
"protected",
"function",
"_initCompiler",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_compiler",
")",
"{",
"return",
"$",
"this",
"->",
"_compiler",
";",
"}",
"$",
"this",
"->",
"_compiler",
"=",
"new",
"\\",
"lessc",
"(",
")",
";",
"if",
"(",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/JBZoo/Less/blob/9e9c41e3c7b76222c0d81379dead222413f2f042/src/Driver/Leafo.php#L44-L78 |
JBZoo/Less | src/Driver/Leafo.php | Leafo.setImportPath | public function setImportPath($fullPath, $relPath = null)
{
$this->_initCompiler();
if (!FS::isDir($fullPath)) {
throw new Exception('Undefined import path: ' . $fullPath);
}
$fullPath = FS::getRelative($fullPath, $this->_options->get('root_path'));
$this->_com... | php | public function setImportPath($fullPath, $relPath = null)
{
$this->_initCompiler();
if (!FS::isDir($fullPath)) {
throw new Exception('Undefined import path: ' . $fullPath);
}
$fullPath = FS::getRelative($fullPath, $this->_options->get('root_path'));
$this->_com... | [
"public",
"function",
"setImportPath",
"(",
"$",
"fullPath",
",",
"$",
"relPath",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_initCompiler",
"(",
")",
";",
"if",
"(",
"!",
"FS",
"::",
"isDir",
"(",
"$",
"fullPath",
")",
")",
"{",
"throw",
"new",
"E... | {@inheritdoc} | [
"{"
] | train | https://github.com/JBZoo/Less/blob/9e9c41e3c7b76222c0d81379dead222413f2f042/src/Driver/Leafo.php#L83-L94 |
inc2734/wp-share-buttons | src/App/Model/Requester/Twitter.php | Twitter._get_count | protected function _get_count( $permalink ) {
$request = "https://opensharecount.com/count.json?url=$permalink";
$response = wp_remote_get( $request );
$body = wp_remote_retrieve_body( $response );
$body = json_decode( $body, true );
if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
error_log( '[WP Sha... | php | protected function _get_count( $permalink ) {
$request = "https://opensharecount.com/count.json?url=$permalink";
$response = wp_remote_get( $request );
$body = wp_remote_retrieve_body( $response );
$body = json_decode( $body, true );
if ( defined( 'WP_DEBUG' ) && true === WP_DEBUG ) {
error_log( '[WP Sha... | [
"protected",
"function",
"_get_count",
"(",
"$",
"permalink",
")",
"{",
"$",
"request",
"=",
"\"https://opensharecount.com/count.json?url=$permalink\"",
";",
"$",
"response",
"=",
"wp_remote_get",
"(",
"$",
"request",
")",
";",
"$",
"body",
"=",
"wp_remote_retrieve_... | Get count from API
@param string $permalink
@return int Count | [
"Get",
"count",
"from",
"API"
] | train | https://github.com/inc2734/wp-share-buttons/blob/cd032893ca083a343f5871e855cce68f4ede3a17/src/App/Model/Requester/Twitter.php#L30-L56 |
yuncms/framework | src/grid/ActionColumn.php | ActionColumn.init | public function init()
{
parent::init();
$this->initDefaultButtons();
if (empty($this->header)) {
$this->header = Yii::t('yuncms', 'Operation');
}
} | php | public function init()
{
parent::init();
$this->initDefaultButtons();
if (empty($this->header)) {
$this->header = Yii::t('yuncms', 'Operation');
}
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"$",
"this",
"->",
"initDefaultButtons",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"header",
")",
")",
"{",
"$",
"this",
"->",
"header",
"=",
"Yi... | {@inheritdoc} | [
"{"
] | train | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/grid/ActionColumn.php#L25-L32 |
TheBigBrainsCompany/TbbcRestUtilBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('tbbc_rest_util');
$this->addErrorSection($rootNode);
return $treeBuilder;
} | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('tbbc_rest_util');
$this->addErrorSection($rootNode);
return $treeBuilder;
} | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"'tbbc_rest_util'",
")",
";",
"$",
"this",
"->",
"addErrorSection",
"(",
... | Generates the configuration tree builder
@return TreeBuilder | [
"Generates",
"the",
"configuration",
"tree",
"builder"
] | train | https://github.com/TheBigBrainsCompany/TbbcRestUtilBundle/blob/48c0598a94a4f6b3883d349d8f134138e8bc6d7c/DependencyInjection/Configuration.php#L28-L36 |
TheBigBrainsCompany/TbbcRestUtilBundle | DependencyInjection/Configuration.php | Configuration.addErrorSection | private function addErrorSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('error')
->children()
->booleanNode('use_bundled_factories')->defaultTrue()->end()
->scalarNode('error_resolver'... | php | private function addErrorSection(ArrayNodeDefinition $node)
{
$node
->children()
->arrayNode('error')
->children()
->booleanNode('use_bundled_factories')->defaultTrue()->end()
->scalarNode('error_resolver'... | [
"private",
"function",
"addErrorSection",
"(",
"ArrayNodeDefinition",
"$",
"node",
")",
"{",
"$",
"node",
"->",
"children",
"(",
")",
"->",
"arrayNode",
"(",
"'error'",
")",
"->",
"children",
"(",
")",
"->",
"booleanNode",
"(",
"'use_bundled_factories'",
")",
... | Parses the tbbc_rest_util.error config section
Example for yaml driver:
tbbc_rest_util:
error:
use_bundled_factories: true
exception_mapping:
InvalidArgumentException:
class: "\InvalidArgumentException"
factory: default
http_status_code: 400
error_code: 400101
error_message: "Invalid argument exception"
error_extended_... | [
"Parses",
"the",
"tbbc_rest_util",
".",
"error",
"config",
"section",
"Example",
"for",
"yaml",
"driver",
":",
"tbbc_rest_util",
":",
"error",
":",
"use_bundled_factories",
":",
"true",
"exception_mapping",
":",
"InvalidArgumentException",
":",
"class",
":",
"\\",
... | train | https://github.com/TheBigBrainsCompany/TbbcRestUtilBundle/blob/48c0598a94a4f6b3883d349d8f134138e8bc6d7c/DependencyInjection/Configuration.php#L57-L88 |
spiral-modules/scaffolder | source/Scaffolder/Commands/MigrationCommand.php | MigrationCommand.perform | public function perform(Migrator $migrator)
{
/** @var MigrationDeclaration $declaration */
$declaration = $this->createDeclaration();
if (!empty($this->option('table'))) {
$columns = [];
foreach ($this->option('column') as $field) {
if (strpos($field... | php | public function perform(Migrator $migrator)
{
/** @var MigrationDeclaration $declaration */
$declaration = $this->createDeclaration();
if (!empty($this->option('table'))) {
$columns = [];
foreach ($this->option('column') as $field) {
if (strpos($field... | [
"public",
"function",
"perform",
"(",
"Migrator",
"$",
"migrator",
")",
"{",
"/** @var MigrationDeclaration $declaration */",
"$",
"declaration",
"=",
"$",
"this",
"->",
"createDeclaration",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"opti... | @param Migrator $migrator
@throws ScaffolderException | [
"@param",
"Migrator",
"$migrator"
] | train | https://github.com/spiral-modules/scaffolder/blob/9be9dd0da6e4b02232db24e797fe5c288afbbddf/source/Scaffolder/Commands/MigrationCommand.php#L40-L74 |
iocaste/microservice-foundation | src/Http/Requests/Request.php | Request.response | public function response(array $errors): JsonResponse
{
return $this->respondValidationError(
ApiResponse::CODE_VALIDATION_ERROR,
$this->transformErrors($errors)
);
} | php | public function response(array $errors): JsonResponse
{
return $this->respondValidationError(
ApiResponse::CODE_VALIDATION_ERROR,
$this->transformErrors($errors)
);
} | [
"public",
"function",
"response",
"(",
"array",
"$",
"errors",
")",
":",
"JsonResponse",
"{",
"return",
"$",
"this",
"->",
"respondValidationError",
"(",
"ApiResponse",
"::",
"CODE_VALIDATION_ERROR",
",",
"$",
"this",
"->",
"transformErrors",
"(",
"$",
"errors",... | Method throws validation error response.
@param array $errors
@return \Illuminate\Http\JsonResponse | [
"Method",
"throws",
"validation",
"error",
"response",
"."
] | train | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Requests/Request.php#L23-L29 |
austinkregel/Warden | src/Warden/Http/Controllers/Controller.php | Controller.checkParams | public function checkParams(array $params)
{
foreach ($params as $p) {
$config = config('kregel.warden.models');
$configKeys = array_keys($config);
// dd($p, $config, $configKeys, !in_array($p, $config), !in_array($p, $configKeys), !in_array($p, $configKeys) && !in_array($... | php | public function checkParams(array $params)
{
foreach ($params as $p) {
$config = config('kregel.warden.models');
$configKeys = array_keys($config);
// dd($p, $config, $configKeys, !in_array($p, $config), !in_array($p, $configKeys), !in_array($p, $configKeys) && !in_array($... | [
"public",
"function",
"checkParams",
"(",
"array",
"$",
"params",
")",
"{",
"foreach",
"(",
"$",
"params",
"as",
"$",
"p",
")",
"{",
"$",
"config",
"=",
"config",
"(",
"'kregel.warden.models'",
")",
";",
"$",
"configKeys",
"=",
"array_keys",
"(",
"$",
... | @param array $params
@throws \Exception | [
"@param",
"array",
"$params"
] | train | https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/Controller.php#L38-L48 |
austinkregel/Warden | src/Warden/Http/Controllers/Controller.php | Controller.get | public function get($route, $params = [])
{
$route = $this->parseRoute($route, $params);
$request = Request::create($route, 'GET');
$response = Route::dispatch($request);
return $response;
} | php | public function get($route, $params = [])
{
$route = $this->parseRoute($route, $params);
$request = Request::create($route, 'GET');
$response = Route::dispatch($request);
return $response;
} | [
"public",
"function",
"get",
"(",
"$",
"route",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"route",
"=",
"$",
"this",
"->",
"parseRoute",
"(",
"$",
"route",
",",
"$",
"params",
")",
";",
"$",
"request",
"=",
"Request",
"::",
"create",
"(",... | @param $route
@param array $params
@return mixed | [
"@param",
"$route",
"@param",
"array",
"$params"
] | train | https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/Controller.php#L56-L63 |
austinkregel/Warden | src/Warden/Http/Controllers/Controller.php | Controller.delete | public function delete($route, $params = [])
{
$route = $this->parseRoute($route, $params);
$request = Request::create($route, 'DELETE', Input::all());
$response = Route::dispatch($request);
return $response;
} | php | public function delete($route, $params = [])
{
$route = $this->parseRoute($route, $params);
$request = Request::create($route, 'DELETE', Input::all());
$response = Route::dispatch($request);
return $response;
} | [
"public",
"function",
"delete",
"(",
"$",
"route",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"route",
"=",
"$",
"this",
"->",
"parseRoute",
"(",
"$",
"route",
",",
"$",
"params",
")",
";",
"$",
"request",
"=",
"Request",
"::",
"create",
"... | @param $route
@return mixed | [
"@param",
"$route"
] | train | https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/Controller.php#L83-L90 |
austinkregel/Warden | src/Warden/Http/Controllers/Controller.php | Controller.parseRoute | public function parseRoute($route, $params = [])
{
if (Route::has($route)) {
$url = route($route, $params);
} else {
$url = url($route, $params);
}
$tld = ['.ved/', '.dev/', '.com/', '.org/', '.net/', '.int/', '.edu/', '.gov/', '.mil/', '.ac/', '.ad/', '.ae/',... | php | public function parseRoute($route, $params = [])
{
if (Route::has($route)) {
$url = route($route, $params);
} else {
$url = url($route, $params);
}
$tld = ['.ved/', '.dev/', '.com/', '.org/', '.net/', '.int/', '.edu/', '.gov/', '.mil/', '.ac/', '.ad/', '.ae/',... | [
"public",
"function",
"parseRoute",
"(",
"$",
"route",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"Route",
"::",
"has",
"(",
"$",
"route",
")",
")",
"{",
"$",
"url",
"=",
"route",
"(",
"$",
"route",
",",
"$",
"params",
")",
";",
... | @param $route
@param array $params
@return mixed | [
"@param",
"$route",
"@param",
"array",
"$params"
] | train | https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/Controller.php#L112-L123 |
austinkregel/Warden | src/Warden/Http/Controllers/Controller.php | Controller.explodeWhere | private function explodeWhere($string, $array)
{
$returnable = [];
foreach ($array as $a) {
if (stripos($string, $a) !== false) {
$returnable = array_merge($returnable, explode($a, $string));
}
}
return $returnable;
} | php | private function explodeWhere($string, $array)
{
$returnable = [];
foreach ($array as $a) {
if (stripos($string, $a) !== false) {
$returnable = array_merge($returnable, explode($a, $string));
}
}
return $returnable;
} | [
"private",
"function",
"explodeWhere",
"(",
"$",
"string",
",",
"$",
"array",
")",
"{",
"$",
"returnable",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"a",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"string",
",",
"$",
"a",
")",
... | @param $string
@param $array
@return array | [
"@param",
"$string",
"@param",
"$array"
] | train | https://github.com/austinkregel/Warden/blob/6f5a98bd79a488f0f300f4851061ac6f7d19f8a3/src/Warden/Http/Controllers/Controller.php#L131-L141 |
geekwright/Po | src/PoInitPHP.php | PoInitPHP.msginitString | public function msginitString(string $source, string $refname): PoFile
{
if (!($this->poFile instanceof PoFile)) {
$this->poFile = new PoFile;
}
$tokens = token_get_all($source);
$translateTags = array_merge($this->gettextTags, $this->pgettextTags, $this->ngettextTags);... | php | public function msginitString(string $source, string $refname): PoFile
{
if (!($this->poFile instanceof PoFile)) {
$this->poFile = new PoFile;
}
$tokens = token_get_all($source);
$translateTags = array_merge($this->gettextTags, $this->pgettextTags, $this->ngettextTags);... | [
"public",
"function",
"msginitString",
"(",
"string",
"$",
"source",
",",
"string",
"$",
"refname",
")",
":",
"PoFile",
"{",
"if",
"(",
"!",
"(",
"$",
"this",
"->",
"poFile",
"instanceof",
"PoFile",
")",
")",
"{",
"$",
"this",
"->",
"poFile",
"=",
"n... | Inspect the supplied source, capture gettext references as a PoFile object.
@param string $source php source code
@param string $refname source identification used for PO reference comments
@return PoFile | [
"Inspect",
"the",
"supplied",
"source",
"capture",
"gettext",
"references",
"as",
"a",
"PoFile",
"object",
"."
] | train | https://github.com/geekwright/Po/blob/9474d059a83b64e6242cc41e5c5b7a08bc57e4e2/src/PoInitPHP.php#L52-L114 |
ClanCats/Core | src/classes/CCForge/Php.php | CCForge_Php.make | public static function make( $cmd, $params )
{
if ( !is_array( $params ) )
{
$params = array( $params );
}
$forge = new static;
if ( !method_exists( $forge, $cmd ) )
{
throw new CCException( "CCForge_Php - Command could not be found." );
}
return call_user_func_array( array( $forge, $cmd... | php | public static function make( $cmd, $params )
{
if ( !is_array( $params ) )
{
$params = array( $params );
}
$forge = new static;
if ( !method_exists( $forge, $cmd ) )
{
throw new CCException( "CCForge_Php - Command could not be found." );
}
return call_user_func_array( array( $forge, $cmd... | [
"public",
"static",
"function",
"make",
"(",
"$",
"cmd",
",",
"$",
"params",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"array",
"(",
"$",
"params",
")",
";",
"}",
"$",
"forge",
"=",
"new",
"sta... | runs a forge command on a dummy forge
@param string $cmd
@param array $params
@return string | [
"runs",
"a",
"forge",
"command",
"on",
"a",
"dummy",
"forge"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCForge/Php.php#L33-L48 |
ClanCats/Core | src/classes/CCForge/Php.php | CCForge_Php.comment | public function comment( $str, $wordwrap = 80 )
{
$str = trim( wordwrap( $str, $wordwrap ) );
$str = str_replace( "\n", "\n".' * ', $str );
$str = str_replace( "\n".' * *', "\n".' **', $str );
return $this->add( "/**\n * ".$str."\n */" );
} | php | public function comment( $str, $wordwrap = 80 )
{
$str = trim( wordwrap( $str, $wordwrap ) );
$str = str_replace( "\n", "\n".' * ', $str );
$str = str_replace( "\n".' * *', "\n".' **', $str );
return $this->add( "/**\n * ".$str."\n */" );
} | [
"public",
"function",
"comment",
"(",
"$",
"str",
",",
"$",
"wordwrap",
"=",
"80",
")",
"{",
"$",
"str",
"=",
"trim",
"(",
"wordwrap",
"(",
"$",
"str",
",",
"$",
"wordwrap",
")",
")",
";",
"$",
"str",
"=",
"str_replace",
"(",
"\"\\n\"",
",",
"\"\... | generates an PHP comment
@param string $str
@param int $wordwrap
@return string | [
"generates",
"an",
"PHP",
"comment"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCForge/Php.php#L124-L130 |
ClanCats/Core | src/classes/CCForge/Php.php | CCForge_Php.closure | public function closure( $name, $content = null, $comment )
{
return $this->add( ( $comment ? static::make( 'comment', array( $comment ) )."\n" : '' ).
$name."\n{\n".str_replace( "\n", "\n\t", "\t".CCStr::capture( $content ) )."\n}" );
} | php | public function closure( $name, $content = null, $comment )
{
return $this->add( ( $comment ? static::make( 'comment', array( $comment ) )."\n" : '' ).
$name."\n{\n".str_replace( "\n", "\n\t", "\t".CCStr::capture( $content ) )."\n}" );
} | [
"public",
"function",
"closure",
"(",
"$",
"name",
",",
"$",
"content",
"=",
"null",
",",
"$",
"comment",
")",
"{",
"return",
"$",
"this",
"->",
"add",
"(",
"(",
"$",
"comment",
"?",
"static",
"::",
"make",
"(",
"'comment'",
",",
"array",
"(",
"$",... | generates an closure
@param string $str
@param int $wordwrap
@return string | [
"generates",
"an",
"closure"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCForge/Php.php#L139-L143 |
ClanCats/Core | src/classes/CCForge/Php.php | CCForge_Php.a_class | public function a_class( $name, $content, $extends = null, $implements = null )
{
return $this->add( $this->closure( "class ".$name.
( $extends ? ' extends '.$extends : '' ).
( $implements ? ' implements '.$implements : '' ), $content ) );
} | php | public function a_class( $name, $content, $extends = null, $implements = null )
{
return $this->add( $this->closure( "class ".$name.
( $extends ? ' extends '.$extends : '' ).
( $implements ? ' implements '.$implements : '' ), $content ) );
} | [
"public",
"function",
"a_class",
"(",
"$",
"name",
",",
"$",
"content",
",",
"$",
"extends",
"=",
"null",
",",
"$",
"implements",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"add",
"(",
"$",
"this",
"->",
"closure",
"(",
"\"class \"",
".",
... | generates an PHP class
@param string $str
@param int $wordwrap
@return string | [
"generates",
"an",
"PHP",
"class"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCForge/Php.php#L152-L157 |
ClanCats/Core | src/classes/CCForge/Php.php | CCForge_Php.property | public function property( $name, $default = null, $comment = null, $export = true )
{
if ( $default !== null )
{
if ( $export )
{
$default = var_export( $default, true );
}
}
return $this->add( ( $comment ? static::make( 'comment', array( $comment ) )."\n" : '' ).
$name.( $default !== null ... | php | public function property( $name, $default = null, $comment = null, $export = true )
{
if ( $default !== null )
{
if ( $export )
{
$default = var_export( $default, true );
}
}
return $this->add( ( $comment ? static::make( 'comment', array( $comment ) )."\n" : '' ).
$name.( $default !== null ... | [
"public",
"function",
"property",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
",",
"$",
"comment",
"=",
"null",
",",
"$",
"export",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"default",
"!==",
"null",
")",
"{",
"if",
"(",
"$",
"export",
")",
... | generates a class property
@param string $str
@param int $wordwrap
@return string | [
"generates",
"a",
"class",
"property"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCForge/Php.php#L166-L178 |
PortaText/php-sdk | src/PortaText/Command/Api/Settings.php | Settings.enableAutoRecharges | public function enableAutoRecharges($whenCredit, $total)
{
$this->setArgument("autorecharge_enabled", true);
$this->setArgument("autorecharge_total", $total);
return $this->setArgument("autorecharge_when_credit", $whenCredit);
} | php | public function enableAutoRecharges($whenCredit, $total)
{
$this->setArgument("autorecharge_enabled", true);
$this->setArgument("autorecharge_total", $total);
return $this->setArgument("autorecharge_when_credit", $whenCredit);
} | [
"public",
"function",
"enableAutoRecharges",
"(",
"$",
"whenCredit",
",",
"$",
"total",
")",
"{",
"$",
"this",
"->",
"setArgument",
"(",
"\"autorecharge_enabled\"",
",",
"true",
")",
";",
"$",
"this",
"->",
"setArgument",
"(",
"\"autorecharge_total\"",
",",
"$... | Enables auto recharges.
@param integer $whenCredit Autorecharge when credit reaches this amount.
@param float $total Total credits to autorecharge.
@return PortaText\Command\ICommand | [
"Enables",
"auto",
"recharges",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Settings.php#L72-L77 |
PortaText/php-sdk | src/PortaText/Command/Api/Settings.php | Settings.publishEventsToSns | public function publishEventsToSns($key, $secret, $topicArn)
{
$this->setArgument("sns_publish_enabled", true);
$this->setArgument("sns_access_key", $key);
$this->setArgument("sns_access_secret", $secret);
return $this->setArgument("sns_topic", $topicArn);
} | php | public function publishEventsToSns($key, $secret, $topicArn)
{
$this->setArgument("sns_publish_enabled", true);
$this->setArgument("sns_access_key", $key);
$this->setArgument("sns_access_secret", $secret);
return $this->setArgument("sns_topic", $topicArn);
} | [
"public",
"function",
"publishEventsToSns",
"(",
"$",
"key",
",",
"$",
"secret",
",",
"$",
"topicArn",
")",
"{",
"$",
"this",
"->",
"setArgument",
"(",
"\"sns_publish_enabled\"",
",",
"true",
")",
";",
"$",
"this",
"->",
"setArgument",
"(",
"\"sns_access_key... | Enables publishing of events to an SNS topic.
@param string $key Amazon AWS access key.
@param string $secret Amazon AWS access secret.
@param string $topicArn SNS Topic ARN.
@return PortaText\Command\ICommand | [
"Enables",
"publishing",
"of",
"events",
"to",
"an",
"SNS",
"topic",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Settings.php#L225-L231 |
slashworks/control-bundle | src/Slashworks/AppBundle/Form/Type/RemoteAppType.php | RemoteAppType.buildForm | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('type');
$builder->add('name');
$builder->add('domain');
$builder->add('apiUrl');
$builder->add('apiAuthType','choice',array(
"choices" => array(
'none' => "re... | php | public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('type');
$builder->add('name');
$builder->add('domain');
$builder->add('apiUrl');
$builder->add('apiAuthType','choice',array(
"choices" => array(
'none' => "re... | [
"public",
"function",
"buildForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'type'",
")",
";",
"$",
"builder",
"->",
"add",
"(",
"'name'",
")",
";",
"$",
"builder",
"->",
"a... | {@inheritdoc} | [
"{"
] | train | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Form/Type/RemoteAppType.php#L45-L79 |
jenwachter/html-form | src/Utility/Sanitizer.php | Sanitizer.apply | protected function apply($function, $args = array())
{
foreach ($this->data as $key => &$value) {
if (!is_array($value)) {
$value = $this->applyToValue($function, $args, $value);
} else {
$value = array_map(function ($v) use ($function, $args) {
return $this->applyToValue($f... | php | protected function apply($function, $args = array())
{
foreach ($this->data as $key => &$value) {
if (!is_array($value)) {
$value = $this->applyToValue($function, $args, $value);
} else {
$value = array_map(function ($v) use ($function, $args) {
return $this->applyToValue($f... | [
"protected",
"function",
"apply",
"(",
"$",
"function",
",",
"$",
"args",
"=",
"array",
"(",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"key",
"=>",
"&",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"v... | Apply a function to each value
@param string $function Function name (ex: "stripslashes")
@param array $args Function arguments
@return null | [
"Apply",
"a",
"function",
"to",
"each",
"value"
] | train | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Utility/Sanitizer.php#L28-L41 |
CakeCMS/Core | src/Controller/AppController.php | AppController.initialize | public function initialize()
{
parent::initialize();
$this->cms = Cms::getInstance();
$this->_setTheme();
$pluginEvent = Plugin::getData('Core', 'Controller.initialize');
if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.initialize')) {
... | php | public function initialize()
{
parent::initialize();
$this->cms = Cms::getInstance();
$this->_setTheme();
$pluginEvent = Plugin::getData('Core', 'Controller.initialize');
if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.initialize')) {
... | [
"public",
"function",
"initialize",
"(",
")",
"{",
"parent",
"::",
"initialize",
"(",
")",
";",
"$",
"this",
"->",
"cms",
"=",
"Cms",
"::",
"getInstance",
"(",
")",
";",
"$",
"this",
"->",
"_setTheme",
"(",
")",
";",
"$",
"pluginEvent",
"=",
"Plugin"... | Initialization hook method.
@return void
@throws \JBZoo\Utils\Exception | [
"Initialization",
"hook",
"method",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/AppController.php#L58-L68 |
CakeCMS/Core | src/Controller/AppController.php | AppController.beforeRender | public function beforeRender(Event $event)
{
$pluginEvent = Plugin::getData('Core', 'Controller.beforeRender');
if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.beforeRender')) {
call_user_func_array($pluginEvent->find(0), [$this, $event]);
}
... | php | public function beforeRender(Event $event)
{
$pluginEvent = Plugin::getData('Core', 'Controller.beforeRender');
if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.beforeRender')) {
call_user_func_array($pluginEvent->find(0), [$this, $event]);
}
... | [
"public",
"function",
"beforeRender",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"pluginEvent",
"=",
"Plugin",
"::",
"getData",
"(",
"'Core'",
",",
"'Controller.beforeRender'",
")",
";",
"if",
"(",
"is_callable",
"(",
"$",
"pluginEvent",
"->",
"find",
"(",
... | Called after the controller action is run, but before the view is rendered. You can use this method
to perform logic or set view variables that are required on every request.
@param \Cake\Event\Event $event The beforeRender event.
@return void
@throws \JBZoo\Utils\Exception | [
"Called",
"after",
"the",
"controller",
"action",
"is",
"run",
"but",
"before",
"the",
"view",
"is",
"rendered",
".",
"You",
"can",
"use",
"this",
"method",
"to",
"perform",
"logic",
"or",
"set",
"view",
"variables",
"that",
"are",
"required",
"on",
"every... | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/AppController.php#L79-L91 |
CakeCMS/Core | src/Controller/AppController.php | AppController.beforeFilter | public function beforeFilter(Event $event)
{
EventManager::trigger('Controller.setup', $this);
$pluginEvent = Plugin::getData('Core', 'Controller.beforeFilter');
if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.beforeFilter')) {
call_user_func_array... | php | public function beforeFilter(Event $event)
{
EventManager::trigger('Controller.setup', $this);
$pluginEvent = Plugin::getData('Core', 'Controller.beforeFilter');
if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.beforeFilter')) {
call_user_func_array... | [
"public",
"function",
"beforeFilter",
"(",
"Event",
"$",
"event",
")",
"{",
"EventManager",
"::",
"trigger",
"(",
"'Controller.setup'",
",",
"$",
"this",
")",
";",
"$",
"pluginEvent",
"=",
"Plugin",
"::",
"getData",
"(",
"'Core'",
",",
"'Controller.beforeFilte... | Called before the controller action. You can use this method to configure and customize components
or perform logic that needs to happen before each controller action.
@param Event $event
@return void
@throws \JBZoo\Utils\Exception | [
"Called",
"before",
"the",
"controller",
"action",
".",
"You",
"can",
"use",
"this",
"method",
"to",
"configure",
"and",
"customize",
"components",
"or",
"perform",
"logic",
"that",
"needs",
"to",
"happen",
"before",
"each",
"controller",
"action",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/AppController.php#L102-L110 |
CakeCMS/Core | src/Controller/AppController.php | AppController.beforeRedirect | public function beforeRedirect(Event $event, $url, Response $response)
{
$pluginEvent = Plugin::getData('Core', 'Controller.beforeRedirect');
if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.beforeRedirect')) {
call_user_func_array($pluginEvent->find(0), [$t... | php | public function beforeRedirect(Event $event, $url, Response $response)
{
$pluginEvent = Plugin::getData('Core', 'Controller.beforeRedirect');
if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.beforeRedirect')) {
call_user_func_array($pluginEvent->find(0), [$t... | [
"public",
"function",
"beforeRedirect",
"(",
"Event",
"$",
"event",
",",
"$",
"url",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"pluginEvent",
"=",
"Plugin",
"::",
"getData",
"(",
"'Core'",
",",
"'Controller.beforeRedirect'",
")",
";",
"if",
"(",
"is... | The beforeRedirect method is invoked when the controller's redirect method is called but before any
further action.
@param Event $event
@param array|string $url
@param Response $response
@return void
@throws \JBZoo\Utils\Exception | [
"The",
"beforeRedirect",
"method",
"is",
"invoked",
"when",
"the",
"controller",
"s",
"redirect",
"method",
"is",
"called",
"but",
"before",
"any",
"further",
"action",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/AppController.php#L123-L129 |
CakeCMS/Core | src/Controller/AppController.php | AppController.afterFilter | public function afterFilter(Event $event)
{
$pluginEvent = Plugin::getData('Core', 'Controller.afterFilter');
if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.afterFilter')) {
call_user_func_array($pluginEvent->find(0), [$this, $event]);
}
} | php | public function afterFilter(Event $event)
{
$pluginEvent = Plugin::getData('Core', 'Controller.afterFilter');
if (is_callable($pluginEvent->find(0)) && Plugin::hasManifestEvent('Controller.afterFilter')) {
call_user_func_array($pluginEvent->find(0), [$this, $event]);
}
} | [
"public",
"function",
"afterFilter",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"pluginEvent",
"=",
"Plugin",
"::",
"getData",
"(",
"'Core'",
",",
"'Controller.afterFilter'",
")",
";",
"if",
"(",
"is_callable",
"(",
"$",
"pluginEvent",
"->",
"find",
"(",
"... | Called after the controller action is run and rendered.
@param Event $event
@return void
@throws \JBZoo\Utils\Exception | [
"Called",
"after",
"the",
"controller",
"action",
"is",
"run",
"and",
"rendered",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/AppController.php#L139-L145 |
CakeCMS/Core | src/Controller/AppController.php | AppController._setTheme | protected function _setTheme()
{
$theme = $this->request->getParam('theme');
if ($theme) {
$this->viewBuilder()->setTheme($theme);
}
} | php | protected function _setTheme()
{
$theme = $this->request->getParam('theme');
if ($theme) {
$this->viewBuilder()->setTheme($theme);
}
} | [
"protected",
"function",
"_setTheme",
"(",
")",
"{",
"$",
"theme",
"=",
"$",
"this",
"->",
"request",
"->",
"getParam",
"(",
"'theme'",
")",
";",
"if",
"(",
"$",
"theme",
")",
"{",
"$",
"this",
"->",
"viewBuilder",
"(",
")",
"->",
"setTheme",
"(",
... | Setup application theme.
@return void | [
"Setup",
"application",
"theme",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/AppController.php#L152-L158 |
Chill-project/Main | Export/Formatter/CSVFormatter.php | CSVFormatter.appendAggregatorForm | private function appendAggregatorForm(FormBuilderInterface $builder, $nbAggregators)
{
$builder->add('order', 'choice', array(
'choices' => array_combine(
range(1, $nbAggregators),
range(1, $nbAggregators)
),
'multiple' => false,
... | php | private function appendAggregatorForm(FormBuilderInterface $builder, $nbAggregators)
{
$builder->add('order', 'choice', array(
'choices' => array_combine(
range(1, $nbAggregators),
range(1, $nbAggregators)
),
'multiple' => false,
... | [
"private",
"function",
"appendAggregatorForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"$",
"nbAggregators",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'order'",
",",
"'choice'",
",",
"array",
"(",
"'choices'",
"=>",
"array_combine",
"(",
"range",
... | append a form line by aggregator on the formatter form.
This form allow to choose the aggregator position (row or column) and
the ordering
@param FormBuilderInterface $builder
@param string $nbAggregators | [
"append",
"a",
"form",
"line",
"by",
"aggregator",
"on",
"the",
"formatter",
"form",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVFormatter.php#L114-L134 |
Chill-project/Main | Export/Formatter/CSVFormatter.php | CSVFormatter.orderingHeaders | protected function orderingHeaders($formatterData)
{
$this->formatterData = $formatterData;
uasort($this->formatterData, function($a, $b) {
return ($a['order'] <= $b['order'] ? -1 : 1);
});
} | php | protected function orderingHeaders($formatterData)
{
$this->formatterData = $formatterData;
uasort($this->formatterData, function($a, $b) {
return ($a['order'] <= $b['order'] ? -1 : 1);
});
} | [
"protected",
"function",
"orderingHeaders",
"(",
"$",
"formatterData",
")",
"{",
"$",
"this",
"->",
"formatterData",
"=",
"$",
"formatterData",
";",
"uasort",
"(",
"$",
"this",
"->",
"formatterData",
",",
"function",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{... | ordering aggregators, preserving key association.
This function do not mind about position.
If two aggregators have the same order, the second given will be placed
after. This is not significant for the first ordering.
@param type $formatterData
@return type | [
"ordering",
"aggregators",
"preserving",
"key",
"association",
"."
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVFormatter.php#L182-L189 |
anime-db/app-bundle | src/Entity/Notice.php | Notice.shown | public function shown()
{
if (is_null($this->date_closed)) {
$this->date_closed = new \DateTime();
$this->date_closed->modify(sprintf('+%s seconds', $this->lifetime));
}
$this->status = self::STATUS_SHOWN;
} | php | public function shown()
{
if (is_null($this->date_closed)) {
$this->date_closed = new \DateTime();
$this->date_closed->modify(sprintf('+%s seconds', $this->lifetime));
}
$this->status = self::STATUS_SHOWN;
} | [
"public",
"function",
"shown",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"date_closed",
")",
")",
"{",
"$",
"this",
"->",
"date_closed",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"this",
"->",
"date_closed",
"->",
"modify",... | Notice shown. | [
"Notice",
"shown",
"."
] | train | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Entity/Notice.php#L126-L133 |
PortaText/php-sdk | src/PortaText/Command/Api/Cnam.php | Cnam.getEndpoint | protected function getEndpoint($method)
{
$endpoint = "cnam";
$number = $this->getArgument("id");
$file = $this->getArgument("file");
if (is_null($number) && is_null($file)) {
throw new \InvalidArgumentException("DID number cant be null");
}
$this->delArgu... | php | protected function getEndpoint($method)
{
$endpoint = "cnam";
$number = $this->getArgument("id");
$file = $this->getArgument("file");
if (is_null($number) && is_null($file)) {
throw new \InvalidArgumentException("DID number cant be null");
}
$this->delArgu... | [
"protected",
"function",
"getEndpoint",
"(",
"$",
"method",
")",
"{",
"$",
"endpoint",
"=",
"\"cnam\"",
";",
"$",
"number",
"=",
"$",
"this",
"->",
"getArgument",
"(",
"\"id\"",
")",
";",
"$",
"file",
"=",
"$",
"this",
"->",
"getArgument",
"(",
"\"file... | Returns a string with the endpoint for the given command.
@param string $method Method for this command.
@return string | [
"Returns",
"a",
"string",
"with",
"the",
"endpoint",
"for",
"the",
"given",
"command",
"."
] | train | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Cnam.php#L50-L63 |
lelivrescolaire/SQSBundle | DependencyInjection/Configuration.php | Configuration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('llssqs');
$rootNode
->fixXmlConfig('queue')
->append($this->getQueuesConfig());
return $treeBuilder;
} | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('llssqs');
$rootNode
->fixXmlConfig('queue')
->append($this->getQueuesConfig());
return $treeBuilder;
} | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"'llssqs'",
")",
";",
"$",
"rootNode",
"->",
"fixXmlConfig",
"(",
"'queu... | {@inheritdoc} | [
"{"
] | train | https://github.com/lelivrescolaire/SQSBundle/blob/bba3fa6d63d0ae1bddbc7b2fe3c2e737f49d6559/DependencyInjection/Configuration.php#L18-L27 |
phpmob/changmin | src/PhpMob/WidgetBundle/Twig/WidgetAssetsExtension.php | WidgetAssetsExtension.getAssets | public function getAssets()
{
$content = '';
if ($style = trim($this->widgetAssets->getStyle())) {
$content .= sprintf('<style>%s</style>', $style);
}
if ($script = trim($this->widgetAssets->getScript())) {
$content .= sprintf('<script>$(function(){%s});</sc... | php | public function getAssets()
{
$content = '';
if ($style = trim($this->widgetAssets->getStyle())) {
$content .= sprintf('<style>%s</style>', $style);
}
if ($script = trim($this->widgetAssets->getScript())) {
$content .= sprintf('<script>$(function(){%s});</sc... | [
"public",
"function",
"getAssets",
"(",
")",
"{",
"$",
"content",
"=",
"''",
";",
"if",
"(",
"$",
"style",
"=",
"trim",
"(",
"$",
"this",
"->",
"widgetAssets",
"->",
"getStyle",
"(",
")",
")",
")",
"{",
"$",
"content",
".=",
"sprintf",
"(",
"'<styl... | {@inheritdoc} | [
"{"
] | train | https://github.com/phpmob/changmin/blob/bfebb1561229094d1c138574abab75f2f1d17d66/src/PhpMob/WidgetBundle/Twig/WidgetAssetsExtension.php#L52-L65 |
aedart/laravel-helpers | src/Traits/Notifications/NotificationFactoryTrait.php | NotificationFactoryTrait.getNotificationFactory | public function getNotificationFactory(): ?Factory
{
if (!$this->hasNotificationFactory()) {
$this->setNotificationFactory($this->getDefaultNotificationFactory());
}
return $this->notificationFactory;
} | php | public function getNotificationFactory(): ?Factory
{
if (!$this->hasNotificationFactory()) {
$this->setNotificationFactory($this->getDefaultNotificationFactory());
}
return $this->notificationFactory;
} | [
"public",
"function",
"getNotificationFactory",
"(",
")",
":",
"?",
"Factory",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasNotificationFactory",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setNotificationFactory",
"(",
"$",
"this",
"->",
"getDefaultNotificationFac... | Get notification factory
If no notification factory has been set, this method will
set and return a default notification factory, if any such
value is available
@see getDefaultNotificationFactory()
@return Factory|null notification factory or null if none notification factory has been set | [
"Get",
"notification",
"factory"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Notifications/NotificationFactoryTrait.php#L53-L59 |
hisorange/traits | src/ObjectConfig.php | ObjectConfig.objectConfigGet | public function objectConfigGet($key, $default = null)
{
// Is this key exists?
if (array_key_exists($key, $this->objectConfig)) {
return $this->objectConfig[$key];
}
return $default;
} | php | public function objectConfigGet($key, $default = null)
{
// Is this key exists?
if (array_key_exists($key, $this->objectConfig)) {
return $this->objectConfig[$key];
}
return $default;
} | [
"public",
"function",
"objectConfigGet",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"// Is this key exists?",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"objectConfig",
")",
")",
"{",
"return",
"$",
"this",
... | Get a value from the config.
@param string $key
@param mixed $default
@return mixed | [
"Get",
"a",
"value",
"from",
"the",
"config",
"."
] | train | https://github.com/hisorange/traits/blob/465baf32faaf155b867dcc11218621e23ef4cac2/src/ObjectConfig.php#L43-L51 |
Chill-project/Main | Form/Type/DataTransformer/ObjectToIdTransformer.php | ObjectToIdTransformer.reverseTransform | public function reverseTransform($id)
{
if (!$id) {
return null;
}
$object = $this->om
->getRepository($this->class)
->find($id)
;
if (! $object) {
throw new TransformationFailedException();
}
return $object;
... | php | public function reverseTransform($id)
{
if (!$id) {
return null;
}
$object = $this->om
->getRepository($this->class)
->find($id)
;
if (! $object) {
throw new TransformationFailedException();
}
return $object;
... | [
"public",
"function",
"reverseTransform",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"$",
"id",
")",
"{",
"return",
"null",
";",
"}",
"$",
"object",
"=",
"$",
"this",
"->",
"om",
"->",
"getRepository",
"(",
"$",
"this",
"->",
"class",
")",
"->",
"... | Transforms a string (id) to an object
@param string $id
@return Object|null
@throws TransformationFailedException if object is not found. | [
"Transforms",
"a",
"string",
"(",
"id",
")",
"to",
"an",
"object"
] | train | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Form/Type/DataTransformer/ObjectToIdTransformer.php#L70-L86 |
askupasoftware/amarkal | Extensions/WordPress/Options/Notifier.php | Notifier.notify | static function notify( $message, $type )
{
$nots = State::get( 'notifications' );
array_push( $nots, array( 'message' => $message, 'type' => $type ) );
State::set( 'notifications', $nots );
} | php | static function notify( $message, $type )
{
$nots = State::get( 'notifications' );
array_push( $nots, array( 'message' => $message, 'type' => $type ) );
State::set( 'notifications', $nots );
} | [
"static",
"function",
"notify",
"(",
"$",
"message",
",",
"$",
"type",
")",
"{",
"$",
"nots",
"=",
"State",
"::",
"get",
"(",
"'notifications'",
")",
";",
"array_push",
"(",
"$",
"nots",
",",
"array",
"(",
"'message'",
"=>",
"$",
"message",
",",
"'ty... | Register a notification.
@param string $message The message to print.
@param string $type The type of notification [self::ERROR|self::SUCCESS|self::INFO]. | [
"Register",
"a",
"notification",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Options/Notifier.php#L23-L28 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.