id
int32 0
241k
| repo
stringlengths 6
63
| path
stringlengths 5
140
| func_name
stringlengths 3
151
| original_string
stringlengths 84
13k
| language
stringclasses 1
value | code
stringlengths 84
13k
| code_tokens
list | docstring
stringlengths 3
47.2k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 91
247
|
---|---|---|---|---|---|---|---|---|---|---|---|
19,000 | ClanCats/Core | src/bundles/UI/Table.php | Table.header | public function header( $data = array(), $attr = array() ) {
$this->header = $this->_repair_row( $data, $attr ); return $this;
} | php | public function header( $data = array(), $attr = array() ) {
$this->header = $this->_repair_row( $data, $attr ); return $this;
} | [
"public",
"function",
"header",
"(",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"attr",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"header",
"=",
"$",
"this",
"->",
"_repair_row",
"(",
"$",
"data",
",",
"$",
"attr",
")",
";",
"return",
"$",
"this",
";",
"}"
]
| set the header | [
"set",
"the",
"header"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/Table.php#L59-L61 |
19,001 | ClanCats/Core | src/bundles/UI/Table.php | Table._repair_row | private function _repair_row( $data = array(), $attr = array() ) {
$row = array();
foreach( $data as $key => $value ) {
if ( !$value instanceof HTML || ( $value->name != 'td' && $value->name != 'th' ) ) {
$value = static::cell( (string) $value );
}
if ( is_string( $key ) ) {
$row[$key] = $value;
} else {
$row[] = $value;
}
}
return array( $row, $attr );
} | php | private function _repair_row( $data = array(), $attr = array() ) {
$row = array();
foreach( $data as $key => $value ) {
if ( !$value instanceof HTML || ( $value->name != 'td' && $value->name != 'th' ) ) {
$value = static::cell( (string) $value );
}
if ( is_string( $key ) ) {
$row[$key] = $value;
} else {
$row[] = $value;
}
}
return array( $row, $attr );
} | [
"private",
"function",
"_repair_row",
"(",
"$",
"data",
"=",
"array",
"(",
")",
",",
"$",
"attr",
"=",
"array",
"(",
")",
")",
"{",
"$",
"row",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"value",
"instanceof",
"HTML",
"||",
"(",
"$",
"value",
"->",
"name",
"!=",
"'td'",
"&&",
"$",
"value",
"->",
"name",
"!=",
"'th'",
")",
")",
"{",
"$",
"value",
"=",
"static",
"::",
"cell",
"(",
"(",
"string",
")",
"$",
"value",
")",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"key",
")",
")",
"{",
"$",
"row",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"else",
"{",
"$",
"row",
"[",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"return",
"array",
"(",
"$",
"row",
",",
"$",
"attr",
")",
";",
"}"
]
| repair a row for rendering | [
"repair",
"a",
"row",
"for",
"rendering"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/UI/Table.php#L66-L79 |
19,002 | nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header/Itunes.php | Zend_Feed_Builder_Header_Itunes.setOwner | public function setOwner($name = '', $email = '')
{
if (!empty($email)) {
/**
* @see Zend_Validate_EmailAddress
*/
require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($email)) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the itunes owner's email property");
}
}
$this->offsetSet('owner', array('name' => $name, 'email' => $email));
return $this;
} | php | public function setOwner($name = '', $email = '')
{
if (!empty($email)) {
/**
* @see Zend_Validate_EmailAddress
*/
require_once 'Zend/Validate/EmailAddress.php';
$validate = new Zend_Validate_EmailAddress();
if (!$validate->isValid($email)) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set a valid email address into the itunes owner's email property");
}
}
$this->offsetSet('owner', array('name' => $name, 'email' => $email));
return $this;
} | [
"public",
"function",
"setOwner",
"(",
"$",
"name",
"=",
"''",
",",
"$",
"email",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"email",
")",
")",
"{",
"/**\n \t * @see Zend_Validate_EmailAddress\n \t */",
"require_once",
"'Zend/Validate/EmailAddress.php'",
";",
"$",
"validate",
"=",
"new",
"Zend_Validate_EmailAddress",
"(",
")",
";",
"if",
"(",
"!",
"$",
"validate",
"->",
"isValid",
"(",
"$",
"email",
")",
")",
"{",
"/**\n * @see Zend_Feed_Builder_Exception\n */",
"require_once",
"'Zend/Feed/Builder/Exception.php'",
";",
"throw",
"new",
"Zend_Feed_Builder_Exception",
"(",
"\"you have to set a valid email address into the itunes owner's email property\"",
")",
";",
"}",
"}",
"$",
"this",
"->",
"offsetSet",
"(",
"'owner'",
",",
"array",
"(",
"'name'",
"=>",
"$",
"name",
",",
"'email'",
"=>",
"$",
"email",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
]
| Sets the owner of the postcast
@param string $name default to the feed's author value
@param string $email default to the feed's email value
@return Zend_Feed_Builder_Header_Itunes
@throws Zend_Feed_Builder_Exception | [
"Sets",
"the",
"owner",
"of",
"the",
"postcast"
]
| 1c6da8c56ef717225ff904e1522aff94ed051601 | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header/Itunes.php#L112-L130 |
19,003 | nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header/Itunes.php | Zend_Feed_Builder_Header_Itunes.setBlock | public function setBlock($block)
{
$block = strtolower($block);
if (!in_array($block, array('yes', 'no'))) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set yes or no to the itunes block property");
}
$this->offsetSet('block', $block);
return $this;
} | php | public function setBlock($block)
{
$block = strtolower($block);
if (!in_array($block, array('yes', 'no'))) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set yes or no to the itunes block property");
}
$this->offsetSet('block', $block);
return $this;
} | [
"public",
"function",
"setBlock",
"(",
"$",
"block",
")",
"{",
"$",
"block",
"=",
"strtolower",
"(",
"$",
"block",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"block",
",",
"array",
"(",
"'yes'",
",",
"'no'",
")",
")",
")",
"{",
"/**\n * @see Zend_Feed_Builder_Exception\n */",
"require_once",
"'Zend/Feed/Builder/Exception.php'",
";",
"throw",
"new",
"Zend_Feed_Builder_Exception",
"(",
"\"you have to set yes or no to the itunes block property\"",
")",
";",
"}",
"$",
"this",
"->",
"offsetSet",
"(",
"'block'",
",",
"$",
"block",
")",
";",
"return",
"$",
"this",
";",
"}"
]
| Prevent a feed from appearing
@param string $block can be 'yes' or 'no'
@return Zend_Feed_Builder_Header_Itunes
@throws Zend_Feed_Builder_Exception | [
"Prevent",
"a",
"feed",
"from",
"appearing"
]
| 1c6da8c56ef717225ff904e1522aff94ed051601 | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header/Itunes.php#L178-L190 |
19,004 | nyeholt/silverstripe-external-content | thirdparty/Zend/Feed/Builder/Header/Itunes.php | Zend_Feed_Builder_Header_Itunes.setExplicit | public function setExplicit($explicit)
{
$explicit = strtolower($explicit);
if (!in_array($explicit, array('yes', 'no', 'clean'))) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set yes, no or clean to the itunes explicit property");
}
$this->offsetSet('explicit', $explicit);
return $this;
} | php | public function setExplicit($explicit)
{
$explicit = strtolower($explicit);
if (!in_array($explicit, array('yes', 'no', 'clean'))) {
/**
* @see Zend_Feed_Builder_Exception
*/
require_once 'Zend/Feed/Builder/Exception.php';
throw new Zend_Feed_Builder_Exception("you have to set yes, no or clean to the itunes explicit property");
}
$this->offsetSet('explicit', $explicit);
return $this;
} | [
"public",
"function",
"setExplicit",
"(",
"$",
"explicit",
")",
"{",
"$",
"explicit",
"=",
"strtolower",
"(",
"$",
"explicit",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"$",
"explicit",
",",
"array",
"(",
"'yes'",
",",
"'no'",
",",
"'clean'",
")",
")",
")",
"{",
"/**\n * @see Zend_Feed_Builder_Exception\n */",
"require_once",
"'Zend/Feed/Builder/Exception.php'",
";",
"throw",
"new",
"Zend_Feed_Builder_Exception",
"(",
"\"you have to set yes, no or clean to the itunes explicit property\"",
")",
";",
"}",
"$",
"this",
"->",
"offsetSet",
"(",
"'explicit'",
",",
"$",
"explicit",
")",
";",
"return",
"$",
"this",
";",
"}"
]
| Configuration of the parental advisory graphic
@param string $explicit can be 'yes', 'no' or 'clean'
@return Zend_Feed_Builder_Header_Itunes
@throws Zend_Feed_Builder_Exception | [
"Configuration",
"of",
"the",
"parental",
"advisory",
"graphic"
]
| 1c6da8c56ef717225ff904e1522aff94ed051601 | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/thirdparty/Zend/Feed/Builder/Header/Itunes.php#L199-L211 |
19,005 | alanpich/slender | src/Core/ModuleLoader/ModuleLoader.php | ModuleLoader.addConfig | public function addConfig(array $conf = array())
{
$appConfig =& $this->config;
// Iterate through new top-level keys
foreach ($conf as $key => $value) {
// If doesnt exist yet, create it
if (!isset($appConfig[$key])) {
$appConfig[$key] = $value;
continue;
}
// If it exists, and is already an array
if (is_array($appConfig[$key])) {
$mergedArray = array_merge_recursive($appConfig[$key], $value);
$appConfig[$key] = $mergedArray;
continue;
}
//@TODO check for iterators?
// Just set the value already!
$appConfig[$key] = $value;
}
} | php | public function addConfig(array $conf = array())
{
$appConfig =& $this->config;
// Iterate through new top-level keys
foreach ($conf as $key => $value) {
// If doesnt exist yet, create it
if (!isset($appConfig[$key])) {
$appConfig[$key] = $value;
continue;
}
// If it exists, and is already an array
if (is_array($appConfig[$key])) {
$mergedArray = array_merge_recursive($appConfig[$key], $value);
$appConfig[$key] = $mergedArray;
continue;
}
//@TODO check for iterators?
// Just set the value already!
$appConfig[$key] = $value;
}
} | [
"public",
"function",
"addConfig",
"(",
"array",
"$",
"conf",
"=",
"array",
"(",
")",
")",
"{",
"$",
"appConfig",
"=",
"&",
"$",
"this",
"->",
"config",
";",
"// Iterate through new top-level keys",
"foreach",
"(",
"$",
"conf",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"// If doesnt exist yet, create it",
"if",
"(",
"!",
"isset",
"(",
"$",
"appConfig",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"appConfig",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"continue",
";",
"}",
"// If it exists, and is already an array",
"if",
"(",
"is_array",
"(",
"$",
"appConfig",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"mergedArray",
"=",
"array_merge_recursive",
"(",
"$",
"appConfig",
"[",
"$",
"key",
"]",
",",
"$",
"value",
")",
";",
"$",
"appConfig",
"[",
"$",
"key",
"]",
"=",
"$",
"mergedArray",
";",
"continue",
";",
"}",
"//@TODO check for iterators?",
"// Just set the value already!",
"$",
"appConfig",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"}"
]
| Recursively merge array of settings into app
config. This is needed because \Slim\ConfigurationHander doesn't
seem to like recursing...
@param array $conf | [
"Recursively",
"merge",
"array",
"of",
"settings",
"into",
"app",
"config",
".",
"This",
"is",
"needed",
"because",
"\\",
"Slim",
"\\",
"ConfigurationHander",
"doesn",
"t",
"seem",
"to",
"like",
"recursing",
"..."
]
| 247f5c08af20cda95b116eb5d9f6f623d61e8a8a | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/ModuleLoader/ModuleLoader.php#L143-L168 |
19,006 | alanpich/slender | src/Core/ModuleLoader/ModuleLoader.php | ModuleLoader.setupAutoloaders | protected function setupAutoloaders($modulePath, array $mConf)
{
if (isset($mConf['autoload']['psr-4'])) {
foreach ($mConf['autoload']['psr-4'] as $ns => $path) {
$path = $modulePath . DIRECTORY_SEPARATOR . preg_replace("/^\\.\\//", "", $path);
$this->classLoader->registerNamespace($ns, $path, 'psr-4');
}
}
} | php | protected function setupAutoloaders($modulePath, array $mConf)
{
if (isset($mConf['autoload']['psr-4'])) {
foreach ($mConf['autoload']['psr-4'] as $ns => $path) {
$path = $modulePath . DIRECTORY_SEPARATOR . preg_replace("/^\\.\\//", "", $path);
$this->classLoader->registerNamespace($ns, $path, 'psr-4');
}
}
} | [
"protected",
"function",
"setupAutoloaders",
"(",
"$",
"modulePath",
",",
"array",
"$",
"mConf",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"mConf",
"[",
"'autoload'",
"]",
"[",
"'psr-4'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"mConf",
"[",
"'autoload'",
"]",
"[",
"'psr-4'",
"]",
"as",
"$",
"ns",
"=>",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"$",
"modulePath",
".",
"DIRECTORY_SEPARATOR",
".",
"preg_replace",
"(",
"\"/^\\\\.\\\\//\"",
",",
"\"\"",
",",
"$",
"path",
")",
";",
"$",
"this",
"->",
"classLoader",
"->",
"registerNamespace",
"(",
"$",
"ns",
",",
"$",
"path",
",",
"'psr-4'",
")",
";",
"}",
"}",
"}"
]
| Copy autoloader settings to global collection ready for registering | [
"Copy",
"autoloader",
"settings",
"to",
"global",
"collection",
"ready",
"for",
"registering"
]
| 247f5c08af20cda95b116eb5d9f6f623d61e8a8a | https://github.com/alanpich/slender/blob/247f5c08af20cda95b116eb5d9f6f623d61e8a8a/src/Core/ModuleLoader/ModuleLoader.php#L175-L183 |
19,007 | maniaplanet/matchmaking-lobby | MatchMakingLobby/Services/PlayerInfo.php | PlayerInfo.CleanUp | static function CleanUp()
{
$limit = new \DateTime('-30 minutes');
foreach(self::$instances as $login => $player)
if($player->awaySince && $player->awaySince < $limit) unset(self::$instances[$login]);
} | php | static function CleanUp()
{
$limit = new \DateTime('-30 minutes');
foreach(self::$instances as $login => $player)
if($player->awaySince && $player->awaySince < $limit) unset(self::$instances[$login]);
} | [
"static",
"function",
"CleanUp",
"(",
")",
"{",
"$",
"limit",
"=",
"new",
"\\",
"DateTime",
"(",
"'-30 minutes'",
")",
";",
"foreach",
"(",
"self",
"::",
"$",
"instances",
"as",
"$",
"login",
"=>",
"$",
"player",
")",
"if",
"(",
"$",
"player",
"->",
"awaySince",
"&&",
"$",
"player",
"->",
"awaySince",
"<",
"$",
"limit",
")",
"unset",
"(",
"self",
"::",
"$",
"instances",
"[",
"$",
"login",
"]",
")",
";",
"}"
]
| Destroy players disconnected for more than 1 hour | [
"Destroy",
"players",
"disconnected",
"for",
"more",
"than",
"1",
"hour"
]
| 384f22cdd2cfb0204a071810549eaf1eb01d8b7f | https://github.com/maniaplanet/matchmaking-lobby/blob/384f22cdd2cfb0204a071810549eaf1eb01d8b7f/MatchMakingLobby/Services/PlayerInfo.php#L88-L93 |
19,008 | limen/php-jobs | src/Contracts/BaseJob.php | BaseJob.failed | protected function failed()
{
$retryCount = $this->model->getTriedCount() + 1;
if ($retryCount >= $this->getMaxRetryCount()) {
$this->model->setStatus(JobsConst::JOB_STATUS_FAILED);
} else {
$this->model->setStatus(JobsConst::JOB_STATUS_WAITING_RETRY);
$this->model->setTryAt($this->getNextTryTime());
}
$this->model->setTriedCount($retryCount);
return $this->model->persist();
} | php | protected function failed()
{
$retryCount = $this->model->getTriedCount() + 1;
if ($retryCount >= $this->getMaxRetryCount()) {
$this->model->setStatus(JobsConst::JOB_STATUS_FAILED);
} else {
$this->model->setStatus(JobsConst::JOB_STATUS_WAITING_RETRY);
$this->model->setTryAt($this->getNextTryTime());
}
$this->model->setTriedCount($retryCount);
return $this->model->persist();
} | [
"protected",
"function",
"failed",
"(",
")",
"{",
"$",
"retryCount",
"=",
"$",
"this",
"->",
"model",
"->",
"getTriedCount",
"(",
")",
"+",
"1",
";",
"if",
"(",
"$",
"retryCount",
">=",
"$",
"this",
"->",
"getMaxRetryCount",
"(",
")",
")",
"{",
"$",
"this",
"->",
"model",
"->",
"setStatus",
"(",
"JobsConst",
"::",
"JOB_STATUS_FAILED",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"model",
"->",
"setStatus",
"(",
"JobsConst",
"::",
"JOB_STATUS_WAITING_RETRY",
")",
";",
"$",
"this",
"->",
"model",
"->",
"setTryAt",
"(",
"$",
"this",
"->",
"getNextTryTime",
"(",
")",
")",
";",
"}",
"$",
"this",
"->",
"model",
"->",
"setTriedCount",
"(",
"$",
"retryCount",
")",
";",
"return",
"$",
"this",
"->",
"model",
"->",
"persist",
"(",
")",
";",
"}"
]
| After failed we need to update tried count
and check whether the tried count have reached to max retry count | [
"After",
"failed",
"we",
"need",
"to",
"update",
"tried",
"count",
"and",
"check",
"whether",
"the",
"tried",
"count",
"have",
"reached",
"to",
"max",
"retry",
"count"
]
| 525f4082b49a7a3e69acb4cea3a622244f1616b9 | https://github.com/limen/php-jobs/blob/525f4082b49a7a3e69acb4cea3a622244f1616b9/src/Contracts/BaseJob.php#L236-L249 |
19,009 | CakeCMS/Core | src/Cms.php | Cms.mergeConfig | public static function mergeConfig($key, $config)
{
$values = Hash::merge((array) Configure::read($key), $config);
Configure::write($key, $values);
return $values;
} | php | public static function mergeConfig($key, $config)
{
$values = Hash::merge((array) Configure::read($key), $config);
Configure::write($key, $values);
return $values;
} | [
"public",
"static",
"function",
"mergeConfig",
"(",
"$",
"key",
",",
"$",
"config",
")",
"{",
"$",
"values",
"=",
"Hash",
"::",
"merge",
"(",
"(",
"array",
")",
"Configure",
"::",
"read",
"(",
"$",
"key",
")",
",",
"$",
"config",
")",
";",
"Configure",
"::",
"write",
"(",
"$",
"key",
",",
"$",
"values",
")",
";",
"return",
"$",
"values",
";",
"}"
]
| Merge configure values by key.
@param string $key
@param array|string $config
@return array|mixed | [
"Merge",
"configure",
"values",
"by",
"key",
"."
]
| f9cba7aa0043a10e5c35bd45fbad158688a09a96 | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Cms.php#L56-L62 |
19,010 | CakeCMS/Core | src/Cms.php | Cms._initPaths | protected function _initPaths()
{
$path = Path::getInstance();
$path->setRoot(ROOT);
// Setup all webroot paths
$path->set('webroot', Configure::read('App.wwwRoot'));
foreach ((array) Plugin::loaded() as $name) {
$plgPath = Plugin::path($name) . '/' . Configure::read('App.webroot') . '/';
$path->set('webroot', FS::clean($plgPath), Path::MOD_APPEND);
}
// Setup applicatiojn paths
$paths = Configure::read('App.paths');
foreach ($paths as $alias => $_paths) {
$path->set($alias, $_paths);
}
return $path;
} | php | protected function _initPaths()
{
$path = Path::getInstance();
$path->setRoot(ROOT);
// Setup all webroot paths
$path->set('webroot', Configure::read('App.wwwRoot'));
foreach ((array) Plugin::loaded() as $name) {
$plgPath = Plugin::path($name) . '/' . Configure::read('App.webroot') . '/';
$path->set('webroot', FS::clean($plgPath), Path::MOD_APPEND);
}
// Setup applicatiojn paths
$paths = Configure::read('App.paths');
foreach ($paths as $alias => $_paths) {
$path->set($alias, $_paths);
}
return $path;
} | [
"protected",
"function",
"_initPaths",
"(",
")",
"{",
"$",
"path",
"=",
"Path",
"::",
"getInstance",
"(",
")",
";",
"$",
"path",
"->",
"setRoot",
"(",
"ROOT",
")",
";",
"// Setup all webroot paths",
"$",
"path",
"->",
"set",
"(",
"'webroot'",
",",
"Configure",
"::",
"read",
"(",
"'App.wwwRoot'",
")",
")",
";",
"foreach",
"(",
"(",
"array",
")",
"Plugin",
"::",
"loaded",
"(",
")",
"as",
"$",
"name",
")",
"{",
"$",
"plgPath",
"=",
"Plugin",
"::",
"path",
"(",
"$",
"name",
")",
".",
"'/'",
".",
"Configure",
"::",
"read",
"(",
"'App.webroot'",
")",
".",
"'/'",
";",
"$",
"path",
"->",
"set",
"(",
"'webroot'",
",",
"FS",
"::",
"clean",
"(",
"$",
"plgPath",
")",
",",
"Path",
"::",
"MOD_APPEND",
")",
";",
"}",
"// Setup applicatiojn paths",
"$",
"paths",
"=",
"Configure",
"::",
"read",
"(",
"'App.paths'",
")",
";",
"foreach",
"(",
"$",
"paths",
"as",
"$",
"alias",
"=>",
"$",
"_paths",
")",
"{",
"$",
"path",
"->",
"set",
"(",
"$",
"alias",
",",
"$",
"_paths",
")",
";",
"}",
"return",
"$",
"path",
";",
"}"
]
| Init base paths.
@return Path
@throws \JBZoo\Path\Exception | [
"Init",
"base",
"paths",
"."
]
| f9cba7aa0043a10e5c35bd45fbad158688a09a96 | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Cms.php#L86-L105 |
19,011 | anime-db/app-bundle | src/Entity/Task.php | Task.executed | public function executed()
{
$this->setLastRun(new \DateTime());
if (!$this->getModify()) {
$this->setStatus(self::STATUS_DISABLED);
}
if ($this->getStatus() == self::STATUS_ENABLED) {
// find near time task launch
$next_run = $this->getNextRun();
do {
// failed to compute time of next run
if ($next_run->modify($this->getModify()) === false) {
$this->setModify('');
$this->setStatus(self::STATUS_DISABLED);
break;
}
} while ($next_run->getTimestamp() <= time());
$this->setNextRun($next_run);
}
} | php | public function executed()
{
$this->setLastRun(new \DateTime());
if (!$this->getModify()) {
$this->setStatus(self::STATUS_DISABLED);
}
if ($this->getStatus() == self::STATUS_ENABLED) {
// find near time task launch
$next_run = $this->getNextRun();
do {
// failed to compute time of next run
if ($next_run->modify($this->getModify()) === false) {
$this->setModify('');
$this->setStatus(self::STATUS_DISABLED);
break;
}
} while ($next_run->getTimestamp() <= time());
$this->setNextRun($next_run);
}
} | [
"public",
"function",
"executed",
"(",
")",
"{",
"$",
"this",
"->",
"setLastRun",
"(",
"new",
"\\",
"DateTime",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"getModify",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setStatus",
"(",
"self",
"::",
"STATUS_DISABLED",
")",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"getStatus",
"(",
")",
"==",
"self",
"::",
"STATUS_ENABLED",
")",
"{",
"// find near time task launch",
"$",
"next_run",
"=",
"$",
"this",
"->",
"getNextRun",
"(",
")",
";",
"do",
"{",
"// failed to compute time of next run",
"if",
"(",
"$",
"next_run",
"->",
"modify",
"(",
"$",
"this",
"->",
"getModify",
"(",
")",
")",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"setModify",
"(",
"''",
")",
";",
"$",
"this",
"->",
"setStatus",
"(",
"self",
"::",
"STATUS_DISABLED",
")",
";",
"break",
";",
"}",
"}",
"while",
"(",
"$",
"next_run",
"->",
"getTimestamp",
"(",
")",
"<=",
"time",
"(",
")",
")",
";",
"$",
"this",
"->",
"setNextRun",
"(",
"$",
"next_run",
")",
";",
"}",
"}"
]
| Update task after execution. | [
"Update",
"task",
"after",
"execution",
"."
]
| ca3b342081719d41ba018792a75970cbb1f1fe22 | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Entity/Task.php#L243-L262 |
19,012 | slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.getUserCustomerRelations | public function getUserCustomerRelations($criteria = null, PropelPDO $con = null)
{
$partial = $this->collUserCustomerRelationsPartial && !$this->isNew();
if (null === $this->collUserCustomerRelations || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUserCustomerRelations) {
// return empty collection
$this->initUserCustomerRelations();
} else {
$collUserCustomerRelations = UserCustomerRelationQuery::create(null, $criteria)
->filterByUser($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collUserCustomerRelationsPartial && count($collUserCustomerRelations)) {
$this->initUserCustomerRelations(false);
foreach ($collUserCustomerRelations as $obj) {
if (false == $this->collUserCustomerRelations->contains($obj)) {
$this->collUserCustomerRelations->append($obj);
}
}
$this->collUserCustomerRelationsPartial = true;
}
$collUserCustomerRelations->getInternalIterator()->rewind();
return $collUserCustomerRelations;
}
if ($partial && $this->collUserCustomerRelations) {
foreach ($this->collUserCustomerRelations as $obj) {
if ($obj->isNew()) {
$collUserCustomerRelations[] = $obj;
}
}
}
$this->collUserCustomerRelations = $collUserCustomerRelations;
$this->collUserCustomerRelationsPartial = false;
}
}
return $this->collUserCustomerRelations;
} | php | public function getUserCustomerRelations($criteria = null, PropelPDO $con = null)
{
$partial = $this->collUserCustomerRelationsPartial && !$this->isNew();
if (null === $this->collUserCustomerRelations || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUserCustomerRelations) {
// return empty collection
$this->initUserCustomerRelations();
} else {
$collUserCustomerRelations = UserCustomerRelationQuery::create(null, $criteria)
->filterByUser($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collUserCustomerRelationsPartial && count($collUserCustomerRelations)) {
$this->initUserCustomerRelations(false);
foreach ($collUserCustomerRelations as $obj) {
if (false == $this->collUserCustomerRelations->contains($obj)) {
$this->collUserCustomerRelations->append($obj);
}
}
$this->collUserCustomerRelationsPartial = true;
}
$collUserCustomerRelations->getInternalIterator()->rewind();
return $collUserCustomerRelations;
}
if ($partial && $this->collUserCustomerRelations) {
foreach ($this->collUserCustomerRelations as $obj) {
if ($obj->isNew()) {
$collUserCustomerRelations[] = $obj;
}
}
}
$this->collUserCustomerRelations = $collUserCustomerRelations;
$this->collUserCustomerRelationsPartial = false;
}
}
return $this->collUserCustomerRelations;
} | [
"public",
"function",
"getUserCustomerRelations",
"(",
"$",
"criteria",
"=",
"null",
",",
"PropelPDO",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collUserCustomerRelationsPartial",
"&&",
"!",
"$",
"this",
"->",
"isNew",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"collUserCustomerRelations",
"||",
"null",
"!==",
"$",
"criteria",
"||",
"$",
"partial",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNew",
"(",
")",
"&&",
"null",
"===",
"$",
"this",
"->",
"collUserCustomerRelations",
")",
"{",
"// return empty collection",
"$",
"this",
"->",
"initUserCustomerRelations",
"(",
")",
";",
"}",
"else",
"{",
"$",
"collUserCustomerRelations",
"=",
"UserCustomerRelationQuery",
"::",
"create",
"(",
"null",
",",
"$",
"criteria",
")",
"->",
"filterByUser",
"(",
"$",
"this",
")",
"->",
"find",
"(",
"$",
"con",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"criteria",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"this",
"->",
"collUserCustomerRelationsPartial",
"&&",
"count",
"(",
"$",
"collUserCustomerRelations",
")",
")",
"{",
"$",
"this",
"->",
"initUserCustomerRelations",
"(",
"false",
")",
";",
"foreach",
"(",
"$",
"collUserCustomerRelations",
"as",
"$",
"obj",
")",
"{",
"if",
"(",
"false",
"==",
"$",
"this",
"->",
"collUserCustomerRelations",
"->",
"contains",
"(",
"$",
"obj",
")",
")",
"{",
"$",
"this",
"->",
"collUserCustomerRelations",
"->",
"append",
"(",
"$",
"obj",
")",
";",
"}",
"}",
"$",
"this",
"->",
"collUserCustomerRelationsPartial",
"=",
"true",
";",
"}",
"$",
"collUserCustomerRelations",
"->",
"getInternalIterator",
"(",
")",
"->",
"rewind",
"(",
")",
";",
"return",
"$",
"collUserCustomerRelations",
";",
"}",
"if",
"(",
"$",
"partial",
"&&",
"$",
"this",
"->",
"collUserCustomerRelations",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"collUserCustomerRelations",
"as",
"$",
"obj",
")",
"{",
"if",
"(",
"$",
"obj",
"->",
"isNew",
"(",
")",
")",
"{",
"$",
"collUserCustomerRelations",
"[",
"]",
"=",
"$",
"obj",
";",
"}",
"}",
"}",
"$",
"this",
"->",
"collUserCustomerRelations",
"=",
"$",
"collUserCustomerRelations",
";",
"$",
"this",
"->",
"collUserCustomerRelationsPartial",
"=",
"false",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"collUserCustomerRelations",
";",
"}"
]
| Gets an array of UserCustomerRelation 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 cached collection is returned.
If this User is new, it will return
an empty collection or the current collection; the criteria is ignored on a new object.
@param Criteria $criteria optional Criteria object to narrow the query
@param PropelPDO $con optional connection object
@return PropelObjectCollection|UserCustomerRelation[] List of UserCustomerRelation objects
@throws PropelException | [
"Gets",
"an",
"array",
"of",
"UserCustomerRelation",
"objects",
"which",
"contain",
"a",
"foreign",
"key",
"that",
"references",
"this",
"object",
"."
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1669-L1712 |
19,013 | slashworks/control-bundle | src/Slashworks/BackendBundle/Model/om/BaseUser.php | BaseUser.countUserCustomerRelations | public function countUserCustomerRelations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
$partial = $this->collUserCustomerRelationsPartial && !$this->isNew();
if (null === $this->collUserCustomerRelations || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUserCustomerRelations) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getUserCustomerRelations());
}
$query = UserCustomerRelationQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByUser($this)
->count($con);
}
return count($this->collUserCustomerRelations);
} | php | public function countUserCustomerRelations(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
{
$partial = $this->collUserCustomerRelationsPartial && !$this->isNew();
if (null === $this->collUserCustomerRelations || null !== $criteria || $partial) {
if ($this->isNew() && null === $this->collUserCustomerRelations) {
return 0;
}
if ($partial && !$criteria) {
return count($this->getUserCustomerRelations());
}
$query = UserCustomerRelationQuery::create(null, $criteria);
if ($distinct) {
$query->distinct();
}
return $query
->filterByUser($this)
->count($con);
}
return count($this->collUserCustomerRelations);
} | [
"public",
"function",
"countUserCustomerRelations",
"(",
"Criteria",
"$",
"criteria",
"=",
"null",
",",
"$",
"distinct",
"=",
"false",
",",
"PropelPDO",
"$",
"con",
"=",
"null",
")",
"{",
"$",
"partial",
"=",
"$",
"this",
"->",
"collUserCustomerRelationsPartial",
"&&",
"!",
"$",
"this",
"->",
"isNew",
"(",
")",
";",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"collUserCustomerRelations",
"||",
"null",
"!==",
"$",
"criteria",
"||",
"$",
"partial",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isNew",
"(",
")",
"&&",
"null",
"===",
"$",
"this",
"->",
"collUserCustomerRelations",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"$",
"partial",
"&&",
"!",
"$",
"criteria",
")",
"{",
"return",
"count",
"(",
"$",
"this",
"->",
"getUserCustomerRelations",
"(",
")",
")",
";",
"}",
"$",
"query",
"=",
"UserCustomerRelationQuery",
"::",
"create",
"(",
"null",
",",
"$",
"criteria",
")",
";",
"if",
"(",
"$",
"distinct",
")",
"{",
"$",
"query",
"->",
"distinct",
"(",
")",
";",
"}",
"return",
"$",
"query",
"->",
"filterByUser",
"(",
"$",
"this",
")",
"->",
"count",
"(",
"$",
"con",
")",
";",
"}",
"return",
"count",
"(",
"$",
"this",
"->",
"collUserCustomerRelations",
")",
";",
"}"
]
| Returns the number of related UserCustomerRelation objects.
@param Criteria $criteria
@param boolean $distinct
@param PropelPDO $con
@return int Count of related UserCustomerRelation objects.
@throws PropelException | [
"Returns",
"the",
"number",
"of",
"related",
"UserCustomerRelation",
"objects",
"."
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1755-L1777 |
19,014 | 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",
"(",
"null",
",",
"$",
"criteria",
")",
";",
"$",
"query",
"->",
"joinWith",
"(",
"'Customer'",
",",
"$",
"join_behavior",
")",
";",
"return",
"$",
"this",
"->",
"getUserCustomerRelations",
"(",
"$",
"query",
",",
"$",
"con",
")",
";",
"}"
]
| 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 to keep the public
api reasonable. You can provide public methods for those you
actually need in User.
@param Criteria $criteria optional Criteria object to narrow the query
@param PropelPDO $con optional connection object
@param string $join_behavior optional join type to use (defaults to Criteria::LEFT_JOIN)
@return PropelObjectCollection|UserCustomerRelation[] List of UserCustomerRelation objects | [
"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",
"."
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1849-L1855 |
19,015 | 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 empty collection
$this->initUserRoles();
} else {
$collUserRoles = UserRoleQuery::create(null, $criteria)
->filterByUser($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collUserRolesPartial && count($collUserRoles)) {
$this->initUserRoles(false);
foreach ($collUserRoles as $obj) {
if (false == $this->collUserRoles->contains($obj)) {
$this->collUserRoles->append($obj);
}
}
$this->collUserRolesPartial = true;
}
$collUserRoles->getInternalIterator()->rewind();
return $collUserRoles;
}
if ($partial && $this->collUserRoles) {
foreach ($this->collUserRoles as $obj) {
if ($obj->isNew()) {
$collUserRoles[] = $obj;
}
}
}
$this->collUserRoles = $collUserRoles;
$this->collUserRolesPartial = false;
}
}
return $this->collUserRoles;
} | 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 empty collection
$this->initUserRoles();
} else {
$collUserRoles = UserRoleQuery::create(null, $criteria)
->filterByUser($this)
->find($con);
if (null !== $criteria) {
if (false !== $this->collUserRolesPartial && count($collUserRoles)) {
$this->initUserRoles(false);
foreach ($collUserRoles as $obj) {
if (false == $this->collUserRoles->contains($obj)) {
$this->collUserRoles->append($obj);
}
}
$this->collUserRolesPartial = true;
}
$collUserRoles->getInternalIterator()->rewind();
return $collUserRoles;
}
if ($partial && $this->collUserRoles) {
foreach ($this->collUserRoles as $obj) {
if ($obj->isNew()) {
$collUserRoles[] = $obj;
}
}
}
$this->collUserRoles = $collUserRoles;
$this->collUserRolesPartial = false;
}
}
return $this->collUserRoles;
} | [
"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 empty collection",
"$",
"this",
"->",
"initUserRoles",
"(",
")",
";",
"}",
"else",
"{",
"$",
"collUserRoles",
"=",
"UserRoleQuery",
"::",
"create",
"(",
"null",
",",
"$",
"criteria",
")",
"->",
"filterByUser",
"(",
"$",
"this",
")",
"->",
"find",
"(",
"$",
"con",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"criteria",
")",
"{",
"if",
"(",
"false",
"!==",
"$",
"this",
"->",
"collUserRolesPartial",
"&&",
"count",
"(",
"$",
"collUserRoles",
")",
")",
"{",
"$",
"this",
"->",
"initUserRoles",
"(",
"false",
")",
";",
"foreach",
"(",
"$",
"collUserRoles",
"as",
"$",
"obj",
")",
"{",
"if",
"(",
"false",
"==",
"$",
"this",
"->",
"collUserRoles",
"->",
"contains",
"(",
"$",
"obj",
")",
")",
"{",
"$",
"this",
"->",
"collUserRoles",
"->",
"append",
"(",
"$",
"obj",
")",
";",
"}",
"}",
"$",
"this",
"->",
"collUserRolesPartial",
"=",
"true",
";",
"}",
"$",
"collUserRoles",
"->",
"getInternalIterator",
"(",
")",
"->",
"rewind",
"(",
")",
";",
"return",
"$",
"collUserRoles",
";",
"}",
"if",
"(",
"$",
"partial",
"&&",
"$",
"this",
"->",
"collUserRoles",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"collUserRoles",
"as",
"$",
"obj",
")",
"{",
"if",
"(",
"$",
"obj",
"->",
"isNew",
"(",
")",
")",
"{",
"$",
"collUserRoles",
"[",
"]",
"=",
"$",
"obj",
";",
"}",
"}",
"}",
"$",
"this",
"->",
"collUserRoles",
"=",
"$",
"collUserRoles",
";",
"$",
"this",
"->",
"collUserRolesPartial",
"=",
"false",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"collUserRoles",
";",
"}"
]
| 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 cached collection is returned.
If this User is new, it will return
an empty collection or the current collection; the criteria is ignored on a new object.
@param Criteria $criteria optional Criteria object to narrow the query
@param PropelPDO $con optional connection object
@return PropelObjectCollection|UserRole[] List of UserRole objects
@throws PropelException | [
"Gets",
"an",
"array",
"of",
"UserRole",
"objects",
"which",
"contain",
"a",
"foreign",
"key",
"that",
"references",
"this",
"object",
"."
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/BackendBundle/Model/om/BaseUser.php#L1919-L1962 |
19,016 | 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 table with the profiler data to the body
CCEvent::mind( 'response.output', function( $output )
{
if ( strpos( $output, '</body>' ) === false )
{
return $output;
}
$table = \UI\Table::create( array(
'style' => array(
'width' => '100%',
),
'cellpadding' => '5',
'class' => 'table debug-table debug-table-profiler',
));
$table->header( array( '#', 'message', 'memory', 'time' ) );
foreach( \CCProfiler::data() as $key => $item )
{
$table->row( array( $key+1, $item[0], $item[1], $item[2] ) );
}
// add the table before the body end
return str_replace( '</body>', $table."\n</body>", $output );
});
// also add an error inspector hook so that we can access the
// profiler data in the error handler
CCError_Inspector::info_callback( 'Profiler', function()
{
$table = array();
foreach( \CCProfiler::data() as $key => $check )
{
$table[('#'.($key+1).': '.$check[2] )] = $check[0];
}
return $table;
});
}
} | 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 table with the profiler data to the body
CCEvent::mind( 'response.output', function( $output )
{
if ( strpos( $output, '</body>' ) === false )
{
return $output;
}
$table = \UI\Table::create( array(
'style' => array(
'width' => '100%',
),
'cellpadding' => '5',
'class' => 'table debug-table debug-table-profiler',
));
$table->header( array( '#', 'message', 'memory', 'time' ) );
foreach( \CCProfiler::data() as $key => $item )
{
$table->row( array( $key+1, $item[0], $item[1], $item[2] ) );
}
// add the table before the body end
return str_replace( '</body>', $table."\n</body>", $output );
});
// also add an error inspector hook so that we can access the
// profiler data in the error handler
CCError_Inspector::info_callback( 'Profiler', function()
{
$table = array();
foreach( \CCProfiler::data() as $key => $check )
{
$table[('#'.($key+1).': '.$check[2] )] = $check[0];
}
return $table;
});
}
} | [
"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 table with the profiler data to the body",
"CCEvent",
"::",
"mind",
"(",
"'response.output'",
",",
"function",
"(",
"$",
"output",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"output",
",",
"'</body>'",
")",
"===",
"false",
")",
"{",
"return",
"$",
"output",
";",
"}",
"$",
"table",
"=",
"\\",
"UI",
"\\",
"Table",
"::",
"create",
"(",
"array",
"(",
"'style'",
"=>",
"array",
"(",
"'width'",
"=>",
"'100%'",
",",
")",
",",
"'cellpadding'",
"=>",
"'5'",
",",
"'class'",
"=>",
"'table debug-table debug-table-profiler'",
",",
")",
")",
";",
"$",
"table",
"->",
"header",
"(",
"array",
"(",
"'#'",
",",
"'message'",
",",
"'memory'",
",",
"'time'",
")",
")",
";",
"foreach",
"(",
"\\",
"CCProfiler",
"::",
"data",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$",
"table",
"->",
"row",
"(",
"array",
"(",
"$",
"key",
"+",
"1",
",",
"$",
"item",
"[",
"0",
"]",
",",
"$",
"item",
"[",
"1",
"]",
",",
"$",
"item",
"[",
"2",
"]",
")",
")",
";",
"}",
"// add the table before the body end",
"return",
"str_replace",
"(",
"'</body>'",
",",
"$",
"table",
".",
"\"\\n</body>\"",
",",
"$",
"output",
")",
";",
"}",
")",
";",
"// also add an error inspector hook so that we can access the ",
"// profiler data in the error handler",
"CCError_Inspector",
"::",
"info_callback",
"(",
"'Profiler'",
",",
"function",
"(",
")",
"{",
"$",
"table",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"\\",
"CCProfiler",
"::",
"data",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"check",
")",
"{",
"$",
"table",
"[",
"(",
"'#'",
".",
"(",
"$",
"key",
"+",
"1",
")",
".",
"': '",
".",
"$",
"check",
"[",
"2",
"]",
")",
"]",
"=",
"$",
"check",
"[",
"0",
"]",
";",
"}",
"return",
"$",
"table",
";",
"}",
")",
";",
"}",
"}"
]
| The Autoloader initialisation
@return void | [
"The",
"Autoloader",
"initialisation"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCProfiler.php#L34-L87 |
19,017 | 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",
"(",
"$",
"memory",
")",
";",
"}",
"return",
"$",
"memory",
";",
"}"
]
| returns current memory usage
@param bool $format
@return string | [
"returns",
"current",
"memory",
"usage"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCProfiler.php#L135-L145 |
19,018 | 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",
"(",
"$",
"time",
")",
";",
"}",
"return",
"$",
"time",
";",
"}"
]
| returns current execution time
@param bool $format
@return string | [
"returns",
"current",
"execution",
"time"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCProfiler.php#L153-L163 |
19,019 | 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".',
$file
);
}
$dir = dirname($file);
foreach ($data['imports'] as $i => $import) {
if (false === is_array($import)) {
throw ImportException::format(
'One of the "imports" values (#%d) is not valid in "%s".',
$i,
$file
);
}
if (false === isset($import['resource'])) {
throw ImportException::format(
'A resource was not defined for an import in "%s".',
$file
);
}
$this->setCurrentDir($dir);
$data = array_replace_recursive(
$this->import(
$import['resource'],
null,
isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false
),
$data
);
}
}
$global = $this->wise ? $this->wise->getGlobalParameters() : array();
$_this = $this;
ArrayUtil::walkRecursive(
$data,
function (&$value, $key, &$array) use (&$data, $global, $_this) {
$value = $_this->doReplace($value, $data, $global);
if (false !== strpos($key, '%')) {
unset($array[$key]);
$key = $_this->doReplace($key, $data, $global);
$array[$key] = $value;
}
}
);
return $data;
} | 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".',
$file
);
}
$dir = dirname($file);
foreach ($data['imports'] as $i => $import) {
if (false === is_array($import)) {
throw ImportException::format(
'One of the "imports" values (#%d) is not valid in "%s".',
$i,
$file
);
}
if (false === isset($import['resource'])) {
throw ImportException::format(
'A resource was not defined for an import in "%s".',
$file
);
}
$this->setCurrentDir($dir);
$data = array_replace_recursive(
$this->import(
$import['resource'],
null,
isset($import['ignore_errors']) ? (bool) $import['ignore_errors'] : false
),
$data
);
}
}
$global = $this->wise ? $this->wise->getGlobalParameters() : array();
$_this = $this;
ArrayUtil::walkRecursive(
$data,
function (&$value, $key, &$array) use (&$data, $global, $_this) {
$value = $_this->doReplace($value, $data, $global);
if (false !== strpos($key, '%')) {
unset($array[$key]);
$key = $_this->doReplace($key, $data, $global);
$array[$key] = $value;
}
}
);
return $data;
} | [
"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\".'",
",",
"$",
"file",
")",
";",
"}",
"$",
"dir",
"=",
"dirname",
"(",
"$",
"file",
")",
";",
"foreach",
"(",
"$",
"data",
"[",
"'imports'",
"]",
"as",
"$",
"i",
"=>",
"$",
"import",
")",
"{",
"if",
"(",
"false",
"===",
"is_array",
"(",
"$",
"import",
")",
")",
"{",
"throw",
"ImportException",
"::",
"format",
"(",
"'One of the \"imports\" values (#%d) is not valid in \"%s\".'",
",",
"$",
"i",
",",
"$",
"file",
")",
";",
"}",
"if",
"(",
"false",
"===",
"isset",
"(",
"$",
"import",
"[",
"'resource'",
"]",
")",
")",
"{",
"throw",
"ImportException",
"::",
"format",
"(",
"'A resource was not defined for an import in \"%s\".'",
",",
"$",
"file",
")",
";",
"}",
"$",
"this",
"->",
"setCurrentDir",
"(",
"$",
"dir",
")",
";",
"$",
"data",
"=",
"array_replace_recursive",
"(",
"$",
"this",
"->",
"import",
"(",
"$",
"import",
"[",
"'resource'",
"]",
",",
"null",
",",
"isset",
"(",
"$",
"import",
"[",
"'ignore_errors'",
"]",
")",
"?",
"(",
"bool",
")",
"$",
"import",
"[",
"'ignore_errors'",
"]",
":",
"false",
")",
",",
"$",
"data",
")",
";",
"}",
"}",
"$",
"global",
"=",
"$",
"this",
"->",
"wise",
"?",
"$",
"this",
"->",
"wise",
"->",
"getGlobalParameters",
"(",
")",
":",
"array",
"(",
")",
";",
"$",
"_this",
"=",
"$",
"this",
";",
"ArrayUtil",
"::",
"walkRecursive",
"(",
"$",
"data",
",",
"function",
"(",
"&",
"$",
"value",
",",
"$",
"key",
",",
"&",
"$",
"array",
")",
"use",
"(",
"&",
"$",
"data",
",",
"$",
"global",
",",
"$",
"_this",
")",
"{",
"$",
"value",
"=",
"$",
"_this",
"->",
"doReplace",
"(",
"$",
"value",
",",
"$",
"data",
",",
"$",
"global",
")",
";",
"if",
"(",
"false",
"!==",
"strpos",
"(",
"$",
"key",
",",
"'%'",
")",
")",
"{",
"unset",
"(",
"$",
"array",
"[",
"$",
"key",
"]",
")",
";",
"$",
"key",
"=",
"$",
"_this",
"->",
"doReplace",
"(",
"$",
"key",
",",
"$",
"data",
",",
"$",
"global",
")",
";",
"$",
"array",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"}",
")",
";",
"return",
"$",
"data",
";",
"}"
]
| 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",
"."
]
| 7621e0be7dbb2a015d68197d290fe8469f539a4d | https://github.com/kherge-abandoned/php-wise/blob/7621e0be7dbb2a015d68197d290fe8469f539a4d/src/lib/Herrera/Wise/Loader/AbstractFileLoader.php#L131-L195 |
19,020 | 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) && !$values->offsetExists($leaf))) {
throw InvalidReferenceException::format(
'The reference "%s" could not be resolved (failed at "%s").',
"%$reference%",
$leaf
);
}
$values = $values[$leaf];
}
return $values;
} | 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) && !$values->offsetExists($leaf))) {
throw InvalidReferenceException::format(
'The reference "%s" could not be resolved (failed at "%s").',
"%$reference%",
$leaf
);
}
$values = $values[$leaf];
}
return $values;
} | [
"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",
")",
"&&",
"!",
"$",
"values",
"->",
"offsetExists",
"(",
"$",
"leaf",
")",
")",
")",
"{",
"throw",
"InvalidReferenceException",
"::",
"format",
"(",
"'The reference \"%s\" could not be resolved (failed at \"%s\").'",
",",
"\"%$reference%\"",
",",
"$",
"leaf",
")",
";",
"}",
"$",
"values",
"=",
"$",
"values",
"[",
"$",
"leaf",
"]",
";",
"}",
"return",
"$",
"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",
"."
]
| 7621e0be7dbb2a015d68197d290fe8469f539a4d | https://github.com/kherge-abandoned/php-wise/blob/7621e0be7dbb2a015d68197d290fe8469f539a4d/src/lib/Herrera/Wise/Loader/AbstractFileLoader.php#L207-L224 |
19,021 | 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);
if ($composed && $obj) {
$obj = $obj->getObject($composed);
}
} else {
}
return $obj;
} | 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);
if ($composed && $obj) {
$obj = $obj->getObject($composed);
}
} else {
}
return $obj;
} | [
"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",
")",
";",
"if",
"(",
"$",
"composed",
"&&",
"$",
"obj",
")",
"{",
"$",
"obj",
"=",
"$",
"obj",
"->",
"getObject",
"(",
"$",
"composed",
")",
";",
"}",
"}",
"else",
"{",
"}",
"return",
"$",
"obj",
";",
"}"
]
| 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"
]
| 1c6da8c56ef717225ff904e1522aff94ed051601 | https://github.com/nyeholt/silverstripe-external-content/blob/1c6da8c56ef717225ff904e1522aff94ed051601/code/model/ExternalContent.php#L47-L66 |
19,022 | 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_FIRST);
$Regex = new \RegexIterator( $objects, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH);
foreach( $Regex as $name => $object){
if ( ! empty( $name)) {
require_once $name;
}
}
$classes = get_declared_classes();
$traits = get_declared_traits();
$interfaces = get_declared_interfaces();
$this->loadedClasses = array_merge( $classes, $traits, $interfaces);
} | 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_FIRST);
$Regex = new \RegexIterator( $objects, '/^.+\.php$/i', \RecursiveRegexIterator::GET_MATCH);
foreach( $Regex as $name => $object){
if ( ! empty( $name)) {
require_once $name;
}
}
$classes = get_declared_classes();
$traits = get_declared_traits();
$interfaces = get_declared_interfaces();
$this->loadedClasses = array_merge( $classes, $traits, $interfaces);
} | [
"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_FIRST",
")",
";",
"$",
"Regex",
"=",
"new",
"\\",
"RegexIterator",
"(",
"$",
"objects",
",",
"'/^.+\\.php$/i'",
",",
"\\",
"RecursiveRegexIterator",
"::",
"GET_MATCH",
")",
";",
"foreach",
"(",
"$",
"Regex",
"as",
"$",
"name",
"=>",
"$",
"object",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"require_once",
"$",
"name",
";",
"}",
"}",
"$",
"classes",
"=",
"get_declared_classes",
"(",
")",
";",
"$",
"traits",
"=",
"get_declared_traits",
"(",
")",
";",
"$",
"interfaces",
"=",
"get_declared_interfaces",
"(",
")",
";",
"$",
"this",
"->",
"loadedClasses",
"=",
"array_merge",
"(",
"$",
"classes",
",",
"$",
"traits",
",",
"$",
"interfaces",
")",
";",
"}"
]
| Load class in the source directory | [
"Load",
"class",
"in",
"the",
"source",
"directory"
]
| 326da10b837161591a32ab4f36f9b2f4feabbe65 | https://github.com/alphayax/phpdoc_md/blob/326da10b837161591a32ab4f36f9b2f4feabbe65/src/MdGen.php#L39-L56 |
19,023 | 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;
}
}
$this->loadedClasses = $FilteredClasses;
} | php | public function filterNamespace( $namespaceName) {
$FilteredClasses = [];
foreach( $this->loadedClasses as $loadedClass){
if( 0 == substr_compare( $loadedClass, $namespaceName, 0, strlen( $namespaceName))){
$FilteredClasses[] = $loadedClass;
}
}
$this->loadedClasses = $FilteredClasses;
} | [
"public",
"function",
"filterNamespace",
"(",
"$",
"namespaceName",
")",
"{",
"$",
"FilteredClasses",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"loadedClasses",
"as",
"$",
"loadedClass",
")",
"{",
"if",
"(",
"0",
"==",
"substr_compare",
"(",
"$",
"loadedClass",
",",
"$",
"namespaceName",
",",
"0",
",",
"strlen",
"(",
"$",
"namespaceName",
")",
")",
")",
"{",
"$",
"FilteredClasses",
"[",
"]",
"=",
"$",
"loadedClass",
";",
"}",
"}",
"$",
"this",
"->",
"loadedClasses",
"=",
"$",
"FilteredClasses",
";",
"}"
]
| Filter class who are in a specific namespace
@param $namespaceName | [
"Filter",
"class",
"who",
"are",
"in",
"a",
"specific",
"namespace"
]
| 326da10b837161591a32ab4f36f9b2f4feabbe65 | https://github.com/alphayax/phpdoc_md/blob/326da10b837161591a32ab4f36f9b2f4feabbe65/src/MdGen.php#L62-L70 |
19,024 | 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",
"(",
"$",
"loadedClass",
",",
"$",
"className",
")",
")",
"{",
"$",
"FilteredClasses",
"[",
"]",
"=",
"$",
"loadedClass",
";",
"}",
"}",
"$",
"this",
"->",
"loadedClasses",
"=",
"$",
"FilteredClasses",
";",
"}"
]
| Filter class who are sub-classes of a specific class
@param $className | [
"Filter",
"class",
"who",
"are",
"sub",
"-",
"classes",
"of",
"a",
"specific",
"class"
]
| 326da10b837161591a32ab4f36f9b2f4feabbe65 | https://github.com/alphayax/phpdoc_md/blob/326da10b837161591a32ab4f36f9b2f4feabbe65/src/MdGen.php#L76-L84 |
19,025 | 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",
"(",
"$",
"this",
"->",
"rootNamespace",
",",
"$",
"chapters",
")",
";",
"$",
"this",
"->",
"rootPage",
"->",
"setDirectory",
"(",
"$",
"directory",
")",
";",
"$",
"this",
"->",
"rootPage",
"->",
"write",
"(",
")",
";",
"}"
]
| Generate markdown files
@param string $directory | [
"Generate",
"markdown",
"files"
]
| 326da10b837161591a32ab4f36f9b2f4feabbe65 | https://github.com/alphayax/phpdoc_md/blob/326da10b837161591a32ab4f36f9b2f4feabbe65/src/MdGen.php#L102-L107 |
19,026 | 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 $form;
} | 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 $form;
} | [
"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",
"$",
"form",
";",
"}"
]
| 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",
"."
]
| 384cb6c793072a4f1047dc5cafc2157ee2419f60 | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/CenterController.php#L63-L73 |
19,027 | 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:Center:new.html.twig'",
",",
"array",
"(",
"'entity'",
"=>",
"$",
"center",
",",
"'form'",
"=>",
"$",
"form",
"->",
"createView",
"(",
")",
",",
")",
")",
";",
"}"
]
| Displays a form to create a new Center entity. | [
"Displays",
"a",
"form",
"to",
"create",
"a",
"new",
"Center",
"entity",
"."
]
| 384cb6c793072a4f1047dc5cafc2157ee2419f60 | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/CenterController.php#L79-L88 |
19,028 | 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' => 'Update'));
return $form;
} | 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' => 'Update'));
return $form;
} | [
"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'",
"=>",
"'Update'",
")",
")",
";",
"return",
"$",
"form",
";",
"}"
]
| 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",
"."
]
| 384cb6c793072a4f1047dc5cafc2157ee2419f60 | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/CenterController.php#L137-L147 |
19,029 | 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 = $this->createEditForm($center);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('admin_center_edit', array('id' => $id)));
}
return $this->render('ChillMainBundle:Center:edit.html.twig', array(
'entity' => $center,
'edit_form' => $editForm->createView()
));
} | 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 = $this->createEditForm($center);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
return $this->redirect($this->generateUrl('admin_center_edit', array('id' => $id)));
}
return $this->render('ChillMainBundle:Center:edit.html.twig', array(
'entity' => $center,
'edit_form' => $editForm->createView()
));
} | [
"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",
"=",
"$",
"this",
"->",
"createEditForm",
"(",
"$",
"center",
")",
";",
"$",
"editForm",
"->",
"handleRequest",
"(",
"$",
"request",
")",
";",
"if",
"(",
"$",
"editForm",
"->",
"isValid",
"(",
")",
")",
"{",
"$",
"em",
"->",
"flush",
"(",
")",
";",
"return",
"$",
"this",
"->",
"redirect",
"(",
"$",
"this",
"->",
"generateUrl",
"(",
"'admin_center_edit'",
",",
"array",
"(",
"'id'",
"=>",
"$",
"id",
")",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"render",
"(",
"'ChillMainBundle:Center:edit.html.twig'",
",",
"array",
"(",
"'entity'",
"=>",
"$",
"center",
",",
"'edit_form'",
"=>",
"$",
"editForm",
"->",
"createView",
"(",
")",
")",
")",
";",
"}"
]
| Edits an existing Center entity. | [
"Edits",
"an",
"existing",
"Center",
"entity",
"."
]
| 384cb6c793072a4f1047dc5cafc2157ee2419f60 | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Controller/CenterController.php#L152-L175 |
19,030 | 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($properties['__freezer']);
}
foreach ($properties as $name => $value) {
if (is_array($value)) {
$properties[$name] = '<array>';
} elseif (is_object($value)) {
if (!isset($value->{$this->idProperty})) {
$value->{$this->idProperty} = $this->generateId();
}
$properties[$name] = (string)$value->{$this->idProperty};
} elseif (is_resource($value)) {
$properties[$name] = null;
}
}
return sha1(get_class($object) . join(':', $properties));
} | 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($properties['__freezer']);
}
foreach ($properties as $name => $value) {
if (is_array($value)) {
$properties[$name] = '<array>';
} elseif (is_object($value)) {
if (!isset($value->{$this->idProperty})) {
$value->{$this->idProperty} = $this->generateId();
}
$properties[$name] = (string)$value->{$this->idProperty};
} elseif (is_resource($value)) {
$properties[$name] = null;
}
}
return sha1(get_class($object) . join(':', $properties));
} | [
"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",
"(",
"$",
"properties",
"[",
"'__freezer'",
"]",
")",
";",
"}",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"properties",
"[",
"$",
"name",
"]",
"=",
"'<array>'",
";",
"}",
"elseif",
"(",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"value",
"->",
"{",
"$",
"this",
"->",
"idProperty",
"}",
")",
")",
"{",
"$",
"value",
"->",
"{",
"$",
"this",
"->",
"idProperty",
"}",
"=",
"$",
"this",
"->",
"generateId",
"(",
")",
";",
"}",
"$",
"properties",
"[",
"$",
"name",
"]",
"=",
"(",
"string",
")",
"$",
"value",
"->",
"{",
"$",
"this",
"->",
"idProperty",
"}",
";",
"}",
"elseif",
"(",
"is_resource",
"(",
"$",
"value",
")",
")",
"{",
"$",
"properties",
"[",
"$",
"name",
"]",
"=",
"null",
";",
"}",
"}",
"return",
"sha1",
"(",
"get_class",
"(",
"$",
"object",
")",
".",
"join",
"(",
"':'",
",",
"$",
"properties",
")",
")",
";",
"}"
]
| 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",
"."
]
| f5955fb5476fa8ac456e27c0edafaae331d02cd3 | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Freezer.php#L301-L329 |
19,031 | 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",
")",
";",
"// 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",
")",
")",
";",
"}"
]
| 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",
"."
]
| f5955fb5476fa8ac456e27c0edafaae331d02cd3 | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Freezer.php#L338-L345 |
19,032 | 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->getProperties() as $property) {
$property->setAccessible(true);
$result[$property->getName()] = $property->getValue($object);
}
return $result;
} | 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->getProperties() as $property) {
$property->setAccessible(true);
$result[$property->getName()] = $property->getValue($object);
}
return $result;
} | [
"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",
"->",
"getProperties",
"(",
")",
"as",
"$",
"property",
")",
"{",
"$",
"property",
"->",
"setAccessible",
"(",
"true",
")",
";",
"$",
"result",
"[",
"$",
"property",
"->",
"getName",
"(",
")",
"]",
"=",
"$",
"property",
"->",
"getValue",
"(",
"$",
"object",
")",
";",
"}",
"return",
"$",
"result",
";",
"}"
]
| 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",
"."
]
| f5955fb5476fa8ac456e27c0edafaae331d02cd3 | https://github.com/shinjin/freezer/blob/f5955fb5476fa8ac456e27c0edafaae331d02cd3/src/Freezer.php#L395-L411 |
19,033 | 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[$methodName];
$serializedArgs = serialize($args);
if ( ! isset($mockResponse[$methodName][$serializedArgs]))
{
if ( ! isset($mockResponse[$methodName])) {
break;
}
// try to finding matching Hamcrest-API Function (anything(), equalTo())
$serializedArgs = static::checkMatchingArguments($mockResponse[$methodName], $args);
if (is_null($serializedArgs)) {
break;
}
}
$mockResponse = $mockResponse[$methodName][$serializedArgs];
}
return isset($mockResponse['response']['counter']) ? $mockResponse['response']['counter'] : 0;
} | php | private function getChainedMockCounter($methods)
{
$mockReturnValues = ShortifyPunit::getReturnValues();
$mockResponse = $mockReturnValues[$this->mockedClass][$this->instanceId];
foreach ($methods as $method)
{
$methodName = key($method);
$args = $method[$methodName];
$serializedArgs = serialize($args);
if ( ! isset($mockResponse[$methodName][$serializedArgs]))
{
if ( ! isset($mockResponse[$methodName])) {
break;
}
// try to finding matching Hamcrest-API Function (anything(), equalTo())
$serializedArgs = static::checkMatchingArguments($mockResponse[$methodName], $args);
if (is_null($serializedArgs)) {
break;
}
}
$mockResponse = $mockResponse[$methodName][$serializedArgs];
}
return isset($mockResponse['response']['counter']) ? $mockResponse['response']['counter'] : 0;
} | [
"private",
"function",
"getChainedMockCounter",
"(",
"$",
"methods",
")",
"{",
"$",
"mockReturnValues",
"=",
"ShortifyPunit",
"::",
"getReturnValues",
"(",
")",
";",
"$",
"mockResponse",
"=",
"$",
"mockReturnValues",
"[",
"$",
"this",
"->",
"mockedClass",
"]",
"[",
"$",
"this",
"->",
"instanceId",
"]",
";",
"foreach",
"(",
"$",
"methods",
"as",
"$",
"method",
")",
"{",
"$",
"methodName",
"=",
"key",
"(",
"$",
"method",
")",
";",
"$",
"args",
"=",
"$",
"method",
"[",
"$",
"methodName",
"]",
";",
"$",
"serializedArgs",
"=",
"serialize",
"(",
"$",
"args",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"mockResponse",
"[",
"$",
"methodName",
"]",
"[",
"$",
"serializedArgs",
"]",
")",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"mockResponse",
"[",
"$",
"methodName",
"]",
")",
")",
"{",
"break",
";",
"}",
"// try to finding matching Hamcrest-API Function (anything(), equalTo())",
"$",
"serializedArgs",
"=",
"static",
"::",
"checkMatchingArguments",
"(",
"$",
"mockResponse",
"[",
"$",
"methodName",
"]",
",",
"$",
"args",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"serializedArgs",
")",
")",
"{",
"break",
";",
"}",
"}",
"$",
"mockResponse",
"=",
"$",
"mockResponse",
"[",
"$",
"methodName",
"]",
"[",
"$",
"serializedArgs",
"]",
";",
"}",
"return",
"isset",
"(",
"$",
"mockResponse",
"[",
"'response'",
"]",
"[",
"'counter'",
"]",
")",
"?",
"$",
"mockResponse",
"[",
"'response'",
"]",
"[",
"'counter'",
"]",
":",
"0",
";",
"}"
]
| Getting the call counter for the specific chained
stubbing methods
@param $methods
@return int | [
"Getting",
"the",
"call",
"counter",
"for",
"the",
"specific",
"chained",
"stubbing",
"methods"
]
| cedd08f31de8e7409a07d2630701ef4e924cc5f0 | https://github.com/danrevah/shortify-punit/blob/cedd08f31de8e7409a07d2630701ef4e924cc5f0/src/Verify/Verify.php#L121-L151 |
19,034 | 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",
"\\",
"RuntimeException",
"(",
"\"Layout file `$template` does not exist.\"",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"layout",
"=",
"$",
"template",
";",
"}",
"}"
]
| Layout Configuration Getters and Setters | [
"Layout",
"Configuration",
"Getters",
"and",
"Setters"
]
| 60939b9f7502b90bf319fe741a747dd40ef61bfe | https://github.com/tylerjuniorcollege/slim-layout/blob/60939b9f7502b90bf319fe741a747dd40ef61bfe/src/Layout.php#L40-L47 |
19,035 | 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",
"(",
"$",
"status",
")",
";",
"$",
"app",
"->",
"response",
"(",
")",
"->",
"header",
"(",
"'Content-Type'",
",",
"'application/json'",
")",
";",
"$",
"body",
"=",
"json_encode",
"(",
"$",
"data",
")",
";",
"$",
"app",
"->",
"response",
"(",
")",
"->",
"body",
"(",
"$",
"body",
")",
";",
"$",
"app",
"->",
"stop",
"(",
")",
";",
"}"
]
| 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",
"."
]
| 60939b9f7502b90bf319fe741a747dd40ef61bfe | https://github.com/tylerjuniorcollege/slim-layout/blob/60939b9f7502b90bf319fe741a747dd40ef61bfe/src/Layout.php#L183-L192 |
19,036 | 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",
")",
"$",
"data",
")",
")",
";",
"}"
]
| Function for rendering partial content. This WILL inject the layout parameters. | [
"Function",
"for",
"rendering",
"partial",
"content",
".",
"This",
"WILL",
"inject",
"the",
"layout",
"parameters",
"."
]
| 60939b9f7502b90bf319fe741a747dd40ef61bfe | https://github.com/tylerjuniorcollege/slim-layout/blob/60939b9f7502b90bf319fe741a747dd40ef61bfe/src/Layout.php#L195-L197 |
19,037 | 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",
"->",
"params",
"=",
"$",
"params",
";",
"return",
"$",
"route",
";",
"}"
]
| static route factory
@param callback $callback
@param array $params
@return CCRoute | [
"static",
"route",
"factory"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCRoute.php#L22-L27 |
19,038 | 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",
")",
"?",
"$",
"queryDelimeter",
":",
"'&'",
";",
"return",
"$",
"uri",
".",
"http_build_query",
"(",
"$",
"params",
")",
";",
"}"
]
| 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"
]
| 54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a | https://github.com/redaigbaria/oauth2/blob/54cca4aaaff6a095cbf1c8010f2fe2cc7de4e45a/src/Util/RedirectUri.php#L28-L33 |
19,039 | 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(),
static::$additionalOperatingSystems, // NEW
static::getBrowsers(),
static::$additionalBrowsers, // NEW
static::getUtilities()
);
}
return $rules;
} | php | public function getDetectionRulesExtended()
{
static $rules;
if ( ! $rules) {
$rules = $this->mergeRules(
static::$additionalDevices, // NEW
static::getPhoneDevices(),
static::getTabletDevices(),
static::getOperatingSystems(),
static::$additionalOperatingSystems, // NEW
static::getBrowsers(),
static::$additionalBrowsers, // NEW
static::getUtilities()
);
}
return $rules;
} | [
"public",
"function",
"getDetectionRulesExtended",
"(",
")",
"{",
"static",
"$",
"rules",
";",
"if",
"(",
"!",
"$",
"rules",
")",
"{",
"$",
"rules",
"=",
"$",
"this",
"->",
"mergeRules",
"(",
"static",
"::",
"$",
"additionalDevices",
",",
"// NEW",
"static",
"::",
"getPhoneDevices",
"(",
")",
",",
"static",
"::",
"getTabletDevices",
"(",
")",
",",
"static",
"::",
"getOperatingSystems",
"(",
")",
",",
"static",
"::",
"$",
"additionalOperatingSystems",
",",
"// NEW",
"static",
"::",
"getBrowsers",
"(",
")",
",",
"static",
"::",
"$",
"additionalBrowsers",
",",
"// NEW",
"static",
"::",
"getUtilities",
"(",
")",
")",
";",
"}",
"return",
"$",
"rules",
";",
"}"
]
| 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",
"."
]
| 74a3aff7830463d3cc31afdaf6ec89f2e5bf3468 | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L121-L139 |
19,040 | 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",
")",
";",
"return",
"$",
"this",
"->",
"findDetectionRulesAgainstUA",
"(",
"$",
"rules",
",",
"$",
"userAgent",
")",
";",
"}"
]
| Get the browser name.
@param string|null $userAgent
@return string | [
"Get",
"the",
"browser",
"name",
"."
]
| 74a3aff7830463d3cc31afdaf6ec89f2e5bf3468 | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L180-L189 |
19,041 | 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",
"// NEW",
")",
";",
"return",
"$",
"this",
"->",
"findDetectionRulesAgainstUA",
"(",
"$",
"rules",
",",
"$",
"userAgent",
")",
";",
"}"
]
| Get the platform name.
@param string|null $userAgent
@return string | [
"Get",
"the",
"platform",
"name",
"."
]
| 74a3aff7830463d3cc31afdaf6ec89f2e5bf3468 | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L212-L221 |
19,042 | 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]))
$merged[$key][] = $value;
else
$merged[$key] .= '|' . $value;
}
}
return $merged;
} | 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]))
$merged[$key][] = $value;
else
$merged[$key] .= '|' . $value;
}
}
return $merged;
} | [
"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",
"]",
")",
")",
"$",
"merged",
"[",
"$",
"key",
"]",
"[",
"]",
"=",
"$",
"value",
";",
"else",
"$",
"merged",
"[",
"$",
"key",
"]",
".=",
"'|'",
".",
"$",
"value",
";",
"}",
"}",
"return",
"$",
"merged",
";",
"}"
]
| Merge multiple rules into one array.
@param array $rulesGroups
@return array | [
"Merge",
"multiple",
"rules",
"into",
"one",
"array",
"."
]
| 74a3aff7830463d3cc31afdaf6ec89f2e5bf3468 | https://github.com/ARCANEDEV/Agent/blob/74a3aff7830463d3cc31afdaf6ec89f2e5bf3468/src/Agent.php#L359-L375 |
19,043 | 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->execute('POST', '/maniahome/event/public/', array($e));
} | 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->execute('POST', '/maniahome/event/public/', array($e));
} | [
"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",
"->",
"execute",
"(",
"'POST'",
",",
"'/maniahome/event/public/'",
",",
"array",
"(",
"$",
"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 date of the event
@param string $link Link when the player clicks on the notification
@return int | [
"Create",
"an",
"event",
"visible",
"by",
"all",
"players",
"who",
"bookmarked",
"your",
"Manialink"
]
| 027a458388035fe66f2f56ff3ea1f85eff2a5a4e | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/ManiaHome/ManialinkPublisher.php#L161-L171 |
19,044 | 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",
"."
]
| 274a154de4299e8a57314bab972e09f6d8cdae9e | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/Http/Requests/Request.php#L23-L29 |
19,045 | 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 ), $params );
} | 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 ), $params );
} | [
"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",
")",
",",
"$",
"params",
")",
";",
"}"
]
| runs a forge command on a dummy forge
@param string $cmd
@param array $params
@return string | [
"runs",
"a",
"forge",
"command",
"on",
"a",
"dummy",
"forge"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCForge/Php.php#L33-L48 |
19,046 | 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\"",
",",
"\"\\n\"",
".",
"' * '",
",",
"$",
"str",
")",
";",
"$",
"str",
"=",
"str_replace",
"(",
"\"\\n\"",
".",
"' * *'",
",",
"\"\\n\"",
".",
"' **'",
",",
"$",
"str",
")",
";",
"return",
"$",
"this",
"->",
"add",
"(",
"\"/**\\n * \"",
".",
"$",
"str",
".",
"\"\\n */\"",
")",
";",
"}"
]
| generates an PHP comment
@param string $str
@param int $wordwrap
@return string | [
"generates",
"an",
"PHP",
"comment"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCForge/Php.php#L124-L130 |
19,047 | 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",
"(",
"$",
"comment",
")",
")",
".",
"\"\\n\"",
":",
"''",
")",
".",
"$",
"name",
".",
"\"\\n{\\n\"",
".",
"str_replace",
"(",
"\"\\n\"",
",",
"\"\\n\\t\"",
",",
"\"\\t\"",
".",
"CCStr",
"::",
"capture",
"(",
"$",
"content",
")",
")",
".",
"\"\\n}\"",
")",
";",
"}"
]
| generates an closure
@param string $str
@param int $wordwrap
@return string | [
"generates",
"an",
"closure"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCForge/Php.php#L139-L143 |
19,048 | 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 \"",
".",
"$",
"name",
".",
"(",
"$",
"extends",
"?",
"' extends '",
".",
"$",
"extends",
":",
"''",
")",
".",
"(",
"$",
"implements",
"?",
"' implements '",
".",
"$",
"implements",
":",
"''",
")",
",",
"$",
"content",
")",
")",
";",
"}"
]
| generates an PHP class
@param string $str
@param int $wordwrap
@return string | [
"generates",
"an",
"PHP",
"class"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCForge/Php.php#L152-L157 |
19,049 | 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 ? ' = '. $default : '' ).';' );
} | 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 ? ' = '. $default : '' ).';' );
} | [
"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",
"?",
"' = '",
".",
"$",
"default",
":",
"''",
")",
".",
"';'",
")",
";",
"}"
]
| generates a class property
@param string $str
@param int $wordwrap
@return string | [
"generates",
"a",
"class",
"property"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCForge/Php.php#L166-L178 |
19,050 | 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\"",
",",
"$",
"total",
")",
";",
"return",
"$",
"this",
"->",
"setArgument",
"(",
"\"autorecharge_when_credit\"",
",",
"$",
"whenCredit",
")",
";",
"}"
]
| 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",
"."
]
| dbe04ef043db5b251953f9de57aa4d0f1785dfcc | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Settings.php#L72-L77 |
19,051 | 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\"",
",",
"$",
"key",
")",
";",
"$",
"this",
"->",
"setArgument",
"(",
"\"sns_access_secret\"",
",",
"$",
"secret",
")",
";",
"return",
"$",
"this",
"->",
"setArgument",
"(",
"\"sns_topic\"",
",",
"$",
"topicArn",
")",
";",
"}"
]
| 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",
"."
]
| dbe04ef043db5b251953f9de57aa4d0f1785dfcc | https://github.com/PortaText/php-sdk/blob/dbe04ef043db5b251953f9de57aa4d0f1785dfcc/src/PortaText/Command/Api/Settings.php#L225-L231 |
19,052 | 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($function, $args, $v);
}, $value);
}
}
} | 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($function, $args, $v);
}, $value);
}
}
} | [
"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",
"(",
"$",
"function",
",",
"$",
"args",
",",
"$",
"v",
")",
";",
"}",
",",
"$",
"value",
")",
";",
"}",
"}",
"}"
]
| 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"
]
| eaece87d474f7da5c25679548fb8f1608a94303c | https://github.com/jenwachter/html-form/blob/eaece87d474f7da5c25679548fb8f1608a94303c/src/Utility/Sanitizer.php#L28-L41 |
19,053 | 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), [$this, $event, $url, $response]);
}
} | 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), [$this, $event, $url, $response]);
}
} | [
"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",
")",
",",
"[",
"$",
"this",
",",
"$",
"event",
",",
"$",
"url",
",",
"$",
"response",
"]",
")",
";",
"}",
"}"
]
| 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",
"."
]
| f9cba7aa0043a10e5c35bd45fbad158688a09a96 | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/AppController.php#L123-L129 |
19,054 | 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",
"(",
"0",
")",
")",
"&&",
"Plugin",
"::",
"hasManifestEvent",
"(",
"'Controller.afterFilter'",
")",
")",
"{",
"call_user_func_array",
"(",
"$",
"pluginEvent",
"->",
"find",
"(",
"0",
")",
",",
"[",
"$",
"this",
",",
"$",
"event",
"]",
")",
";",
"}",
"}"
]
| 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",
"."
]
| f9cba7aa0043a10e5c35bd45fbad158688a09a96 | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/AppController.php#L139-L145 |
19,055 | 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",
"(",
"$",
"theme",
")",
";",
"}",
"}"
]
| Setup application theme.
@return void | [
"Setup",
"application",
"theme",
"."
]
| f9cba7aa0043a10e5c35bd45fbad158688a09a96 | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/Controller/AppController.php#L152-L158 |
19,056 | 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,
'expanded' => false
));
$builder->add('position', 'choice', array(
'choices' => array(
'row' => 'r',
'column' => 'c'
),
'choices_as_values' => true,
'multiple' => false,
'expanded' => false
));
} | php | private function appendAggregatorForm(FormBuilderInterface $builder, $nbAggregators)
{
$builder->add('order', 'choice', array(
'choices' => array_combine(
range(1, $nbAggregators),
range(1, $nbAggregators)
),
'multiple' => false,
'expanded' => false
));
$builder->add('position', 'choice', array(
'choices' => array(
'row' => 'r',
'column' => 'c'
),
'choices_as_values' => true,
'multiple' => false,
'expanded' => false
));
} | [
"private",
"function",
"appendAggregatorForm",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"$",
"nbAggregators",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'order'",
",",
"'choice'",
",",
"array",
"(",
"'choices'",
"=>",
"array_combine",
"(",
"range",
"(",
"1",
",",
"$",
"nbAggregators",
")",
",",
"range",
"(",
"1",
",",
"$",
"nbAggregators",
")",
")",
",",
"'multiple'",
"=>",
"false",
",",
"'expanded'",
"=>",
"false",
")",
")",
";",
"$",
"builder",
"->",
"add",
"(",
"'position'",
",",
"'choice'",
",",
"array",
"(",
"'choices'",
"=>",
"array",
"(",
"'row'",
"=>",
"'r'",
",",
"'column'",
"=>",
"'c'",
")",
",",
"'choices_as_values'",
"=>",
"true",
",",
"'multiple'",
"=>",
"false",
",",
"'expanded'",
"=>",
"false",
")",
")",
";",
"}"
]
| 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",
"."
]
| 384cb6c793072a4f1047dc5cafc2157ee2419f60 | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVFormatter.php#L114-L134 |
19,057 | 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",
")",
"{",
"return",
"(",
"$",
"a",
"[",
"'order'",
"]",
"<=",
"$",
"b",
"[",
"'order'",
"]",
"?",
"-",
"1",
":",
"1",
")",
";",
"}",
")",
";",
"}"
]
| 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",
"."
]
| 384cb6c793072a4f1047dc5cafc2157ee2419f60 | https://github.com/Chill-project/Main/blob/384cb6c793072a4f1047dc5cafc2157ee2419f60/Export/Formatter/CSVFormatter.php#L182-L189 |
19,058 | 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",
"(",
"sprintf",
"(",
"'+%s seconds'",
",",
"$",
"this",
"->",
"lifetime",
")",
")",
";",
"}",
"$",
"this",
"->",
"status",
"=",
"self",
"::",
"STATUS_SHOWN",
";",
"}"
]
| Notice shown. | [
"Notice",
"shown",
"."
]
| ca3b342081719d41ba018792a75970cbb1f1fe22 | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Entity/Notice.php#L126-L133 |
19,059 | 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",
"->",
"getDefaultNotificationFactory",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"notificationFactory",
";",
"}"
]
| 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"
]
| 8b81a2d6658f3f8cb62b6be2c34773aaa2df219a | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Notifications/NotificationFactoryTrait.php#L53-L59 |
19,060 | 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",
"->",
"objectConfig",
"[",
"$",
"key",
"]",
";",
"}",
"return",
"$",
"default",
";",
"}"
]
| Get a value from the config.
@param string $key
@param mixed $default
@return mixed | [
"Get",
"a",
"value",
"from",
"the",
"config",
"."
]
| 465baf32faaf155b867dcc11218621e23ef4cac2 | https://github.com/hisorange/traits/blob/465baf32faaf155b867dcc11218621e23ef4cac2/src/ObjectConfig.php#L43-L51 |
19,061 | 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",
",",
"'type'",
"=>",
"$",
"type",
")",
")",
";",
"State",
"::",
"set",
"(",
"'notifications'",
",",
"$",
"nots",
")",
";",
"}"
]
| 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",
"."
]
| fe8283e2d6847ef697abec832da7ee741a85058c | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Options/Notifier.php#L23-L28 |
19,062 | askupasoftware/amarkal | Extensions/WordPress/Plugin/AbstractPlugin.php | AbstractPlugin.register_hooks | private function register_hooks()
{
register_activation_hook(
$this->plugin_file,
get_called_class().'::activate'
);
register_deactivation_hook(
$this->plugin_file,
get_called_class().'::deactivate'
);
register_uninstall_hook(
$this->plugin_file,
get_called_class().'::uninstall'
);
} | php | private function register_hooks()
{
register_activation_hook(
$this->plugin_file,
get_called_class().'::activate'
);
register_deactivation_hook(
$this->plugin_file,
get_called_class().'::deactivate'
);
register_uninstall_hook(
$this->plugin_file,
get_called_class().'::uninstall'
);
} | [
"private",
"function",
"register_hooks",
"(",
")",
"{",
"register_activation_hook",
"(",
"$",
"this",
"->",
"plugin_file",
",",
"get_called_class",
"(",
")",
".",
"'::activate'",
")",
";",
"register_deactivation_hook",
"(",
"$",
"this",
"->",
"plugin_file",
",",
"get_called_class",
"(",
")",
".",
"'::deactivate'",
")",
";",
"register_uninstall_hook",
"(",
"$",
"this",
"->",
"plugin_file",
",",
"get_called_class",
"(",
")",
".",
"'::uninstall'",
")",
";",
"}"
]
| Register hooks that are fired when the plugin is activated,
deactivated, and uninstalled, respectively. The array's first
argument is the name of the plugin defined in `class-plugin-name.php` | [
"Register",
"hooks",
"that",
"are",
"fired",
"when",
"the",
"plugin",
"is",
"activated",
"deactivated",
"and",
"uninstalled",
"respectively",
".",
"The",
"array",
"s",
"first",
"argument",
"is",
"the",
"name",
"of",
"the",
"plugin",
"defined",
"in",
"class",
"-",
"plugin",
"-",
"name",
".",
"php"
]
| fe8283e2d6847ef697abec832da7ee741a85058c | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Extensions/WordPress/Plugin/AbstractPlugin.php#L33-L49 |
19,063 | yuncms/framework | src/behaviors/UUIDBehavior.php | UUIDBehavior.validateUUID | protected function validateUUID($uuid)
{
/* @var $validator UniqueValidator */
/* @var $model BaseActiveRecord */
$validator = Yii::createObject(array_merge([
'class' => UniqueValidator::class,
], $this->uniqueValidator));
$model = clone $this->owner;
$model->clearErrors();
$model->{$this->attribute} = $uuid;
$validator->validateAttribute($model, $this->attribute);
return !$model->hasErrors();
} | php | protected function validateUUID($uuid)
{
/* @var $validator UniqueValidator */
/* @var $model BaseActiveRecord */
$validator = Yii::createObject(array_merge([
'class' => UniqueValidator::class,
], $this->uniqueValidator));
$model = clone $this->owner;
$model->clearErrors();
$model->{$this->attribute} = $uuid;
$validator->validateAttribute($model, $this->attribute);
return !$model->hasErrors();
} | [
"protected",
"function",
"validateUUID",
"(",
"$",
"uuid",
")",
"{",
"/* @var $validator UniqueValidator */",
"/* @var $model BaseActiveRecord */",
"$",
"validator",
"=",
"Yii",
"::",
"createObject",
"(",
"array_merge",
"(",
"[",
"'class'",
"=>",
"UniqueValidator",
"::",
"class",
",",
"]",
",",
"$",
"this",
"->",
"uniqueValidator",
")",
")",
";",
"$",
"model",
"=",
"clone",
"$",
"this",
"->",
"owner",
";",
"$",
"model",
"->",
"clearErrors",
"(",
")",
";",
"$",
"model",
"->",
"{",
"$",
"this",
"->",
"attribute",
"}",
"=",
"$",
"uuid",
";",
"$",
"validator",
"->",
"validateAttribute",
"(",
"$",
"model",
",",
"$",
"this",
"->",
"attribute",
")",
";",
"return",
"!",
"$",
"model",
"->",
"hasErrors",
"(",
")",
";",
"}"
]
| Checks if given uuid value is unique.
@param string $uuid slug value
@return bool whether slug is unique.
@throws InvalidConfigException | [
"Checks",
"if",
"given",
"uuid",
"value",
"is",
"unique",
"."
]
| af42e28ea4ae15ab8eead3f6d119f93863b94154 | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/behaviors/UUIDBehavior.php#L141-L155 |
19,064 | parsnick/steak | src/Source.php | Source.changeExtension | public function changeExtension($rename)
{
$search = '';
$replace = '';
if (is_array($rename)) {
$search = key($rename);
$replace = current($rename);
}
if (is_string($rename)) {
$search = pathinfo($this->outputPathname, PATHINFO_EXTENSION);
$replace = $rename;
}
$this->outputPathname = preg_replace("#$search\$#", $replace, $this->outputPathname);
return $this;
} | php | public function changeExtension($rename)
{
$search = '';
$replace = '';
if (is_array($rename)) {
$search = key($rename);
$replace = current($rename);
}
if (is_string($rename)) {
$search = pathinfo($this->outputPathname, PATHINFO_EXTENSION);
$replace = $rename;
}
$this->outputPathname = preg_replace("#$search\$#", $replace, $this->outputPathname);
return $this;
} | [
"public",
"function",
"changeExtension",
"(",
"$",
"rename",
")",
"{",
"$",
"search",
"=",
"''",
";",
"$",
"replace",
"=",
"''",
";",
"if",
"(",
"is_array",
"(",
"$",
"rename",
")",
")",
"{",
"$",
"search",
"=",
"key",
"(",
"$",
"rename",
")",
";",
"$",
"replace",
"=",
"current",
"(",
"$",
"rename",
")",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"rename",
")",
")",
"{",
"$",
"search",
"=",
"pathinfo",
"(",
"$",
"this",
"->",
"outputPathname",
",",
"PATHINFO_EXTENSION",
")",
";",
"$",
"replace",
"=",
"$",
"rename",
";",
"}",
"$",
"this",
"->",
"outputPathname",
"=",
"preg_replace",
"(",
"\"#$search\\$#\"",
",",
"$",
"replace",
",",
"$",
"this",
"->",
"outputPathname",
")",
";",
"return",
"$",
"this",
";",
"}"
]
| Change the extension of the output pathname.
@param array|string|null $rename
@return $this | [
"Change",
"the",
"extension",
"of",
"the",
"output",
"pathname",
"."
]
| 461869189a640938438187330f6c50aca97c5ccc | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Source.php#L33-L51 |
19,065 | aedart/laravel-helpers | src/Traits/Auth/PasswordBrokerManagerTrait.php | PasswordBrokerManagerTrait.getPasswordBrokerManager | public function getPasswordBrokerManager(): ?PasswordBrokerManager
{
if (!$this->hasPasswordBrokerManager()) {
$this->setPasswordBrokerManager($this->getDefaultPasswordBrokerManager());
}
return $this->passwordBrokerManager;
} | php | public function getPasswordBrokerManager(): ?PasswordBrokerManager
{
if (!$this->hasPasswordBrokerManager()) {
$this->setPasswordBrokerManager($this->getDefaultPasswordBrokerManager());
}
return $this->passwordBrokerManager;
} | [
"public",
"function",
"getPasswordBrokerManager",
"(",
")",
":",
"?",
"PasswordBrokerManager",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasPasswordBrokerManager",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setPasswordBrokerManager",
"(",
"$",
"this",
"->",
"getDefaultPasswordBrokerManager",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"passwordBrokerManager",
";",
"}"
]
| Get password broker manager
If no password broker manager has been set, this method will
set and return a default password broker manager, if any such
value is available
@see getDefaultPasswordBrokerManager()
@return PasswordBrokerManager|null password broker manager or null if none password broker manager has been set | [
"Get",
"password",
"broker",
"manager"
]
| 8b81a2d6658f3f8cb62b6be2c34773aaa2df219a | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Auth/PasswordBrokerManagerTrait.php#L53-L59 |
19,066 | tylerjuniorcollege/slim-layout | src/Asset/Container.php | Container.insertAsset | public function insertAsset(AssetAbstract $asset, $location) {
array_splice($this->assets, $location, 0, array($asset));
return $this;
} | php | public function insertAsset(AssetAbstract $asset, $location) {
array_splice($this->assets, $location, 0, array($asset));
return $this;
} | [
"public",
"function",
"insertAsset",
"(",
"AssetAbstract",
"$",
"asset",
",",
"$",
"location",
")",
"{",
"array_splice",
"(",
"$",
"this",
"->",
"assets",
",",
"$",
"location",
",",
"0",
",",
"array",
"(",
"$",
"asset",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
]
| This will insert an asset in to a specific location in the array and then shift the element keys. | [
"This",
"will",
"insert",
"an",
"asset",
"in",
"to",
"a",
"specific",
"location",
"in",
"the",
"array",
"and",
"then",
"shift",
"the",
"element",
"keys",
"."
]
| 60939b9f7502b90bf319fe741a747dd40ef61bfe | https://github.com/tylerjuniorcollege/slim-layout/blob/60939b9f7502b90bf319fe741a747dd40ef61bfe/src/Asset/Container.php#L30-L33 |
19,067 | webforge-labs/psc-cms | lib/Psc/PHPExcel/RangeReadFilter.php | RangeReadFilter.readCell | public function readCell($column, $row, $worksheetName = '') {
return ($row >= $this->firstRow && $row <= $this->lastRow &&
array_key_exists($column, $this->range));
} | php | public function readCell($column, $row, $worksheetName = '') {
return ($row >= $this->firstRow && $row <= $this->lastRow &&
array_key_exists($column, $this->range));
} | [
"public",
"function",
"readCell",
"(",
"$",
"column",
",",
"$",
"row",
",",
"$",
"worksheetName",
"=",
"''",
")",
"{",
"return",
"(",
"$",
"row",
">=",
"$",
"this",
"->",
"firstRow",
"&&",
"$",
"row",
"<=",
"$",
"this",
"->",
"lastRow",
"&&",
"array_key_exists",
"(",
"$",
"column",
",",
"$",
"this",
"->",
"range",
")",
")",
";",
"}"
]
| Should this cell be read?
@param $column String column index
@param $row Row index
@param $worksheetName Optional worksheet name
@return boolean | [
"Should",
"this",
"cell",
"be",
"read?"
]
| 467bfa2547e6b4fa487d2d7f35fa6cc618dbc763 | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/PHPExcel/RangeReadFilter.php#L51-L55 |
19,068 | forxer/tao | src/Tao/Templating/Helpers/FormElements.php | FormElements.select | public function select($mNameId, $aData, $mDefault = null, $sClass = null, $iTabindex = null, $bDisabled = false, $bMultiple = false, $sExtraHtml = null)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<select name="' . $sName . '"';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= null === $sClass ? '' : ' class="' . $sClass . '"';
$res .= null === $iTabindex ? '' : ' tabindex="' . $iTabindex . '"';
$res .= $bDisabled ? ' disabled="disabled"' : '';
$res .= $bMultiple ? ' multiple="multiple"' : '';
$res .= $sExtraHtml;
$res .= '>' . PHP_EOL;
$res .= self::selectOptions($aData, $mDefault);
$res .= '</select>' . PHP_EOL;
return $res;
} | php | public function select($mNameId, $aData, $mDefault = null, $sClass = null, $iTabindex = null, $bDisabled = false, $bMultiple = false, $sExtraHtml = null)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<select name="' . $sName . '"';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= null === $sClass ? '' : ' class="' . $sClass . '"';
$res .= null === $iTabindex ? '' : ' tabindex="' . $iTabindex . '"';
$res .= $bDisabled ? ' disabled="disabled"' : '';
$res .= $bMultiple ? ' multiple="multiple"' : '';
$res .= $sExtraHtml;
$res .= '>' . PHP_EOL;
$res .= self::selectOptions($aData, $mDefault);
$res .= '</select>' . PHP_EOL;
return $res;
} | [
"public",
"function",
"select",
"(",
"$",
"mNameId",
",",
"$",
"aData",
",",
"$",
"mDefault",
"=",
"null",
",",
"$",
"sClass",
"=",
"null",
",",
"$",
"iTabindex",
"=",
"null",
",",
"$",
"bDisabled",
"=",
"false",
",",
"$",
"bMultiple",
"=",
"false",
",",
"$",
"sExtraHtml",
"=",
"null",
")",
"{",
"self",
"::",
"getNameAndId",
"(",
"$",
"mNameId",
",",
"$",
"sName",
",",
"$",
"sId",
")",
";",
"$",
"res",
"=",
"'<select name=\"'",
".",
"$",
"sName",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sId",
"?",
"''",
":",
"' id=\"'",
".",
"$",
"sId",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sClass",
"?",
"''",
":",
"' class=\"'",
".",
"$",
"sClass",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"iTabindex",
"?",
"''",
":",
"' tabindex=\"'",
".",
"$",
"iTabindex",
".",
"'\"'",
";",
"$",
"res",
".=",
"$",
"bDisabled",
"?",
"' disabled=\"disabled\"'",
":",
"''",
";",
"$",
"res",
".=",
"$",
"bMultiple",
"?",
"' multiple=\"multiple\"'",
":",
"''",
";",
"$",
"res",
".=",
"$",
"sExtraHtml",
";",
"$",
"res",
".=",
"'>'",
".",
"PHP_EOL",
";",
"$",
"res",
".=",
"self",
"::",
"selectOptions",
"(",
"$",
"aData",
",",
"$",
"mDefault",
")",
";",
"$",
"res",
".=",
"'</select>'",
".",
"PHP_EOL",
";",
"return",
"$",
"res",
";",
"}"
]
| Retourne un champ de formulaire de type select.
@param mixed $mNameId Le nom et l'identifiant du champ
@param array $aData Le tableau contenant les lignes d'option du select
@param mixed $mDefault La valeur sélectionnée par défaut
@param string $sClass La classe CSS de l'élément
@param integer $iTabindex Le tabindex de l'élément
@param boolean $bDisabled Désactiver ou non le champ
@param boolean $bMultiple Choix multiple
@param string $sExtraHtml Du HTML en plus à mettre dans l'élément
@return string | [
"Retourne",
"un",
"champ",
"de",
"formulaire",
"de",
"type",
"select",
"."
]
| b5e9109c244a29a72403ae6a58633ab96a67c660 | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/FormElements.php#L21-L39 |
19,069 | forxer/tao | src/Tao/Templating/Helpers/FormElements.php | FormElements.checkbox | public function checkbox($mNameId, $value, $checked = '', $sClass = null, $iTabindex = null, $bDisabled = false, $sExtraHtml = null)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<input type="checkbox" name="' . $sName . '" value="' . $value . '"';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= $checked ? ' checked="checked"' : '';
$res .= null === $sClass ? '' : ' class="' . $sClass . '"';
$res .= null === $iTabindex ? '' : ' tabindex="' . $iTabindex . '"';
$res .= $bDisabled ? ' disabled="disabled"' : '';
$res .= $sExtraHtml;
$res .= '>' . PHP_EOL;
return $res;
} | php | public function checkbox($mNameId, $value, $checked = '', $sClass = null, $iTabindex = null, $bDisabled = false, $sExtraHtml = null)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<input type="checkbox" name="' . $sName . '" value="' . $value . '"';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= $checked ? ' checked="checked"' : '';
$res .= null === $sClass ? '' : ' class="' . $sClass . '"';
$res .= null === $iTabindex ? '' : ' tabindex="' . $iTabindex . '"';
$res .= $bDisabled ? ' disabled="disabled"' : '';
$res .= $sExtraHtml;
$res .= '>' . PHP_EOL;
return $res;
} | [
"public",
"function",
"checkbox",
"(",
"$",
"mNameId",
",",
"$",
"value",
",",
"$",
"checked",
"=",
"''",
",",
"$",
"sClass",
"=",
"null",
",",
"$",
"iTabindex",
"=",
"null",
",",
"$",
"bDisabled",
"=",
"false",
",",
"$",
"sExtraHtml",
"=",
"null",
")",
"{",
"self",
"::",
"getNameAndId",
"(",
"$",
"mNameId",
",",
"$",
"sName",
",",
"$",
"sId",
")",
";",
"$",
"res",
"=",
"'<input type=\"checkbox\" name=\"'",
".",
"$",
"sName",
".",
"'\" value=\"'",
".",
"$",
"value",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sId",
"?",
"''",
":",
"' id=\"'",
".",
"$",
"sId",
".",
"'\"'",
";",
"$",
"res",
".=",
"$",
"checked",
"?",
"' checked=\"checked\"'",
":",
"''",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sClass",
"?",
"''",
":",
"' class=\"'",
".",
"$",
"sClass",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"iTabindex",
"?",
"''",
":",
"' tabindex=\"'",
".",
"$",
"iTabindex",
".",
"'\"'",
";",
"$",
"res",
".=",
"$",
"bDisabled",
"?",
"' disabled=\"disabled\"'",
":",
"''",
";",
"$",
"res",
".=",
"$",
"sExtraHtml",
";",
"$",
"res",
".=",
"'>'",
".",
"PHP_EOL",
";",
"return",
"$",
"res",
";",
"}"
]
| Retourne un champ de formulaire de type checkbox.
@param mixed $mNameId Le nom et l'identifiant du champ
@param mixed $value La valeur de l'élément
@param boolean $checked L'état par défaut de l'élément
@param string $sClass La classe CSS de l'élément
@param integer $iTabindex Le tabindex de l'élément
@param boolean $bDisabled Désactiver ou non le champ
@param string $sExtraHtml Du HTML en plus à mettre dans l'élément
@return string | [
"Retourne",
"un",
"champ",
"de",
"formulaire",
"de",
"type",
"checkbox",
"."
]
| b5e9109c244a29a72403ae6a58633ab96a67c660 | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/FormElements.php#L118-L132 |
19,070 | forxer/tao | src/Tao/Templating/Helpers/FormElements.php | FormElements.text | public function text($mNameId, $size, $max = null, $sDefault = null, $sClass = null, $sPlaceholder = null, $iTabindex = null, $bDisabled = false, $sExtraHtml = null)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<input type="text" size="' . $size . '" name="' . $sName . '"';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= null === $max ? '' : ' maxlength="' . $max . '"';
$res .= null === $sDefault ? '' : ' value="' . $sDefault . '"';
$res .= null === $sClass ? '' : ' class="' . $sClass . '"';
$res .= null === $sPlaceholder ? '' : ' placeholder="' . $sPlaceholder . '"';
$res .= null === $iTabindex ? '' : ' tabindex="' . $iTabindex . '"';
$res .= $bDisabled ? ' disabled="disabled"' : '';
$res .= $sExtraHtml;
$res .= '>';
return $res;
} | php | public function text($mNameId, $size, $max = null, $sDefault = null, $sClass = null, $sPlaceholder = null, $iTabindex = null, $bDisabled = false, $sExtraHtml = null)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<input type="text" size="' . $size . '" name="' . $sName . '"';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= null === $max ? '' : ' maxlength="' . $max . '"';
$res .= null === $sDefault ? '' : ' value="' . $sDefault . '"';
$res .= null === $sClass ? '' : ' class="' . $sClass . '"';
$res .= null === $sPlaceholder ? '' : ' placeholder="' . $sPlaceholder . '"';
$res .= null === $iTabindex ? '' : ' tabindex="' . $iTabindex . '"';
$res .= $bDisabled ? ' disabled="disabled"' : '';
$res .= $sExtraHtml;
$res .= '>';
return $res;
} | [
"public",
"function",
"text",
"(",
"$",
"mNameId",
",",
"$",
"size",
",",
"$",
"max",
"=",
"null",
",",
"$",
"sDefault",
"=",
"null",
",",
"$",
"sClass",
"=",
"null",
",",
"$",
"sPlaceholder",
"=",
"null",
",",
"$",
"iTabindex",
"=",
"null",
",",
"$",
"bDisabled",
"=",
"false",
",",
"$",
"sExtraHtml",
"=",
"null",
")",
"{",
"self",
"::",
"getNameAndId",
"(",
"$",
"mNameId",
",",
"$",
"sName",
",",
"$",
"sId",
")",
";",
"$",
"res",
"=",
"'<input type=\"text\" size=\"'",
".",
"$",
"size",
".",
"'\" name=\"'",
".",
"$",
"sName",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sId",
"?",
"''",
":",
"' id=\"'",
".",
"$",
"sId",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"max",
"?",
"''",
":",
"' maxlength=\"'",
".",
"$",
"max",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sDefault",
"?",
"''",
":",
"' value=\"'",
".",
"$",
"sDefault",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sClass",
"?",
"''",
":",
"' class=\"'",
".",
"$",
"sClass",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sPlaceholder",
"?",
"''",
":",
"' placeholder=\"'",
".",
"$",
"sPlaceholder",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"iTabindex",
"?",
"''",
":",
"' tabindex=\"'",
".",
"$",
"iTabindex",
".",
"'\"'",
";",
"$",
"res",
".=",
"$",
"bDisabled",
"?",
"' disabled=\"disabled\"'",
":",
"''",
";",
"$",
"res",
".=",
"$",
"sExtraHtml",
";",
"$",
"res",
".=",
"'>'",
";",
"return",
"$",
"res",
";",
"}"
]
| Retourne un champ de formulaire de type text.
@param mixed $mNameId Le nom et l'identifiant du champ
@param integer $size La taille de l'élément en nombre de caractères
@param integer $max Le nombre maximum de caractères
@param string $sDefault La valeur par défaut de lélément
@param string $sClass La classe CSS de l'élément
@param string $sPlaceholder
@param integer $iTabindex Le tabindex de l'élément
@param boolean $bDisabled Désactiver ou non le champ
@param string $sExtraHtml Du HTML en plus à mettre dans l'élément
@return string | [
"Retourne",
"un",
"champ",
"de",
"formulaire",
"de",
"type",
"text",
"."
]
| b5e9109c244a29a72403ae6a58633ab96a67c660 | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/FormElements.php#L148-L164 |
19,071 | forxer/tao | src/Tao/Templating/Helpers/FormElements.php | FormElements.file | public function file($mNameId, $sDefault = null, $sClass = null, $iTabindex = null, $bDisabled = false, $sExtraHtml = null)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<input type="file" name="' . $sName . '"';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= null === $sDefault ? '' : ' value="' . $sDefault . '"';
$res .= null === $sClass ? '' : ' class="' . $sClass . '"';
$res .= null === $iTabindex ? '' : ' tabindex="' . $iTabindex . '"';
$res .= $bDisabled ? ' disabled="disabled"' : '';
$res .= $sExtraHtml;
$res .= ' />';
return $res;
} | php | public function file($mNameId, $sDefault = null, $sClass = null, $iTabindex = null, $bDisabled = false, $sExtraHtml = null)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<input type="file" name="' . $sName . '"';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= null === $sDefault ? '' : ' value="' . $sDefault . '"';
$res .= null === $sClass ? '' : ' class="' . $sClass . '"';
$res .= null === $iTabindex ? '' : ' tabindex="' . $iTabindex . '"';
$res .= $bDisabled ? ' disabled="disabled"' : '';
$res .= $sExtraHtml;
$res .= ' />';
return $res;
} | [
"public",
"function",
"file",
"(",
"$",
"mNameId",
",",
"$",
"sDefault",
"=",
"null",
",",
"$",
"sClass",
"=",
"null",
",",
"$",
"iTabindex",
"=",
"null",
",",
"$",
"bDisabled",
"=",
"false",
",",
"$",
"sExtraHtml",
"=",
"null",
")",
"{",
"self",
"::",
"getNameAndId",
"(",
"$",
"mNameId",
",",
"$",
"sName",
",",
"$",
"sId",
")",
";",
"$",
"res",
"=",
"'<input type=\"file\" name=\"'",
".",
"$",
"sName",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sId",
"?",
"''",
":",
"' id=\"'",
".",
"$",
"sId",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sDefault",
"?",
"''",
":",
"' value=\"'",
".",
"$",
"sDefault",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sClass",
"?",
"''",
":",
"' class=\"'",
".",
"$",
"sClass",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"iTabindex",
"?",
"''",
":",
"' tabindex=\"'",
".",
"$",
"iTabindex",
".",
"'\"'",
";",
"$",
"res",
".=",
"$",
"bDisabled",
"?",
"' disabled=\"disabled\"'",
":",
"''",
";",
"$",
"res",
".=",
"$",
"sExtraHtml",
";",
"$",
"res",
".=",
"' />'",
";",
"return",
"$",
"res",
";",
"}"
]
| Retourne un champ de formulaire de type file.
@param mixed $mNameId Le nom et l'identifiant du champ
@param string $sDefault La valeur par défaut de lélément
@param string $sClass La classe CSS de l'élément
@param integer $iTabindex Le tabindex de l'élément
@param boolean $bDisabled Désactiver ou non le champ
@param string $sExtraHtml Du HTML en plus à mettre dans l'élément
@return string | [
"Retourne",
"un",
"champ",
"de",
"formulaire",
"de",
"type",
"file",
"."
]
| b5e9109c244a29a72403ae6a58633ab96a67c660 | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/FormElements.php#L177-L191 |
19,072 | forxer/tao | src/Tao/Templating/Helpers/FormElements.php | FormElements.textarea | public function textarea($mNameId, $iCols = null, $iRows = null, $sDefault = null, $sClass = null, $sPlaceholder = null, $iTabindex = null, $bDisabled = false, $sExtraHtml = null)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<textarea';
$res .= null === $iCols ? '' : ' cols="' . $iCols . '"';
$res .= null === $iRows ? '' : ' rows="' . $iRows . '"';
$res .= ' name="' . $sName . '"';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= null === $sPlaceholder ? '' : ' placeholder="' . $sPlaceholder . '"';
$res .= null === $iTabindex ? '' : ' tabindex="' . $iTabindex . '"';
$res .= null === $sClass ? '' : ' class="' . $sClass . '"';
$res .= $bDisabled ? ' disabled="disabled"' : '';
$res .= $sExtraHtml . '>';
$res .= $sDefault;
$res .= '</textarea>';
return $res;
} | php | public function textarea($mNameId, $iCols = null, $iRows = null, $sDefault = null, $sClass = null, $sPlaceholder = null, $iTabindex = null, $bDisabled = false, $sExtraHtml = null)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<textarea';
$res .= null === $iCols ? '' : ' cols="' . $iCols . '"';
$res .= null === $iRows ? '' : ' rows="' . $iRows . '"';
$res .= ' name="' . $sName . '"';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= null === $sPlaceholder ? '' : ' placeholder="' . $sPlaceholder . '"';
$res .= null === $iTabindex ? '' : ' tabindex="' . $iTabindex . '"';
$res .= null === $sClass ? '' : ' class="' . $sClass . '"';
$res .= $bDisabled ? ' disabled="disabled"' : '';
$res .= $sExtraHtml . '>';
$res .= $sDefault;
$res .= '</textarea>';
return $res;
} | [
"public",
"function",
"textarea",
"(",
"$",
"mNameId",
",",
"$",
"iCols",
"=",
"null",
",",
"$",
"iRows",
"=",
"null",
",",
"$",
"sDefault",
"=",
"null",
",",
"$",
"sClass",
"=",
"null",
",",
"$",
"sPlaceholder",
"=",
"null",
",",
"$",
"iTabindex",
"=",
"null",
",",
"$",
"bDisabled",
"=",
"false",
",",
"$",
"sExtraHtml",
"=",
"null",
")",
"{",
"self",
"::",
"getNameAndId",
"(",
"$",
"mNameId",
",",
"$",
"sName",
",",
"$",
"sId",
")",
";",
"$",
"res",
"=",
"'<textarea'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"iCols",
"?",
"''",
":",
"' cols=\"'",
".",
"$",
"iCols",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"iRows",
"?",
"''",
":",
"' rows=\"'",
".",
"$",
"iRows",
".",
"'\"'",
";",
"$",
"res",
".=",
"' name=\"'",
".",
"$",
"sName",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sId",
"?",
"''",
":",
"' id=\"'",
".",
"$",
"sId",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sPlaceholder",
"?",
"''",
":",
"' placeholder=\"'",
".",
"$",
"sPlaceholder",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"iTabindex",
"?",
"''",
":",
"' tabindex=\"'",
".",
"$",
"iTabindex",
".",
"'\"'",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sClass",
"?",
"''",
":",
"' class=\"'",
".",
"$",
"sClass",
".",
"'\"'",
";",
"$",
"res",
".=",
"$",
"bDisabled",
"?",
"' disabled=\"disabled\"'",
":",
"''",
";",
"$",
"res",
".=",
"$",
"sExtraHtml",
".",
"'>'",
";",
"$",
"res",
".=",
"$",
"sDefault",
";",
"$",
"res",
".=",
"'</textarea>'",
";",
"return",
"$",
"res",
";",
"}"
]
| Retourne un champ de formulaire de type textarea.
@param mixed $mNameId Le nom et l'identifiant du champ
@param integer $iCols Le nombre de colonnes
@param integer $iRows Le nombre de lignes
@param string $sDefault La valeur par défaut de lélément
@param string $sClass La classe CSS de l'élément
@param string $sPlaceholder
@param integer $iTabindex Le tabindex de l'élément
@param boolean $bDisabled Désactiver ou non le champ
@param string $sExtraHtml Du HTML en plus à mettre dans l'élément
@return string | [
"Retourne",
"un",
"champ",
"de",
"formulaire",
"de",
"type",
"textarea",
"."
]
| b5e9109c244a29a72403ae6a58633ab96a67c660 | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/FormElements.php#L237-L255 |
19,073 | forxer/tao | src/Tao/Templating/Helpers/FormElements.php | FormElements.hidden | public function hidden($mNameId, $value)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<input type="hidden" name="' . $sName . '" value="' . $value . '" ';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= '>';
return $res;
} | php | public function hidden($mNameId, $value)
{
self::getNameAndId($mNameId, $sName, $sId);
$res = '<input type="hidden" name="' . $sName . '" value="' . $value . '" ';
$res .= null === $sId ? '' : ' id="' . $sId . '"';
$res .= '>';
return $res;
} | [
"public",
"function",
"hidden",
"(",
"$",
"mNameId",
",",
"$",
"value",
")",
"{",
"self",
"::",
"getNameAndId",
"(",
"$",
"mNameId",
",",
"$",
"sName",
",",
"$",
"sId",
")",
";",
"$",
"res",
"=",
"'<input type=\"hidden\" name=\"'",
".",
"$",
"sName",
".",
"'\" value=\"'",
".",
"$",
"value",
".",
"'\" '",
";",
"$",
"res",
".=",
"null",
"===",
"$",
"sId",
"?",
"''",
":",
"' id=\"'",
".",
"$",
"sId",
".",
"'\"'",
";",
"$",
"res",
".=",
"'>'",
";",
"return",
"$",
"res",
";",
"}"
]
| Retourne un champ de formulaire de type hidden.
@param mixed $mNameId Le nom et l'identifiant du champ
@param string $value La valeur par de lélément
@return string | [
"Retourne",
"un",
"champ",
"de",
"formulaire",
"de",
"type",
"hidden",
"."
]
| b5e9109c244a29a72403ae6a58633ab96a67c660 | https://github.com/forxer/tao/blob/b5e9109c244a29a72403ae6a58633ab96a67c660/src/Tao/Templating/Helpers/FormElements.php#L264-L273 |
19,074 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByStreet | public function filterByStreet($street = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($street)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $street)) {
$street = str_replace('*', '%', $street);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::STREET, $street, $comparison);
} | php | public function filterByStreet($street = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($street)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $street)) {
$street = str_replace('*', '%', $street);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::STREET, $street, $comparison);
} | [
"public",
"function",
"filterByStreet",
"(",
"$",
"street",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"street",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"street",
")",
")",
"{",
"$",
"street",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"street",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"STREET",
",",
"$",
"street",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the street column
Example usage:
<code>
$query->filterByStreet('fooValue'); // WHERE street = 'fooValue'
$query->filterByStreet('%fooValue%'); // WHERE street LIKE '%fooValue%'
</code>
@param string $street The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"street",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L376-L388 |
19,075 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByZip | public function filterByZip($zip = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($zip)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $zip)) {
$zip = str_replace('*', '%', $zip);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::ZIP, $zip, $comparison);
} | php | public function filterByZip($zip = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($zip)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $zip)) {
$zip = str_replace('*', '%', $zip);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::ZIP, $zip, $comparison);
} | [
"public",
"function",
"filterByZip",
"(",
"$",
"zip",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"zip",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"zip",
")",
")",
"{",
"$",
"zip",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"zip",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"ZIP",
",",
"$",
"zip",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the zip column
Example usage:
<code>
$query->filterByZip('fooValue'); // WHERE zip = 'fooValue'
$query->filterByZip('%fooValue%'); // WHERE zip LIKE '%fooValue%'
</code>
@param string $zip The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"zip",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L405-L417 |
19,076 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByCity | public function filterByCity($city = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($city)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $city)) {
$city = str_replace('*', '%', $city);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::CITY, $city, $comparison);
} | php | public function filterByCity($city = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($city)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $city)) {
$city = str_replace('*', '%', $city);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::CITY, $city, $comparison);
} | [
"public",
"function",
"filterByCity",
"(",
"$",
"city",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"city",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"city",
")",
")",
"{",
"$",
"city",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"city",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"CITY",
",",
"$",
"city",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the city column
Example usage:
<code>
$query->filterByCity('fooValue'); // WHERE city = 'fooValue'
$query->filterByCity('%fooValue%'); // WHERE city LIKE '%fooValue%'
</code>
@param string $city The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"city",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L434-L446 |
19,077 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByCountryId | public function filterByCountryId($countryId = null, $comparison = null)
{
if (is_array($countryId)) {
$useMinMax = false;
if (isset($countryId['min'])) {
$this->addUsingAlias(CustomerPeer::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($countryId['max'])) {
$this->addUsingAlias(CustomerPeer::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CustomerPeer::COUNTRY_ID, $countryId, $comparison);
} | php | public function filterByCountryId($countryId = null, $comparison = null)
{
if (is_array($countryId)) {
$useMinMax = false;
if (isset($countryId['min'])) {
$this->addUsingAlias(CustomerPeer::COUNTRY_ID, $countryId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($countryId['max'])) {
$this->addUsingAlias(CustomerPeer::COUNTRY_ID, $countryId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CustomerPeer::COUNTRY_ID, $countryId, $comparison);
} | [
"public",
"function",
"filterByCountryId",
"(",
"$",
"countryId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"countryId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"countryId",
"[",
"'min'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"COUNTRY_ID",
",",
"$",
"countryId",
"[",
"'min'",
"]",
",",
"Criteria",
"::",
"GREATER_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"countryId",
"[",
"'max'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"COUNTRY_ID",
",",
"$",
"countryId",
"[",
"'max'",
"]",
",",
"Criteria",
"::",
"LESS_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"$",
"useMinMax",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"COUNTRY_ID",
",",
"$",
"countryId",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the country_id column
Example usage:
<code>
$query->filterByCountryId(1234); // WHERE country_id = 1234
$query->filterByCountryId(array(12, 34)); // WHERE country_id IN (12, 34)
$query->filterByCountryId(array('min' => 12)); // WHERE country_id >= 12
$query->filterByCountryId(array('max' => 12)); // WHERE country_id <= 12
</code>
@see filterByCountry()
@param mixed $countryId The value to use as filter.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"country_id",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L469-L490 |
19,078 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByFax | public function filterByFax($fax = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($fax)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $fax)) {
$fax = str_replace('*', '%', $fax);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::FAX, $fax, $comparison);
} | php | public function filterByFax($fax = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($fax)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $fax)) {
$fax = str_replace('*', '%', $fax);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::FAX, $fax, $comparison);
} | [
"public",
"function",
"filterByFax",
"(",
"$",
"fax",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"fax",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"fax",
")",
")",
"{",
"$",
"fax",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"fax",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"FAX",
",",
"$",
"fax",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the fax column
Example usage:
<code>
$query->filterByFax('fooValue'); // WHERE fax = 'fooValue'
$query->filterByFax('%fooValue%'); // WHERE fax LIKE '%fooValue%'
</code>
@param string $fax The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"fax",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L536-L548 |
19,079 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByEmail | public function filterByEmail($email = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($email)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $email)) {
$email = str_replace('*', '%', $email);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::EMAIL, $email, $comparison);
} | php | public function filterByEmail($email = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($email)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $email)) {
$email = str_replace('*', '%', $email);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::EMAIL, $email, $comparison);
} | [
"public",
"function",
"filterByEmail",
"(",
"$",
"email",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"email",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"email",
")",
")",
"{",
"$",
"email",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"email",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"EMAIL",
",",
"$",
"email",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the email column
Example usage:
<code>
$query->filterByEmail('fooValue'); // WHERE email = 'fooValue'
$query->filterByEmail('%fooValue%'); // WHERE email LIKE '%fooValue%'
</code>
@param string $email The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"email",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L565-L577 |
19,080 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByLegalform | public function filterByLegalform($legalform = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($legalform)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $legalform)) {
$legalform = str_replace('*', '%', $legalform);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::LEGALFORM, $legalform, $comparison);
} | php | public function filterByLegalform($legalform = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($legalform)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $legalform)) {
$legalform = str_replace('*', '%', $legalform);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::LEGALFORM, $legalform, $comparison);
} | [
"public",
"function",
"filterByLegalform",
"(",
"$",
"legalform",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"legalform",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"legalform",
")",
")",
"{",
"$",
"legalform",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"legalform",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"LEGALFORM",
",",
"$",
"legalform",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the legalform column
Example usage:
<code>
$query->filterByLegalform('fooValue'); // WHERE legalform = 'fooValue'
$query->filterByLegalform('%fooValue%'); // WHERE legalform LIKE '%fooValue%'
</code>
@param string $legalform The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"legalform",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L594-L606 |
19,081 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByLogo | public function filterByLogo($logo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($logo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $logo)) {
$logo = str_replace('*', '%', $logo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::LOGO, $logo, $comparison);
} | php | public function filterByLogo($logo = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($logo)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $logo)) {
$logo = str_replace('*', '%', $logo);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::LOGO, $logo, $comparison);
} | [
"public",
"function",
"filterByLogo",
"(",
"$",
"logo",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"logo",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"logo",
")",
")",
"{",
"$",
"logo",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"logo",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"LOGO",
",",
"$",
"logo",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the logo column
Example usage:
<code>
$query->filterByLogo('fooValue'); // WHERE logo = 'fooValue'
$query->filterByLogo('%fooValue%'); // WHERE logo LIKE '%fooValue%'
</code>
@param string $logo The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"logo",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L623-L635 |
19,082 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByCreated | public function filterByCreated($created = null, $comparison = null)
{
if (is_array($created)) {
$useMinMax = false;
if (isset($created['min'])) {
$this->addUsingAlias(CustomerPeer::CREATED, $created['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($created['max'])) {
$this->addUsingAlias(CustomerPeer::CREATED, $created['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CustomerPeer::CREATED, $created, $comparison);
} | php | public function filterByCreated($created = null, $comparison = null)
{
if (is_array($created)) {
$useMinMax = false;
if (isset($created['min'])) {
$this->addUsingAlias(CustomerPeer::CREATED, $created['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($created['max'])) {
$this->addUsingAlias(CustomerPeer::CREATED, $created['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(CustomerPeer::CREATED, $created, $comparison);
} | [
"public",
"function",
"filterByCreated",
"(",
"$",
"created",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"created",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"created",
"[",
"'min'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"CREATED",
",",
"$",
"created",
"[",
"'min'",
"]",
",",
"Criteria",
"::",
"GREATER_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"created",
"[",
"'max'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"CREATED",
",",
"$",
"created",
"[",
"'max'",
"]",
",",
"Criteria",
"::",
"LESS_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"$",
"useMinMax",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"CREATED",
",",
"$",
"created",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the created column
Example usage:
<code>
$query->filterByCreated('2011-03-14'); // WHERE created = '2011-03-14'
$query->filterByCreated('now'); // WHERE created = '2011-03-14'
$query->filterByCreated(array('max' => 'yesterday')); // WHERE created < '2011-03-13'
</code>
@param mixed $created The value to use as filter.
Values can be integers (unix timestamps), DateTime objects, or strings.
Empty strings are treated as NULL.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"created",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L657-L678 |
19,083 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByNotes | public function filterByNotes($notes = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($notes)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $notes)) {
$notes = str_replace('*', '%', $notes);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::NOTES, $notes, $comparison);
} | php | public function filterByNotes($notes = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($notes)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $notes)) {
$notes = str_replace('*', '%', $notes);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(CustomerPeer::NOTES, $notes, $comparison);
} | [
"public",
"function",
"filterByNotes",
"(",
"$",
"notes",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"notes",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"notes",
")",
")",
"{",
"$",
"notes",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"notes",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"NOTES",
",",
"$",
"notes",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the notes column
Example usage:
<code>
$query->filterByNotes('fooValue'); // WHERE notes = 'fooValue'
$query->filterByNotes('%fooValue%'); // WHERE notes LIKE '%fooValue%'
</code>
@param string $notes The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"notes",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L695-L707 |
19,084 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.filterByCountry | public function filterByCountry($country, $comparison = null)
{
if ($country instanceof Country) {
return $this
->addUsingAlias(CustomerPeer::COUNTRY_ID, $country->getId(), $comparison);
} elseif ($country instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CustomerPeer::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCountry() only accepts arguments of type Country or PropelCollection');
}
} | php | public function filterByCountry($country, $comparison = null)
{
if ($country instanceof Country) {
return $this
->addUsingAlias(CustomerPeer::COUNTRY_ID, $country->getId(), $comparison);
} elseif ($country instanceof PropelObjectCollection) {
if (null === $comparison) {
$comparison = Criteria::IN;
}
return $this
->addUsingAlias(CustomerPeer::COUNTRY_ID, $country->toKeyValue('PrimaryKey', 'Id'), $comparison);
} else {
throw new PropelException('filterByCountry() only accepts arguments of type Country or PropelCollection');
}
} | [
"public",
"function",
"filterByCountry",
"(",
"$",
"country",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"country",
"instanceof",
"Country",
")",
"{",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"COUNTRY_ID",
",",
"$",
"country",
"->",
"getId",
"(",
")",
",",
"$",
"comparison",
")",
";",
"}",
"elseif",
"(",
"$",
"country",
"instanceof",
"PropelObjectCollection",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"CustomerPeer",
"::",
"COUNTRY_ID",
",",
"$",
"country",
"->",
"toKeyValue",
"(",
"'PrimaryKey'",
",",
"'Id'",
")",
",",
"$",
"comparison",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"PropelException",
"(",
"'filterByCountry() only accepts arguments of type Country or PropelCollection'",
")",
";",
"}",
"}"
]
| Filter the query by a related Country object
@param Country|PropelObjectCollection $country The related object(s) to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return CustomerQuery The current query, for fluid interface
@throws PropelException - if the provided filter is invalid. | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"Country",
"object"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L718-L733 |
19,085 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.useCountryQuery | public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCountry($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Country', '\Slashworks\AppBundle\Model\CountryQuery');
} | php | public function useCountryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCountry($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Country', '\Slashworks\AppBundle\Model\CountryQuery');
} | [
"public",
"function",
"useCountryQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinCountry",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQuery",
"(",
"$",
"relationAlias",
"?",
"$",
"relationAlias",
":",
"'Country'",
",",
"'\\Slashworks\\AppBundle\\Model\\CountryQuery'",
")",
";",
"}"
]
| Use the Country relation Country object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Slashworks\AppBundle\Model\CountryQuery A secondary query class using the current class as primary query | [
"Use",
"the",
"Country",
"relation",
"Country",
"object"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L778-L783 |
19,086 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php | BaseCustomerQuery.useUserCustomerRelationQuery | public function useUserCustomerRelationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinUserCustomerRelation($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'UserCustomerRelation', '\Slashworks\AppBundle\Model\UserCustomerRelationQuery');
} | php | public function useUserCustomerRelationQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinUserCustomerRelation($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'UserCustomerRelation', '\Slashworks\AppBundle\Model\UserCustomerRelationQuery');
} | [
"public",
"function",
"useUserCustomerRelationQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinUserCustomerRelation",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQuery",
"(",
"$",
"relationAlias",
"?",
"$",
"relationAlias",
":",
"'UserCustomerRelation'",
",",
"'\\Slashworks\\AppBundle\\Model\\UserCustomerRelationQuery'",
")",
";",
"}"
]
| Use the UserCustomerRelation relation UserCustomerRelation object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Slashworks\AppBundle\Model\UserCustomerRelationQuery A secondary query class using the current class as primary query | [
"Use",
"the",
"UserCustomerRelation",
"relation",
"UserCustomerRelation",
"object"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseCustomerQuery.php#L926-L931 |
19,087 | yuncms/framework | src/filesystem/FilesystemManager.php | FilesystemManager.resolve | protected function resolve($name)
{
$config = $this->disks[$name];
if (isset($config['class'])) {
return Yii::createObject($config);
} else if (isset($config['adapter'])) {
$driverMethod = 'create' . ucfirst($config['adapter']) . 'Adapter';
if (method_exists($this, $driverMethod)) {
return $this->{$driverMethod}($config);
} else {
throw new InvalidArgumentException("Adapter [{$config['adapter']}] is not supported.");
}
} else {
throw new InvalidArgumentException("Wrong adapter configuration.");
}
} | php | protected function resolve($name)
{
$config = $this->disks[$name];
if (isset($config['class'])) {
return Yii::createObject($config);
} else if (isset($config['adapter'])) {
$driverMethod = 'create' . ucfirst($config['adapter']) . 'Adapter';
if (method_exists($this, $driverMethod)) {
return $this->{$driverMethod}($config);
} else {
throw new InvalidArgumentException("Adapter [{$config['adapter']}] is not supported.");
}
} else {
throw new InvalidArgumentException("Wrong adapter configuration.");
}
} | [
"protected",
"function",
"resolve",
"(",
"$",
"name",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"disks",
"[",
"$",
"name",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'class'",
"]",
")",
")",
"{",
"return",
"Yii",
"::",
"createObject",
"(",
"$",
"config",
")",
";",
"}",
"else",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'adapter'",
"]",
")",
")",
"{",
"$",
"driverMethod",
"=",
"'create'",
".",
"ucfirst",
"(",
"$",
"config",
"[",
"'adapter'",
"]",
")",
".",
"'Adapter'",
";",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"driverMethod",
")",
")",
"{",
"return",
"$",
"this",
"->",
"{",
"$",
"driverMethod",
"}",
"(",
"$",
"config",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Adapter [{$config['adapter']}] is not supported.\"",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Wrong adapter configuration.\"",
")",
";",
"}",
"}"
]
| Resolve the given disk.
@param string $name
@return object|Filesystem
@throws \yii\base\InvalidConfigException | [
"Resolve",
"the",
"given",
"disk",
"."
]
| af42e28ea4ae15ab8eead3f6d119f93863b94154 | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/FilesystemManager.php#L120-L135 |
19,088 | yuncms/framework | src/filesystem/FilesystemManager.php | FilesystemManager.createLocalAdapter | public function createLocalAdapter(array $config)
{
$permissions = $config['permissions'] ?? [];
$root = Yii::getAlias($config['root']);
$links = ($config['links'] ?? null) === 'skip'
? LocalAdapter::SKIP_LINKS
: LocalAdapter::DISALLOW_LINKS;
return $this->adapt($this->createFlysystem(new LocalAdapter(
$root, LOCK_EX, $links, $permissions
), $config));
} | php | public function createLocalAdapter(array $config)
{
$permissions = $config['permissions'] ?? [];
$root = Yii::getAlias($config['root']);
$links = ($config['links'] ?? null) === 'skip'
? LocalAdapter::SKIP_LINKS
: LocalAdapter::DISALLOW_LINKS;
return $this->adapt($this->createFlysystem(new LocalAdapter(
$root, LOCK_EX, $links, $permissions
), $config));
} | [
"public",
"function",
"createLocalAdapter",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"permissions",
"=",
"$",
"config",
"[",
"'permissions'",
"]",
"??",
"[",
"]",
";",
"$",
"root",
"=",
"Yii",
"::",
"getAlias",
"(",
"$",
"config",
"[",
"'root'",
"]",
")",
";",
"$",
"links",
"=",
"(",
"$",
"config",
"[",
"'links'",
"]",
"??",
"null",
")",
"===",
"'skip'",
"?",
"LocalAdapter",
"::",
"SKIP_LINKS",
":",
"LocalAdapter",
"::",
"DISALLOW_LINKS",
";",
"return",
"$",
"this",
"->",
"adapt",
"(",
"$",
"this",
"->",
"createFlysystem",
"(",
"new",
"LocalAdapter",
"(",
"$",
"root",
",",
"LOCK_EX",
",",
"$",
"links",
",",
"$",
"permissions",
")",
",",
"$",
"config",
")",
")",
";",
"}"
]
| Create an instance of the local adapter.
@param array $config
@return \yuncms\filesystem\Filesystem | [
"Create",
"an",
"instance",
"of",
"the",
"local",
"adapter",
"."
]
| af42e28ea4ae15ab8eead3f6d119f93863b94154 | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/FilesystemManager.php#L143-L155 |
19,089 | yuncms/framework | src/filesystem/FilesystemManager.php | FilesystemManager.createOssAdapter | public function createOssAdapter(array $config)
{
$root = $config['root'] ?? null;
$oss = new OssClient($config['access_id'], $config['access_secret'], $config['endpoint'],
$config['isCName'] ?? false,
$config['securityToken'] ?? null,
$config['proxy'] ?? null
);
$oss->setTimeout($config['timeout'] ?? 3600);
$oss->setConnectTimeout($config['connectTimeout'] ?? 10);
$oss->setUseSSL($config['useSSL'] ?? false);
return $this->adapt($this->createFlysystem(
new OssAdapter($oss, $config['bucket'], $root), $config
));
} | php | public function createOssAdapter(array $config)
{
$root = $config['root'] ?? null;
$oss = new OssClient($config['access_id'], $config['access_secret'], $config['endpoint'],
$config['isCName'] ?? false,
$config['securityToken'] ?? null,
$config['proxy'] ?? null
);
$oss->setTimeout($config['timeout'] ?? 3600);
$oss->setConnectTimeout($config['connectTimeout'] ?? 10);
$oss->setUseSSL($config['useSSL'] ?? false);
return $this->adapt($this->createFlysystem(
new OssAdapter($oss, $config['bucket'], $root), $config
));
} | [
"public",
"function",
"createOssAdapter",
"(",
"array",
"$",
"config",
")",
"{",
"$",
"root",
"=",
"$",
"config",
"[",
"'root'",
"]",
"??",
"null",
";",
"$",
"oss",
"=",
"new",
"OssClient",
"(",
"$",
"config",
"[",
"'access_id'",
"]",
",",
"$",
"config",
"[",
"'access_secret'",
"]",
",",
"$",
"config",
"[",
"'endpoint'",
"]",
",",
"$",
"config",
"[",
"'isCName'",
"]",
"??",
"false",
",",
"$",
"config",
"[",
"'securityToken'",
"]",
"??",
"null",
",",
"$",
"config",
"[",
"'proxy'",
"]",
"??",
"null",
")",
";",
"$",
"oss",
"->",
"setTimeout",
"(",
"$",
"config",
"[",
"'timeout'",
"]",
"??",
"3600",
")",
";",
"$",
"oss",
"->",
"setConnectTimeout",
"(",
"$",
"config",
"[",
"'connectTimeout'",
"]",
"??",
"10",
")",
";",
"$",
"oss",
"->",
"setUseSSL",
"(",
"$",
"config",
"[",
"'useSSL'",
"]",
"??",
"false",
")",
";",
"return",
"$",
"this",
"->",
"adapt",
"(",
"$",
"this",
"->",
"createFlysystem",
"(",
"new",
"OssAdapter",
"(",
"$",
"oss",
",",
"$",
"config",
"[",
"'bucket'",
"]",
",",
"$",
"root",
")",
",",
"$",
"config",
")",
")",
";",
"}"
]
| Create an instance of the oss driver.
@param array $config
@return \yuncms\filesystem\Filesystem
@throws \OSS\Core\OssException
@throws \Exception | [
"Create",
"an",
"instance",
"of",
"the",
"oss",
"driver",
"."
]
| af42e28ea4ae15ab8eead3f6d119f93863b94154 | https://github.com/yuncms/framework/blob/af42e28ea4ae15ab8eead3f6d119f93863b94154/src/filesystem/FilesystemManager.php#L165-L179 |
19,090 | andynoelker/laravel-5-view-generator | src/ViewMakeCommand.php | ViewMakeCommand.createView | protected function createView($path)
{
$contents = $this->getViewContents();
file_put_contents($path,$contents);
$this->info('View created successfully.');
} | php | protected function createView($path)
{
$contents = $this->getViewContents();
file_put_contents($path,$contents);
$this->info('View created successfully.');
} | [
"protected",
"function",
"createView",
"(",
"$",
"path",
")",
"{",
"$",
"contents",
"=",
"$",
"this",
"->",
"getViewContents",
"(",
")",
";",
"file_put_contents",
"(",
"$",
"path",
",",
"$",
"contents",
")",
";",
"$",
"this",
"->",
"info",
"(",
"'View created successfully.'",
")",
";",
"}"
]
| Generate the Blade view.
@param string $path The path of the view.
@return void | [
"Generate",
"the",
"Blade",
"view",
"."
]
| c18b1d9e0959cb5d7c5f83650b47464b81ea287d | https://github.com/andynoelker/laravel-5-view-generator/blob/c18b1d9e0959cb5d7c5f83650b47464b81ea287d/src/ViewMakeCommand.php#L62-L69 |
19,091 | andynoelker/laravel-5-view-generator | src/ViewMakeCommand.php | ViewMakeCommand.makeDirectory | protected function makeDirectory($path)
{
$dir = dirname($path);
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
} | php | protected function makeDirectory($path)
{
$dir = dirname($path);
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
} | [
"protected",
"function",
"makeDirectory",
"(",
"$",
"path",
")",
"{",
"$",
"dir",
"=",
"dirname",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"dir",
")",
")",
"{",
"mkdir",
"(",
"$",
"dir",
",",
"0777",
",",
"true",
")",
";",
"}",
"}"
]
| Create the directory for the view if it does not already exist.
@param string $path The full path of the view file.
@return void | [
"Create",
"the",
"directory",
"for",
"the",
"view",
"if",
"it",
"does",
"not",
"already",
"exist",
"."
]
| c18b1d9e0959cb5d7c5f83650b47464b81ea287d | https://github.com/andynoelker/laravel-5-view-generator/blob/c18b1d9e0959cb5d7c5f83650b47464b81ea287d/src/ViewMakeCommand.php#L92-L99 |
19,092 | aedart/laravel-helpers | src/Traits/Bus/QueueingBusTrait.php | QueueingBusTrait.getQueueingBus | public function getQueueingBus(): ?QueueingDispatcher
{
if (!$this->hasQueueingBus()) {
$this->setQueueingBus($this->getDefaultQueueingBus());
}
return $this->queueingBus;
} | php | public function getQueueingBus(): ?QueueingDispatcher
{
if (!$this->hasQueueingBus()) {
$this->setQueueingBus($this->getDefaultQueueingBus());
}
return $this->queueingBus;
} | [
"public",
"function",
"getQueueingBus",
"(",
")",
":",
"?",
"QueueingDispatcher",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasQueueingBus",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setQueueingBus",
"(",
"$",
"this",
"->",
"getDefaultQueueingBus",
"(",
")",
")",
";",
"}",
"return",
"$",
"this",
"->",
"queueingBus",
";",
"}"
]
| Get queueing bus
If no queueing bus has been set, this method will
set and return a default queueing bus, if any such
value is available
@see getDefaultQueueingBus()
@return QueueingDispatcher|null queueing bus or null if none queueing bus has been set | [
"Get",
"queueing",
"bus"
]
| 8b81a2d6658f3f8cb62b6be2c34773aaa2df219a | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Bus/QueueingBusTrait.php#L53-L59 |
19,093 | tableau-mkt/eggs-n-cereal | src/Serializer.php | Serializer.serialize | public function serialize(TranslatableInterface $translatable, $targetLang) {
$output = $this->beginExport($translatable, $targetLang);
$output .= $this->exportTranslatable($translatable, $targetLang);
$output .= $this->endExport();
return $output;
} | php | public function serialize(TranslatableInterface $translatable, $targetLang) {
$output = $this->beginExport($translatable, $targetLang);
$output .= $this->exportTranslatable($translatable, $targetLang);
$output .= $this->endExport();
return $output;
} | [
"public",
"function",
"serialize",
"(",
"TranslatableInterface",
"$",
"translatable",
",",
"$",
"targetLang",
")",
"{",
"$",
"output",
"=",
"$",
"this",
"->",
"beginExport",
"(",
"$",
"translatable",
",",
"$",
"targetLang",
")",
";",
"$",
"output",
".=",
"$",
"this",
"->",
"exportTranslatable",
"(",
"$",
"translatable",
",",
"$",
"targetLang",
")",
";",
"$",
"output",
".=",
"$",
"this",
"->",
"endExport",
"(",
")",
";",
"return",
"$",
"output",
";",
"}"
]
| Serializes a given translatable into an XLIFF file with the specified
target language.
@param TranslatableInterface $translatable
The translatable to be serialized.
@param string $targetLang
The desired target language.
@return string
The resultant XLIFF file as a string. | [
"Serializes",
"a",
"given",
"translatable",
"into",
"an",
"XLIFF",
"file",
"with",
"the",
"specified",
"target",
"language",
"."
]
| 778b83ddae1dd687724a84545ce8afa1a31e4bcf | https://github.com/tableau-mkt/eggs-n-cereal/blob/778b83ddae1dd687724a84545ce8afa1a31e4bcf/src/Serializer.php#L69-L74 |
19,094 | tableau-mkt/eggs-n-cereal | src/Serializer.php | Serializer.unserialize | public function unserialize(TranslatableInterface $translatable, $targetLang, $xliff, $callSetData = TRUE) {
// First, validate the provided xliff.
if ($this->validateImport($translatable, $targetLang, $xliff)) {
// If valid, return the imported data as an array.
$data = $this->import($xliff);
// Call TranslatableInterface::setData() on the translatable if desired.
if ($callSetData) {
$translatable->setData($data, $targetLang);
}
return $data;
}
else {
// If there was an error, return an empty array.
return array();
}
} | php | public function unserialize(TranslatableInterface $translatable, $targetLang, $xliff, $callSetData = TRUE) {
// First, validate the provided xliff.
if ($this->validateImport($translatable, $targetLang, $xliff)) {
// If valid, return the imported data as an array.
$data = $this->import($xliff);
// Call TranslatableInterface::setData() on the translatable if desired.
if ($callSetData) {
$translatable->setData($data, $targetLang);
}
return $data;
}
else {
// If there was an error, return an empty array.
return array();
}
} | [
"public",
"function",
"unserialize",
"(",
"TranslatableInterface",
"$",
"translatable",
",",
"$",
"targetLang",
",",
"$",
"xliff",
",",
"$",
"callSetData",
"=",
"TRUE",
")",
"{",
"// First, validate the provided xliff.",
"if",
"(",
"$",
"this",
"->",
"validateImport",
"(",
"$",
"translatable",
",",
"$",
"targetLang",
",",
"$",
"xliff",
")",
")",
"{",
"// If valid, return the imported data as an array.",
"$",
"data",
"=",
"$",
"this",
"->",
"import",
"(",
"$",
"xliff",
")",
";",
"// Call TranslatableInterface::setData() on the translatable if desired.",
"if",
"(",
"$",
"callSetData",
")",
"{",
"$",
"translatable",
"->",
"setData",
"(",
"$",
"data",
",",
"$",
"targetLang",
")",
";",
"}",
"return",
"$",
"data",
";",
"}",
"else",
"{",
"// If there was an error, return an empty array.",
"return",
"array",
"(",
")",
";",
"}",
"}"
]
| Unserializes given XLIFF data; before unserialization occurs, the provided
XLIFF is also validated against the provided translatable and target
language.
@param TranslatableInterface $translatable
The translatable against which validation will occur.
@param $targetLang
The language code of the target language (used for validation).
@param string $xliff
XLIFF data to be unserialized.
@param bool $callSetData
(Optional) Whether or not to call the setData method on the provided
translatable. Defaults to TRUE, pass FALSE to disable the setter call.
@return array
Returns unserialized data as an array in the exact same form that was
provided via the translatable's getData method. If there was an error
unserializing the provided XLIFF, an empty array will be returned. | [
"Unserializes",
"given",
"XLIFF",
"data",
";",
"before",
"unserialization",
"occurs",
"the",
"provided",
"XLIFF",
"is",
"also",
"validated",
"against",
"the",
"provided",
"translatable",
"and",
"target",
"language",
"."
]
| 778b83ddae1dd687724a84545ce8afa1a31e4bcf | https://github.com/tableau-mkt/eggs-n-cereal/blob/778b83ddae1dd687724a84545ce8afa1a31e4bcf/src/Serializer.php#L99-L116 |
19,095 | tableau-mkt/eggs-n-cereal | src/Serializer.php | Serializer.beginExport | public function beginExport(TranslatableInterface $translatable, $targetLang) {
$this->openMemory();
$this->setIndent(TRUE);
$this->setIndentString(' ');
$this->startDocument('1.0', 'UTF-8');
// Root element with schema definition.
$this->startElement('xliff');
$this->writeAttribute('version', '1.2');
$this->writeAttribute('xmlns:xlf', 'urn:oasis:names:tc:xliff:document:1.2');
$this->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$this->writeAttribute('xmlns:html', 'http://www.w3.org/1999/xhtml');
$this->writeAttribute('xsi:schemaLocation', 'urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-strict.xsd');
// File element.
$this->startElement('file');
$this->writeAttribute('original', 'xliff-core-1.2-strict.xsd');
$this->writeAttribute('source-language', $this->sourceLang);
$this->writeAttribute('target-language', $targetLang);
$this->writeAttribute('datatype', 'plaintext');
// Date needs to be in ISO-8601 UTC.
$this->writeAttribute('date', date('Y-m-d\Th:m:i\Z'));
$this->startElement('header');
$this->startElement('phase-group');
$this->startElement('phase');
$this->writeAttribute('tool-id', 'eggs-n-cereal');
$this->writeAttribute('phase-name', 'extraction');
$this->writeAttribute('process-name', 'extraction');
$this->writeAttribute('job-id', $translatable->getIdentifier());
$this->endElement();
$this->endElement();
$this->startElement('tool');
$this->writeAttribute('tool-id', 'eggs-n-cereal');
$this->writeAttribute('tool-name', 'Eggs-n-Cereal XLIFF Serializer');
$this->endElement();
$this->endElement();
return $this->outputMemory() . '<body>';
} | php | public function beginExport(TranslatableInterface $translatable, $targetLang) {
$this->openMemory();
$this->setIndent(TRUE);
$this->setIndentString(' ');
$this->startDocument('1.0', 'UTF-8');
// Root element with schema definition.
$this->startElement('xliff');
$this->writeAttribute('version', '1.2');
$this->writeAttribute('xmlns:xlf', 'urn:oasis:names:tc:xliff:document:1.2');
$this->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
$this->writeAttribute('xmlns:html', 'http://www.w3.org/1999/xhtml');
$this->writeAttribute('xsi:schemaLocation', 'urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-strict.xsd');
// File element.
$this->startElement('file');
$this->writeAttribute('original', 'xliff-core-1.2-strict.xsd');
$this->writeAttribute('source-language', $this->sourceLang);
$this->writeAttribute('target-language', $targetLang);
$this->writeAttribute('datatype', 'plaintext');
// Date needs to be in ISO-8601 UTC.
$this->writeAttribute('date', date('Y-m-d\Th:m:i\Z'));
$this->startElement('header');
$this->startElement('phase-group');
$this->startElement('phase');
$this->writeAttribute('tool-id', 'eggs-n-cereal');
$this->writeAttribute('phase-name', 'extraction');
$this->writeAttribute('process-name', 'extraction');
$this->writeAttribute('job-id', $translatable->getIdentifier());
$this->endElement();
$this->endElement();
$this->startElement('tool');
$this->writeAttribute('tool-id', 'eggs-n-cereal');
$this->writeAttribute('tool-name', 'Eggs-n-Cereal XLIFF Serializer');
$this->endElement();
$this->endElement();
return $this->outputMemory() . '<body>';
} | [
"public",
"function",
"beginExport",
"(",
"TranslatableInterface",
"$",
"translatable",
",",
"$",
"targetLang",
")",
"{",
"$",
"this",
"->",
"openMemory",
"(",
")",
";",
"$",
"this",
"->",
"setIndent",
"(",
"TRUE",
")",
";",
"$",
"this",
"->",
"setIndentString",
"(",
"' '",
")",
";",
"$",
"this",
"->",
"startDocument",
"(",
"'1.0'",
",",
"'UTF-8'",
")",
";",
"// Root element with schema definition.",
"$",
"this",
"->",
"startElement",
"(",
"'xliff'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'version'",
",",
"'1.2'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'xmlns:xlf'",
",",
"'urn:oasis:names:tc:xliff:document:1.2'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'xmlns:xsi'",
",",
"'http://www.w3.org/2001/XMLSchema-instance'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'xmlns:html'",
",",
"'http://www.w3.org/1999/xhtml'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'xsi:schemaLocation'",
",",
"'urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-strict.xsd'",
")",
";",
"// File element.",
"$",
"this",
"->",
"startElement",
"(",
"'file'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'original'",
",",
"'xliff-core-1.2-strict.xsd'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'source-language'",
",",
"$",
"this",
"->",
"sourceLang",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'target-language'",
",",
"$",
"targetLang",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'datatype'",
",",
"'plaintext'",
")",
";",
"// Date needs to be in ISO-8601 UTC.",
"$",
"this",
"->",
"writeAttribute",
"(",
"'date'",
",",
"date",
"(",
"'Y-m-d\\Th:m:i\\Z'",
")",
")",
";",
"$",
"this",
"->",
"startElement",
"(",
"'header'",
")",
";",
"$",
"this",
"->",
"startElement",
"(",
"'phase-group'",
")",
";",
"$",
"this",
"->",
"startElement",
"(",
"'phase'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'tool-id'",
",",
"'eggs-n-cereal'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'phase-name'",
",",
"'extraction'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'process-name'",
",",
"'extraction'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'job-id'",
",",
"$",
"translatable",
"->",
"getIdentifier",
"(",
")",
")",
";",
"$",
"this",
"->",
"endElement",
"(",
")",
";",
"$",
"this",
"->",
"endElement",
"(",
")",
";",
"$",
"this",
"->",
"startElement",
"(",
"'tool'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'tool-id'",
",",
"'eggs-n-cereal'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'tool-name'",
",",
"'Eggs-n-Cereal XLIFF Serializer'",
")",
";",
"$",
"this",
"->",
"endElement",
"(",
")",
";",
"$",
"this",
"->",
"endElement",
"(",
")",
";",
"return",
"$",
"this",
"->",
"outputMemory",
"(",
")",
".",
"'<body>'",
";",
"}"
]
| Starts an export.
@param TranslatableInterface $translatable
The translatable for which we will be generating an XLIFF.
@param string $targetLang
The language code of the target language for this XLIFF.
@return string
The generated XML. | [
"Starts",
"an",
"export",
"."
]
| 778b83ddae1dd687724a84545ce8afa1a31e4bcf | https://github.com/tableau-mkt/eggs-n-cereal/blob/778b83ddae1dd687724a84545ce8afa1a31e4bcf/src/Serializer.php#L130-L172 |
19,096 | tableau-mkt/eggs-n-cereal | src/Serializer.php | Serializer.exportTranslatable | public function exportTranslatable(TranslatableInterface $translatable, $targetLang) {
$this->openMemory();
$this->setIndent(TRUE);
$this->setIndentString(' ');
$this->startElement('xlf:group');
$this->writeAttribute('id', $translatable->getIdentifier());
$this->writeAttribute('restype', 'x-eggs-n-cereal-translatable');
// Retrieve and flatten translatable data.
$translatableData = $translatable->getData();
$flattenedData = Data::flattenData($translatableData);
// @todo: Write in nested groups instead of flattening it.
$data = array_filter($flattenedData, array('EggsCereal\Utils\Data', 'filterData'));
foreach ($data as $key => $element) {
$this->addTransUnit($key, $element, $targetLang);
}
$this->endElement();
return $this->outputMemory();
} | php | public function exportTranslatable(TranslatableInterface $translatable, $targetLang) {
$this->openMemory();
$this->setIndent(TRUE);
$this->setIndentString(' ');
$this->startElement('xlf:group');
$this->writeAttribute('id', $translatable->getIdentifier());
$this->writeAttribute('restype', 'x-eggs-n-cereal-translatable');
// Retrieve and flatten translatable data.
$translatableData = $translatable->getData();
$flattenedData = Data::flattenData($translatableData);
// @todo: Write in nested groups instead of flattening it.
$data = array_filter($flattenedData, array('EggsCereal\Utils\Data', 'filterData'));
foreach ($data as $key => $element) {
$this->addTransUnit($key, $element, $targetLang);
}
$this->endElement();
return $this->outputMemory();
} | [
"public",
"function",
"exportTranslatable",
"(",
"TranslatableInterface",
"$",
"translatable",
",",
"$",
"targetLang",
")",
"{",
"$",
"this",
"->",
"openMemory",
"(",
")",
";",
"$",
"this",
"->",
"setIndent",
"(",
"TRUE",
")",
";",
"$",
"this",
"->",
"setIndentString",
"(",
"' '",
")",
";",
"$",
"this",
"->",
"startElement",
"(",
"'xlf:group'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'id'",
",",
"$",
"translatable",
"->",
"getIdentifier",
"(",
")",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'restype'",
",",
"'x-eggs-n-cereal-translatable'",
")",
";",
"// Retrieve and flatten translatable data.",
"$",
"translatableData",
"=",
"$",
"translatable",
"->",
"getData",
"(",
")",
";",
"$",
"flattenedData",
"=",
"Data",
"::",
"flattenData",
"(",
"$",
"translatableData",
")",
";",
"// @todo: Write in nested groups instead of flattening it.",
"$",
"data",
"=",
"array_filter",
"(",
"$",
"flattenedData",
",",
"array",
"(",
"'EggsCereal\\Utils\\Data'",
",",
"'filterData'",
")",
")",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"element",
")",
"{",
"$",
"this",
"->",
"addTransUnit",
"(",
"$",
"key",
",",
"$",
"element",
",",
"$",
"targetLang",
")",
";",
"}",
"$",
"this",
"->",
"endElement",
"(",
")",
";",
"return",
"$",
"this",
"->",
"outputMemory",
"(",
")",
";",
"}"
]
| Adds a translatable item to the XML export.
@param TranslatableInterface $translatable
The translatable to serialize.
@param string $targetLang
The desired translatable.
@return string
The generated XML. | [
"Adds",
"a",
"translatable",
"item",
"to",
"the",
"XML",
"export",
"."
]
| 778b83ddae1dd687724a84545ce8afa1a31e4bcf | https://github.com/tableau-mkt/eggs-n-cereal/blob/778b83ddae1dd687724a84545ce8afa1a31e4bcf/src/Serializer.php#L186-L206 |
19,097 | tableau-mkt/eggs-n-cereal | src/Serializer.php | Serializer.addTransUnit | protected function addTransUnit($key, $element, $targetLang) {
$this->startElement('xlf:group');
$this->writeAttribute('id', $key);
$this->writeAttribute('resname', $key);
$this->writeAttribute('restype', 'x-eggs-n-cereal-field');
//escape named html entities prior to conversion
$list = get_html_translation_table(HTML_ENTITIES);
$namedTable = array();
foreach($list as $k=>$v){
$namedTable[$v]= "&".str_replace('&', '',$v);
}
$element['#text'] = strtr($element['#text'], $namedTable);
try {
$converter = new Converter($element['#text'], $this->sourceLang, $targetLang);
if ($this->logger) {
$converter->setLogger($this->logger);
}
$this->writeRaw($converter->toXLIFF());
}
catch (\Exception $e) {
$this->startElement('trans-unit');
$this->writeAttribute('id', uniqid('text-'));
$this->writeAttribute('restype', 'x-eggs-n-cereal-failure');
$this->startElement('source');
$this->writeAttribute('xml:lang', $this->sourceLang);
$this->text($element['#text']);
$this->endElement();
$this->startElement('target');
$this->writeAttribute('xml:lang', $targetLang);
$this->text($element['#text']);
$this->endElement();
$this->endElement();
}
if (isset($element['#label'])) {
$this->writeElement('note', $element['#label']);
}
$this->endElement();
} | php | protected function addTransUnit($key, $element, $targetLang) {
$this->startElement('xlf:group');
$this->writeAttribute('id', $key);
$this->writeAttribute('resname', $key);
$this->writeAttribute('restype', 'x-eggs-n-cereal-field');
//escape named html entities prior to conversion
$list = get_html_translation_table(HTML_ENTITIES);
$namedTable = array();
foreach($list as $k=>$v){
$namedTable[$v]= "&".str_replace('&', '',$v);
}
$element['#text'] = strtr($element['#text'], $namedTable);
try {
$converter = new Converter($element['#text'], $this->sourceLang, $targetLang);
if ($this->logger) {
$converter->setLogger($this->logger);
}
$this->writeRaw($converter->toXLIFF());
}
catch (\Exception $e) {
$this->startElement('trans-unit');
$this->writeAttribute('id', uniqid('text-'));
$this->writeAttribute('restype', 'x-eggs-n-cereal-failure');
$this->startElement('source');
$this->writeAttribute('xml:lang', $this->sourceLang);
$this->text($element['#text']);
$this->endElement();
$this->startElement('target');
$this->writeAttribute('xml:lang', $targetLang);
$this->text($element['#text']);
$this->endElement();
$this->endElement();
}
if (isset($element['#label'])) {
$this->writeElement('note', $element['#label']);
}
$this->endElement();
} | [
"protected",
"function",
"addTransUnit",
"(",
"$",
"key",
",",
"$",
"element",
",",
"$",
"targetLang",
")",
"{",
"$",
"this",
"->",
"startElement",
"(",
"'xlf:group'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'id'",
",",
"$",
"key",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'resname'",
",",
"$",
"key",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'restype'",
",",
"'x-eggs-n-cereal-field'",
")",
";",
"//escape named html entities prior to conversion",
"$",
"list",
"=",
"get_html_translation_table",
"(",
"HTML_ENTITIES",
")",
";",
"$",
"namedTable",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"list",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"namedTable",
"[",
"$",
"v",
"]",
"=",
"\"&\"",
".",
"str_replace",
"(",
"'&'",
",",
"''",
",",
"$",
"v",
")",
";",
"}",
"$",
"element",
"[",
"'#text'",
"]",
"=",
"strtr",
"(",
"$",
"element",
"[",
"'#text'",
"]",
",",
"$",
"namedTable",
")",
";",
"try",
"{",
"$",
"converter",
"=",
"new",
"Converter",
"(",
"$",
"element",
"[",
"'#text'",
"]",
",",
"$",
"this",
"->",
"sourceLang",
",",
"$",
"targetLang",
")",
";",
"if",
"(",
"$",
"this",
"->",
"logger",
")",
"{",
"$",
"converter",
"->",
"setLogger",
"(",
"$",
"this",
"->",
"logger",
")",
";",
"}",
"$",
"this",
"->",
"writeRaw",
"(",
"$",
"converter",
"->",
"toXLIFF",
"(",
")",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"startElement",
"(",
"'trans-unit'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'id'",
",",
"uniqid",
"(",
"'text-'",
")",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'restype'",
",",
"'x-eggs-n-cereal-failure'",
")",
";",
"$",
"this",
"->",
"startElement",
"(",
"'source'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'xml:lang'",
",",
"$",
"this",
"->",
"sourceLang",
")",
";",
"$",
"this",
"->",
"text",
"(",
"$",
"element",
"[",
"'#text'",
"]",
")",
";",
"$",
"this",
"->",
"endElement",
"(",
")",
";",
"$",
"this",
"->",
"startElement",
"(",
"'target'",
")",
";",
"$",
"this",
"->",
"writeAttribute",
"(",
"'xml:lang'",
",",
"$",
"targetLang",
")",
";",
"$",
"this",
"->",
"text",
"(",
"$",
"element",
"[",
"'#text'",
"]",
")",
";",
"$",
"this",
"->",
"endElement",
"(",
")",
";",
"$",
"this",
"->",
"endElement",
"(",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"element",
"[",
"'#label'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"writeElement",
"(",
"'note'",
",",
"$",
"element",
"[",
"'#label'",
"]",
")",
";",
"}",
"$",
"this",
"->",
"endElement",
"(",
")",
";",
"}"
]
| Adds a single translation unit for a data element.
@param string $key
The unique identifier for this data element.
@param string $element
An element array with the following properties:
- #text: The text string to be translated.
- #label: (Optional) Label, intended for translators, that provides more
context around the translated string.
@param string $targetLang
The target language of the translatable.
@return string
The generated XML. | [
"Adds",
"a",
"single",
"translation",
"unit",
"for",
"a",
"data",
"element",
"."
]
| 778b83ddae1dd687724a84545ce8afa1a31e4bcf | https://github.com/tableau-mkt/eggs-n-cereal/blob/778b83ddae1dd687724a84545ce8afa1a31e4bcf/src/Serializer.php#L226-L266 |
19,098 | tableau-mkt/eggs-n-cereal | src/Serializer.php | Serializer.serializerSimplexmlLoadString | public function serializerSimplexmlLoadString($xmlString){
$numericTable = array();
//commonly present restricted characters that can safely be replaced
$numericTable['&'] = '&';
$entBitmask = defined('ENT_HTML5') ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
$trans = get_html_translation_table(HTML_ENTITIES, $entBitmask);
foreach ($trans as $k=>$v){
$numericTable[$v]= "&#".ord($k).";";
}
$xmlString = strtr($xmlString, $numericTable);
return simplexml_load_string($xmlString);
} | php | public function serializerSimplexmlLoadString($xmlString){
$numericTable = array();
//commonly present restricted characters that can safely be replaced
$numericTable['&'] = '&';
$entBitmask = defined('ENT_HTML5') ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
$trans = get_html_translation_table(HTML_ENTITIES, $entBitmask);
foreach ($trans as $k=>$v){
$numericTable[$v]= "&#".ord($k).";";
}
$xmlString = strtr($xmlString, $numericTable);
return simplexml_load_string($xmlString);
} | [
"public",
"function",
"serializerSimplexmlLoadString",
"(",
"$",
"xmlString",
")",
"{",
"$",
"numericTable",
"=",
"array",
"(",
")",
";",
"//commonly present restricted characters that can safely be replaced",
"$",
"numericTable",
"[",
"'&'",
"]",
"=",
"'&'",
";",
"$",
"entBitmask",
"=",
"defined",
"(",
"'ENT_HTML5'",
")",
"?",
"ENT_QUOTES",
"|",
"ENT_HTML5",
":",
"ENT_QUOTES",
";",
"$",
"trans",
"=",
"get_html_translation_table",
"(",
"HTML_ENTITIES",
",",
"$",
"entBitmask",
")",
";",
"foreach",
"(",
"$",
"trans",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"numericTable",
"[",
"$",
"v",
"]",
"=",
"\"&#\"",
".",
"ord",
"(",
"$",
"k",
")",
".",
"\";\"",
";",
"}",
"$",
"xmlString",
"=",
"strtr",
"(",
"$",
"xmlString",
",",
"$",
"numericTable",
")",
";",
"return",
"simplexml_load_string",
"(",
"$",
"xmlString",
")",
";",
"}"
]
| Converts xml to string and handles entity encoding.
@param string $xmlString
The xml string to convert to xml.
@return \SimpleXMLElement
Returns SimpleXml element | [
"Converts",
"xml",
"to",
"string",
"and",
"handles",
"entity",
"encoding",
"."
]
| 778b83ddae1dd687724a84545ce8afa1a31e4bcf | https://github.com/tableau-mkt/eggs-n-cereal/blob/778b83ddae1dd687724a84545ce8afa1a31e4bcf/src/Serializer.php#L346-L357 |
19,099 | tableau-mkt/eggs-n-cereal | src/Serializer.php | Serializer.validateImport | public function validateImport(TranslatableInterface $translatable, $targetLang, $xmlString) {
$xmlString = Converter::filterXmlControlCharacters($xmlString);
$error = $this->errorStart();
// XML does not support most named HTML entities (eg, ), but should be
// able to handle the UTF-8 uncoded entity characters just fine.
$xml = $this->serializerSimplexmlLoadString($xmlString);
$this->errorStop($error);
if (!$xml) {
return FALSE;
}
$errorArgs = array(
'%lang' => $targetLang,
'%srclang' => $this->sourceLang,
'%name' => $translatable->getLabel(),
'%id' => $translatable->getIdentifier(),
);
// Check if our phase information is there.
$phase = $xml->xpath("//phase[@phase-name='extraction']");
if ($phase) {
$phase = reset($phase);
}
else {
$this->log(LogLevel::ERROR, 'Phase missing from XML.', $errorArgs);
return FALSE;
}
// Check if the project can be loaded.
if (!isset($phase['job-id']) || ($translatable->getIdentifier() != (string) $phase['job-id'])) {
$this->log(LogLevel::ERROR, 'The project id is missing in the XML.', $errorArgs);
return FALSE;
}
elseif ($translatable->getIdentifier() != (string) $phase['job-id']) {
$this->log(LogLevel::ERROR, 'The project id is invalid in the XML. Correct id: %id.', $errorArgs);
return FALSE;
}
// Compare source language.
if (!isset($xml->file['source-language'])) {
$this->log(LogLevel::ERROR, 'The source language is missing in the XML.', $errorArgs);
return FALSE;
}
elseif ($xml->file['source-language'] != $this->sourceLang) {
$this->log(LogLevel::ERROR, 'The source language is invalid in the XML. Correct langcode: %srclang.', $errorArgs);
return FALSE;
}
// Compare target language.
if (!isset($xml->file['target-language'])) {
$this->log(LogLevel::ERROR, 'The target language is missing in the XML.', $errorArgs);
return FALSE;
}
elseif ($targetLang != Data::normalizeLangcode($xml->file['target-language'])) {
$errorArgs['%wrong'] = $xml->file['target-language'];
$this->log(LogLevel::ERROR, 'The target language %wrong is invalid in the XML. Correct langcode: %lang.', $errorArgs);
return FALSE;
}
// Validation successful.
return TRUE;
} | php | public function validateImport(TranslatableInterface $translatable, $targetLang, $xmlString) {
$xmlString = Converter::filterXmlControlCharacters($xmlString);
$error = $this->errorStart();
// XML does not support most named HTML entities (eg, ), but should be
// able to handle the UTF-8 uncoded entity characters just fine.
$xml = $this->serializerSimplexmlLoadString($xmlString);
$this->errorStop($error);
if (!$xml) {
return FALSE;
}
$errorArgs = array(
'%lang' => $targetLang,
'%srclang' => $this->sourceLang,
'%name' => $translatable->getLabel(),
'%id' => $translatable->getIdentifier(),
);
// Check if our phase information is there.
$phase = $xml->xpath("//phase[@phase-name='extraction']");
if ($phase) {
$phase = reset($phase);
}
else {
$this->log(LogLevel::ERROR, 'Phase missing from XML.', $errorArgs);
return FALSE;
}
// Check if the project can be loaded.
if (!isset($phase['job-id']) || ($translatable->getIdentifier() != (string) $phase['job-id'])) {
$this->log(LogLevel::ERROR, 'The project id is missing in the XML.', $errorArgs);
return FALSE;
}
elseif ($translatable->getIdentifier() != (string) $phase['job-id']) {
$this->log(LogLevel::ERROR, 'The project id is invalid in the XML. Correct id: %id.', $errorArgs);
return FALSE;
}
// Compare source language.
if (!isset($xml->file['source-language'])) {
$this->log(LogLevel::ERROR, 'The source language is missing in the XML.', $errorArgs);
return FALSE;
}
elseif ($xml->file['source-language'] != $this->sourceLang) {
$this->log(LogLevel::ERROR, 'The source language is invalid in the XML. Correct langcode: %srclang.', $errorArgs);
return FALSE;
}
// Compare target language.
if (!isset($xml->file['target-language'])) {
$this->log(LogLevel::ERROR, 'The target language is missing in the XML.', $errorArgs);
return FALSE;
}
elseif ($targetLang != Data::normalizeLangcode($xml->file['target-language'])) {
$errorArgs['%wrong'] = $xml->file['target-language'];
$this->log(LogLevel::ERROR, 'The target language %wrong is invalid in the XML. Correct langcode: %lang.', $errorArgs);
return FALSE;
}
// Validation successful.
return TRUE;
} | [
"public",
"function",
"validateImport",
"(",
"TranslatableInterface",
"$",
"translatable",
",",
"$",
"targetLang",
",",
"$",
"xmlString",
")",
"{",
"$",
"xmlString",
"=",
"Converter",
"::",
"filterXmlControlCharacters",
"(",
"$",
"xmlString",
")",
";",
"$",
"error",
"=",
"$",
"this",
"->",
"errorStart",
"(",
")",
";",
"// XML does not support most named HTML entities (eg, ), but should be",
"// able to handle the UTF-8 uncoded entity characters just fine.",
"$",
"xml",
"=",
"$",
"this",
"->",
"serializerSimplexmlLoadString",
"(",
"$",
"xmlString",
")",
";",
"$",
"this",
"->",
"errorStop",
"(",
"$",
"error",
")",
";",
"if",
"(",
"!",
"$",
"xml",
")",
"{",
"return",
"FALSE",
";",
"}",
"$",
"errorArgs",
"=",
"array",
"(",
"'%lang'",
"=>",
"$",
"targetLang",
",",
"'%srclang'",
"=>",
"$",
"this",
"->",
"sourceLang",
",",
"'%name'",
"=>",
"$",
"translatable",
"->",
"getLabel",
"(",
")",
",",
"'%id'",
"=>",
"$",
"translatable",
"->",
"getIdentifier",
"(",
")",
",",
")",
";",
"// Check if our phase information is there.",
"$",
"phase",
"=",
"$",
"xml",
"->",
"xpath",
"(",
"\"//phase[@phase-name='extraction']\"",
")",
";",
"if",
"(",
"$",
"phase",
")",
"{",
"$",
"phase",
"=",
"reset",
"(",
"$",
"phase",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"ERROR",
",",
"'Phase missing from XML.'",
",",
"$",
"errorArgs",
")",
";",
"return",
"FALSE",
";",
"}",
"// Check if the project can be loaded.",
"if",
"(",
"!",
"isset",
"(",
"$",
"phase",
"[",
"'job-id'",
"]",
")",
"||",
"(",
"$",
"translatable",
"->",
"getIdentifier",
"(",
")",
"!=",
"(",
"string",
")",
"$",
"phase",
"[",
"'job-id'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"ERROR",
",",
"'The project id is missing in the XML.'",
",",
"$",
"errorArgs",
")",
";",
"return",
"FALSE",
";",
"}",
"elseif",
"(",
"$",
"translatable",
"->",
"getIdentifier",
"(",
")",
"!=",
"(",
"string",
")",
"$",
"phase",
"[",
"'job-id'",
"]",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"ERROR",
",",
"'The project id is invalid in the XML. Correct id: %id.'",
",",
"$",
"errorArgs",
")",
";",
"return",
"FALSE",
";",
"}",
"// Compare source language.",
"if",
"(",
"!",
"isset",
"(",
"$",
"xml",
"->",
"file",
"[",
"'source-language'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"ERROR",
",",
"'The source language is missing in the XML.'",
",",
"$",
"errorArgs",
")",
";",
"return",
"FALSE",
";",
"}",
"elseif",
"(",
"$",
"xml",
"->",
"file",
"[",
"'source-language'",
"]",
"!=",
"$",
"this",
"->",
"sourceLang",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"ERROR",
",",
"'The source language is invalid in the XML. Correct langcode: %srclang.'",
",",
"$",
"errorArgs",
")",
";",
"return",
"FALSE",
";",
"}",
"// Compare target language.",
"if",
"(",
"!",
"isset",
"(",
"$",
"xml",
"->",
"file",
"[",
"'target-language'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"ERROR",
",",
"'The target language is missing in the XML.'",
",",
"$",
"errorArgs",
")",
";",
"return",
"FALSE",
";",
"}",
"elseif",
"(",
"$",
"targetLang",
"!=",
"Data",
"::",
"normalizeLangcode",
"(",
"$",
"xml",
"->",
"file",
"[",
"'target-language'",
"]",
")",
")",
"{",
"$",
"errorArgs",
"[",
"'%wrong'",
"]",
"=",
"$",
"xml",
"->",
"file",
"[",
"'target-language'",
"]",
";",
"$",
"this",
"->",
"log",
"(",
"LogLevel",
"::",
"ERROR",
",",
"'The target language %wrong is invalid in the XML. Correct langcode: %lang.'",
",",
"$",
"errorArgs",
")",
";",
"return",
"FALSE",
";",
"}",
"// Validation successful.",
"return",
"TRUE",
";",
"}"
]
| Validates an import.
@param TranslatableInterface $translatable
A translatable object.
@param string $targetLang
The target language for this translatable.
@param string $xmlString
The XLIFF data as a string to validate.
@return bool
Returns TRUE on success or FALSE on failure. | [
"Validates",
"an",
"import",
"."
]
| 778b83ddae1dd687724a84545ce8afa1a31e4bcf | https://github.com/tableau-mkt/eggs-n-cereal/blob/778b83ddae1dd687724a84545ce8afa1a31e4bcf/src/Serializer.php#L372-L437 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.