repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
christophe-brachet/aspi-framework | src/Framework/Form/Fieldset.php | Fieldset.prepare | public function prepare()
{
if (!empty($this->legend)) {
$this->addChild(new Child('legend', $this->legend));
}
switch ($this->container) {
case 'table':
foreach ($this->fields as $fields) {
$table = new Child('table');
... | php | public function prepare()
{
if (!empty($this->legend)) {
$this->addChild(new Child('legend', $this->legend));
}
switch ($this->container) {
case 'table':
foreach ($this->fields as $fields) {
$table = new Child('table');
... | [
"public",
"function",
"prepare",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"legend",
")",
")",
"{",
"$",
"this",
"->",
"addChild",
"(",
"new",
"Child",
"(",
"'legend'",
",",
"$",
"this",
"->",
"legend",
")",
")",
";",
"}",
... | Prepare fieldset object for rendering
@return Fieldset | [
"Prepare",
"fieldset",
"object",
"for",
"rendering"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L370-L523 |
christophe-brachet/aspi-framework | src/Framework/Form/Fieldset.php | Fieldset.prepareForView | public function prepareForView()
{
$fields = [];
foreach ($this->fields as $groups) {
foreach ($groups as $field) {
if (null !== $field->getLabel()) {
$labelFor = $field->getName() . (($field->getNodeName() == 'fieldset') ? '1' : '');
... | php | public function prepareForView()
{
$fields = [];
foreach ($this->fields as $groups) {
foreach ($groups as $field) {
if (null !== $field->getLabel()) {
$labelFor = $field->getName() . (($field->getNodeName() == 'fieldset') ? '1' : '');
... | [
"public",
"function",
"prepareForView",
"(",
")",
"{",
"$",
"fields",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"groups",
")",
"{",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"null",
... | Prepare fieldset elements for rendering with a view
@return array | [
"Prepare",
"fieldset",
"elements",
"for",
"rendering",
"with",
"a",
"view"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Fieldset.php#L529-L564 |
taskforcedev/laravel-support | src/Helpers/User.php | User.getUserModel | public function getUserModel()
{
/* Check the app's auth config, first */
$model = Config::get('auth.model');
if (class_exists($model)) {
return $model;
}
/* That didn't work, so let's try our fallback. First get the namespace */
$ns = $this->getAppNamesp... | php | public function getUserModel()
{
/* Check the app's auth config, first */
$model = Config::get('auth.model');
if (class_exists($model)) {
return $model;
}
/* That didn't work, so let's try our fallback. First get the namespace */
$ns = $this->getAppNamesp... | [
"public",
"function",
"getUserModel",
"(",
")",
"{",
"/* Check the app's auth config, first */",
"$",
"model",
"=",
"Config",
"::",
"get",
"(",
"'auth.model'",
")",
";",
"if",
"(",
"class_exists",
"(",
"$",
"model",
")",
")",
"{",
"return",
"$",
"model",
";"... | Gets the user model if found.
@return bool|string | [
"Gets",
"the",
"user",
"model",
"if",
"found",
"."
] | train | https://github.com/taskforcedev/laravel-support/blob/fdfa90ca10ffd57bc6f7aca20d2f3db7dc259221/src/Helpers/User.php#L15-L37 |
taskforcedev/laravel-support | src/Helpers/User.php | User.createGuest | public function createGuest()
{
/* Get the namespace */
$model = $this->getUserModel();
if ($model) {
$guest = new $model();
$guest->name = 'Guest';
$guest->email = 'guest@example.com';
} else {
$guest = (object)['name' => 'Guest', 'ema... | php | public function createGuest()
{
/* Get the namespace */
$model = $this->getUserModel();
if ($model) {
$guest = new $model();
$guest->name = 'Guest';
$guest->email = 'guest@example.com';
} else {
$guest = (object)['name' => 'Guest', 'ema... | [
"public",
"function",
"createGuest",
"(",
")",
"{",
"/* Get the namespace */",
"$",
"model",
"=",
"$",
"this",
"->",
"getUserModel",
"(",
")",
";",
"if",
"(",
"$",
"model",
")",
"{",
"$",
"guest",
"=",
"new",
"$",
"model",
"(",
")",
";",
"$",
"guest"... | Return an instance of a guest user, uses user model if exists.
@return object | [
"Return",
"an",
"instance",
"of",
"a",
"guest",
"user",
"uses",
"user",
"model",
"if",
"exists",
"."
] | train | https://github.com/taskforcedev/laravel-support/blob/fdfa90ca10ffd57bc6f7aca20d2f3db7dc259221/src/Helpers/User.php#L52-L64 |
taskforcedev/laravel-support | src/Helpers/User.php | User.canAdministrate | public function canAdministrate()
{
$user = $this->getUser();
if ($user->name == 'Guest' && $user->email == 'guest@example.com') {
return false;
}
if (method_exists($user, 'isAdmin')) {
return $user->isAdmin();
}
if (method_exists($user, 'can')... | php | public function canAdministrate()
{
$user = $this->getUser();
if ($user->name == 'Guest' && $user->email == 'guest@example.com') {
return false;
}
if (method_exists($user, 'isAdmin')) {
return $user->isAdmin();
}
if (method_exists($user, 'can')... | [
"public",
"function",
"canAdministrate",
"(",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
")",
";",
"if",
"(",
"$",
"user",
"->",
"name",
"==",
"'Guest'",
"&&",
"$",
"user",
"->",
"email",
"==",
"'guest@example.com'",
")",
"{",
"re... | Determine if the user is an administrator using methods on the user model (if found).
@return bool | [
"Determine",
"if",
"the",
"user",
"is",
"an",
"administrator",
"using",
"methods",
"on",
"the",
"user",
"model",
"(",
"if",
"found",
")",
"."
] | train | https://github.com/taskforcedev/laravel-support/blob/fdfa90ca10ffd57bc6f7aca20d2f3db7dc259221/src/Helpers/User.php#L70-L84 |
cbednarski/pharcc | src/cbednarski/Pharcc/Git.php | Git.getVersion | public static function getVersion($path, $strict = false)
{
$version = 'unknown';
$temp_path = getcwd();
// Git needs the cwd to be inside the repo
// proc_open will pick this up automatically
chdir($path);
// multi-level exit loop
do {
$descrip... | php | public static function getVersion($path, $strict = false)
{
$version = 'unknown';
$temp_path = getcwd();
// Git needs the cwd to be inside the repo
// proc_open will pick this up automatically
chdir($path);
// multi-level exit loop
do {
$descrip... | [
"public",
"static",
"function",
"getVersion",
"(",
"$",
"path",
",",
"$",
"strict",
"=",
"false",
")",
"{",
"$",
"version",
"=",
"'unknown'",
";",
"$",
"temp_path",
"=",
"getcwd",
"(",
")",
";",
"// Git needs the cwd to be inside the repo",
"// proc_open will pi... | Determine the git version based on `git describe` and semver conventions.
@see http://semver.org/
@see https://www.kernel.org/pub/software/scm/git/docs/git-describe.html
Normally we'll pull a version number like:
1.0.4 Tagged commit
1.0.4+306 Untagged commit on top of a tag
If the strict param is true, we will... | [
"Determine",
"the",
"git",
"version",
"based",
"on",
"git",
"describe",
"and",
"semver",
"conventions",
"."
] | train | https://github.com/cbednarski/pharcc/blob/562f9d3d13d2856de6a7ca846a83fe70897baaea/src/cbednarski/Pharcc/Git.php#L23-L73 |
fetus-hina/docomo-dialogue | src/Dialogue.php | Dialogue.request | public function request()
{
$reqUrl = sprintf('%s?APIKEY=%s', self::END_POINT_URL, rawurlencode($this->apikey));
$reqBody = json_encode($this->getParameter()->makeParameter());
$curl = new Curl();
$curl->setHeader('Content-Type', 'application/json; charset=UTF-8');
$ret = $c... | php | public function request()
{
$reqUrl = sprintf('%s?APIKEY=%s', self::END_POINT_URL, rawurlencode($this->apikey));
$reqBody = json_encode($this->getParameter()->makeParameter());
$curl = new Curl();
$curl->setHeader('Content-Type', 'application/json; charset=UTF-8');
$ret = $c... | [
"public",
"function",
"request",
"(",
")",
"{",
"$",
"reqUrl",
"=",
"sprintf",
"(",
"'%s?APIKEY=%s'",
",",
"self",
"::",
"END_POINT_URL",
",",
"rawurlencode",
"(",
"$",
"this",
"->",
"apikey",
")",
")",
";",
"$",
"reqBody",
"=",
"json_encode",
"(",
"$",
... | docomoへリクエストを送信し、対話内容を得る
@return Response|false | [
"docomoへリクエストを送信し、対話内容を得る"
] | train | https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/Dialogue.php#L75-L88 |
f3ath/appnexusclient | src/ArrayTokenStorage.php | ArrayTokenStorage.get | public function get($username)
{
return isset($this->storage[$username]) ? $this->storage[$username] : false;
} | php | public function get($username)
{
return isset($this->storage[$username]) ? $this->storage[$username] : false;
} | [
"public",
"function",
"get",
"(",
"$",
"username",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"storage",
"[",
"$",
"username",
"]",
")",
"?",
"$",
"this",
"->",
"storage",
"[",
"$",
"username",
"]",
":",
"false",
";",
"}"
] | get token
@param string $username
@return string|false | [
"get",
"token"
] | train | https://github.com/f3ath/appnexusclient/blob/cfe3f3a98a9c2883484154c8997c7459b1504742/src/ArrayTokenStorage.php#L33-L36 |
DevGroup-ru/yii2-data-structure-tools | src/behaviors/HasProperties.php | HasProperties.afterFind | public function afterFind()
{
if ($this->autoFetchProperties === true) {
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
$owner = $this->owner;
$owner->ensurePropertyGroupIds();
$models = [&$owner];
Properti... | php | public function afterFind()
{
if ($this->autoFetchProperties === true) {
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
$owner = $this->owner;
$owner->ensurePropertyGroupIds();
$models = [&$owner];
Properti... | [
"public",
"function",
"afterFind",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"autoFetchProperties",
"===",
"true",
")",
"{",
"/** @var \\yii\\db\\ActiveRecord|\\DevGroup\\DataStructure\\traits\\PropertiesTrait $owner */",
"$",
"owner",
"=",
"$",
"this",
"->",
"owner"... | Performs auto fetching properties if it is turned on
@return bool | [
"Performs",
"auto",
"fetching",
"properties",
"if",
"it",
"is",
"turned",
"on"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/behaviors/HasProperties.php#L59-L71 |
DevGroup-ru/yii2-data-structure-tools | src/behaviors/HasProperties.php | HasProperties.beforeDelete | public function beforeDelete()
{
// properties assigned to this record
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
$owner = $this->owner;
$event = new HasPropertiesEvent();
$event->model = $owner;
HasPropertiesEvent::trigger(... | php | public function beforeDelete()
{
// properties assigned to this record
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
$owner = $this->owner;
$event = new HasPropertiesEvent();
$event->model = $owner;
HasPropertiesEvent::trigger(... | [
"public",
"function",
"beforeDelete",
"(",
")",
"{",
"// properties assigned to this record",
"/** @var \\yii\\db\\ActiveRecord|\\DevGroup\\DataStructure\\traits\\PropertiesTrait $owner */",
"$",
"owner",
"=",
"$",
"this",
"->",
"owner",
";",
"$",
"event",
"=",
"new",
"HasPro... | Deletes related properties from database
@return bool | [
"Deletes",
"related",
"properties",
"from",
"database"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/behaviors/HasProperties.php#L77-L91 |
DevGroup-ru/yii2-data-structure-tools | src/behaviors/HasProperties.php | HasProperties.hasPropertyKey | public function hasPropertyKey($key)
{
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
$owner = $this->owner;
$owner->ensurePropertiesAttributes();
return in_array($key, $owner->propertiesAttributes);
} | php | public function hasPropertyKey($key)
{
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
$owner = $this->owner;
$owner->ensurePropertiesAttributes();
return in_array($key, $owner->propertiesAttributes);
} | [
"public",
"function",
"hasPropertyKey",
"(",
"$",
"key",
")",
"{",
"/** @var \\yii\\db\\ActiveRecord|\\DevGroup\\DataStructure\\traits\\PropertiesTrait $owner */",
"$",
"owner",
"=",
"$",
"this",
"->",
"owner",
";",
"$",
"owner",
"->",
"ensurePropertiesAttributes",
"(",
"... | Returns if property is binded to model
@param string $key
@return bool | [
"Returns",
"if",
"property",
"is",
"binded",
"to",
"model"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/behaviors/HasProperties.php#L98-L104 |
DevGroup-ru/yii2-data-structure-tools | src/behaviors/HasProperties.php | HasProperties.canGetProperty | public function canGetProperty($name, $checkVars = true)
{
if (property_exists($this, $name)) {
return true;
}
if ($this->hasPropertyKey($name)) {
return true;
}
return parent::canGetProperty($name, $checkVars);
} | php | public function canGetProperty($name, $checkVars = true)
{
if (property_exists($this, $name)) {
return true;
}
if ($this->hasPropertyKey($name)) {
return true;
}
return parent::canGetProperty($name, $checkVars);
} | [
"public",
"function",
"canGetProperty",
"(",
"$",
"name",
",",
"$",
"checkVars",
"=",
"true",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"$",
"name",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"hasP... | Checks if property can be read(binded to model)
@param string $name
@param bool|true $checkVars
@return bool | [
"Checks",
"if",
"property",
"can",
"be",
"read",
"(",
"binded",
"to",
"model",
")"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/behaviors/HasProperties.php#L112-L122 |
DevGroup-ru/yii2-data-structure-tools | src/behaviors/HasProperties.php | HasProperties.canSetProperty | public function canSetProperty($name, $checkVars = true)
{
if (property_exists($this, $name)) {
return true;
}
if ($this->hasPropertyKey($name)) {
return true;
}
return parent::canSetProperty($name, $checkVars);
} | php | public function canSetProperty($name, $checkVars = true)
{
if (property_exists($this, $name)) {
return true;
}
if ($this->hasPropertyKey($name)) {
return true;
}
return parent::canSetProperty($name, $checkVars);
} | [
"public",
"function",
"canSetProperty",
"(",
"$",
"name",
",",
"$",
"checkVars",
"=",
"true",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",",
"$",
"name",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"hasP... | Checks if property can be written(binded to model)
@param string $name
@param bool|true $checkVars
@return bool | [
"Checks",
"if",
"property",
"can",
"be",
"written",
"(",
"binded",
"to",
"model",
")"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/behaviors/HasProperties.php#L130-L140 |
DevGroup-ru/yii2-data-structure-tools | src/behaviors/HasProperties.php | HasProperties.afterInsert | public function afterInsert()
{
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
$owner = $this->owner;
$groups = $owner->propertyGroupIds;
$owner->propertyGroupIds = null;
$event = new HasPropertiesEvent();
$event->model = $owner... | php | public function afterInsert()
{
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
$owner = $this->owner;
$groups = $owner->propertyGroupIds;
$owner->propertyGroupIds = null;
$event = new HasPropertiesEvent();
$event->model = $owner... | [
"public",
"function",
"afterInsert",
"(",
")",
"{",
"/** @var \\yii\\db\\ActiveRecord|\\DevGroup\\DataStructure\\traits\\PropertiesTrait $owner */",
"$",
"owner",
"=",
"$",
"this",
"->",
"owner",
";",
"$",
"groups",
"=",
"$",
"owner",
"->",
"propertyGroupIds",
";",
"$",... | Performs after insert stuff | [
"Performs",
"after",
"insert",
"stuff"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/behaviors/HasProperties.php#L194-L219 |
DevGroup-ru/yii2-data-structure-tools | src/behaviors/HasProperties.php | HasProperties.afterSave | public function afterSave()
{
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
$owner = $this->owner;
$event = new HasPropertiesEvent();
$event->model = $owner;
HasPropertiesEvent::trigger(self::class, self::EVENT_AFTER_UPDATE, $event);
... | php | public function afterSave()
{
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $owner */
$owner = $this->owner;
$event = new HasPropertiesEvent();
$event->model = $owner;
HasPropertiesEvent::trigger(self::class, self::EVENT_AFTER_UPDATE, $event);
... | [
"public",
"function",
"afterSave",
"(",
")",
"{",
"/** @var \\yii\\db\\ActiveRecord|\\DevGroup\\DataStructure\\traits\\PropertiesTrait $owner */",
"$",
"owner",
"=",
"$",
"this",
"->",
"owner",
";",
"$",
"event",
"=",
"new",
"HasPropertiesEvent",
"(",
")",
";",
"$",
"... | Performs after save stuff:
- saves dirty properties
- clears states of dirty properties | [
"Performs",
"after",
"save",
"stuff",
":",
"-",
"saves",
"dirty",
"properties",
"-",
"clears",
"states",
"of",
"dirty",
"properties"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/behaviors/HasProperties.php#L226-L260 |
dphn/ScContent | src/ScContent/Controller/Back/ContentManagerController.php | ContentManagerController.indexAction | public function indexAction()
{
$optionsProvider = $this->getOptionsProvider();
if ($this->getRequest()->isPost()) {
$event = $this->request->getPost('suboperation');
if (! empty($event)) {
$events = $this->getEventManager();
$params = $this->r... | php | public function indexAction()
{
$optionsProvider = $this->getOptionsProvider();
if ($this->getRequest()->isPost()) {
$event = $this->request->getPost('suboperation');
if (! empty($event)) {
$events = $this->getEventManager();
$params = $this->r... | [
"public",
"function",
"indexAction",
"(",
")",
"{",
"$",
"optionsProvider",
"=",
"$",
"this",
"->",
"getOptionsProvider",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"isPost",
"(",
")",
")",
"{",
"$",
"event",
"=",
"$",... | Show content list.
@return \Zend\Stdlib\ResponseInterface|\Zend\View\Model\ViewModel | [
"Show",
"content",
"list",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Controller/Back/ContentManagerController.php#L45-L72 |
dphn/ScContent | src/ScContent/Controller/Back/ContentManagerController.php | ContentManagerController.searchAction | public function searchAction()
{
$optionsProvider = $this->getOptionsProvider();
$pane = $this->params()->fromRoute('pane');
if (! $pane || ! $optionsProvider->hasIdentifier($pane)) {
$pane = 'first';
}
$options = $optionsProvider->getOptions($pane, 'search');
... | php | public function searchAction()
{
$optionsProvider = $this->getOptionsProvider();
$pane = $this->params()->fromRoute('pane');
if (! $pane || ! $optionsProvider->hasIdentifier($pane)) {
$pane = 'first';
}
$options = $optionsProvider->getOptions($pane, 'search');
... | [
"public",
"function",
"searchAction",
"(",
")",
"{",
"$",
"optionsProvider",
"=",
"$",
"this",
"->",
"getOptionsProvider",
"(",
")",
";",
"$",
"pane",
"=",
"$",
"this",
"->",
"params",
"(",
")",
"->",
"fromRoute",
"(",
"'pane'",
")",
";",
"if",
"(",
... | Show search options.
@return \Zend\View\Model\ViewModel | [
"Show",
"search",
"options",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Controller/Back/ContentManagerController.php#L79-L121 |
ahmad-sa3d/saad-image | src/Traits/EloquentPublicImageTrait.php | EloquentPublicImageTrait.deleteOldFor | public function deleteOldFor( $old, $path )
{
if( $old )
{
if( file_exists( $path . $old ) )
unlink( $path . $old );
$thumb_dir = $path . 'thumb' . DIRECTORY_SEPARATOR;
if( is_dir( $thumb_dir ) )
{
// get c... | php | public function deleteOldFor( $old, $path )
{
if( $old )
{
if( file_exists( $path . $old ) )
unlink( $path . $old );
$thumb_dir = $path . 'thumb' . DIRECTORY_SEPARATOR;
if( is_dir( $thumb_dir ) )
{
// get c... | [
"public",
"function",
"deleteOldFor",
"(",
"$",
"old",
",",
"$",
"path",
")",
"{",
"if",
"(",
"$",
"old",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
".",
"$",
"old",
")",
")",
"unlink",
"(",
"$",
"path",
".",
"$",
"old",
")",
";",
... | Delete Files ( Image and its thumbnails )
@param [type] $old [description]
@param [type] $path [description]
@return [type] [description] | [
"Delete",
"Files",
"(",
"Image",
"and",
"its",
"thumbnails",
")"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Traits/EloquentPublicImageTrait.php#L45-L68 |
markwatkinson/luminous | src/Luminous/Utils/ColorUtils.php | ColorUtils.hex2rgb | public static function hex2rgb($hex)
{
$x = hexdec(substr($hex, 1));
$b = $x % 256;
$g = ($x >> 8) % 256;
$r = ($x >> 16) % 256;
$rgb = array($r, $g, $b);
return $rgb;
} | php | public static function hex2rgb($hex)
{
$x = hexdec(substr($hex, 1));
$b = $x % 256;
$g = ($x >> 8) % 256;
$r = ($x >> 16) % 256;
$rgb = array($r, $g, $b);
return $rgb;
} | [
"public",
"static",
"function",
"hex2rgb",
"(",
"$",
"hex",
")",
"{",
"$",
"x",
"=",
"hexdec",
"(",
"substr",
"(",
"$",
"hex",
",",
"1",
")",
")",
";",
"$",
"b",
"=",
"$",
"x",
"%",
"256",
";",
"$",
"g",
"=",
"(",
"$",
"x",
">>",
"8",
")"... | Converts a hexadecimal string in the form #ABCDEF to an RGB array | [
"Converts",
"a",
"hexadecimal",
"string",
"in",
"the",
"form",
"#ABCDEF",
"to",
"an",
"RGB",
"array"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/ColorUtils.php#L12-L21 |
markwatkinson/luminous | src/Luminous/Utils/ColorUtils.php | ColorUtils.rgb2xyz | public static function rgb2xyz($rgb)
{
// Inverse sRGB Companding
$rgb = array_map(function ($n) {
if ($n <= 0.04045) {
return $n / 12.92;
}
return pow(($n + 0.055) / 1.055, 2.4);
}, $rgb);
// Linear RGB to XYZ
return array... | php | public static function rgb2xyz($rgb)
{
// Inverse sRGB Companding
$rgb = array_map(function ($n) {
if ($n <= 0.04045) {
return $n / 12.92;
}
return pow(($n + 0.055) / 1.055, 2.4);
}, $rgb);
// Linear RGB to XYZ
return array... | [
"public",
"static",
"function",
"rgb2xyz",
"(",
"$",
"rgb",
")",
"{",
"// Inverse sRGB Companding",
"$",
"rgb",
"=",
"array_map",
"(",
"function",
"(",
"$",
"n",
")",
"{",
"if",
"(",
"$",
"n",
"<=",
"0.04045",
")",
"{",
"return",
"$",
"n",
"/",
"12.9... | Converts an normalised RGB array to an XYZ array
Algorithm from http://www.brucelindbloom.com/Eqn_RGB_to_XYZ.html
It is assumed that the sRGB color space is used | [
"Converts",
"an",
"normalised",
"RGB",
"array",
"to",
"an",
"XYZ",
"array",
"Algorithm",
"from",
"http",
":",
"//",
"www",
".",
"brucelindbloom",
".",
"com",
"/",
"Eqn_RGB_to_XYZ",
".",
"html",
"It",
"is",
"assumed",
"that",
"the",
"sRGB",
"color",
"space"... | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/ColorUtils.php#L38-L54 |
markwatkinson/luminous | src/Luminous/Utils/ColorUtils.php | ColorUtils.xyz2lab | public static function xyz2lab($xyz)
{
$x = $xyz[0] / 0.95047;
$y = $xyz[1] / 1.00000;
$z = $xyz[2] / 1.08883;
$f = function ($n) {
if ($n > 0.008856) {
return pow($n, 1/3);
}
return (903.3 * $n + 16) / 116;
};
$fx ... | php | public static function xyz2lab($xyz)
{
$x = $xyz[0] / 0.95047;
$y = $xyz[1] / 1.00000;
$z = $xyz[2] / 1.08883;
$f = function ($n) {
if ($n > 0.008856) {
return pow($n, 1/3);
}
return (903.3 * $n + 16) / 116;
};
$fx ... | [
"public",
"static",
"function",
"xyz2lab",
"(",
"$",
"xyz",
")",
"{",
"$",
"x",
"=",
"$",
"xyz",
"[",
"0",
"]",
"/",
"0.95047",
";",
"$",
"y",
"=",
"$",
"xyz",
"[",
"1",
"]",
"/",
"1.00000",
";",
"$",
"z",
"=",
"$",
"xyz",
"[",
"2",
"]",
... | Converts an XYZ array to an Lab array
Algorithm from http://www.brucelindbloom.com/Eqn_XYZ_to_Lab.html
Reference whites from http://brucelindbloom.com/Eqn_ChromAdapt.html#CommonChromAdapt | [
"Converts",
"an",
"XYZ",
"array",
"to",
"an",
"Lab",
"array",
"Algorithm",
"from",
"http",
":",
"//",
"www",
".",
"brucelindbloom",
".",
"com",
"/",
"Eqn_XYZ_to_Lab",
".",
"html",
"Reference",
"whites",
"from",
"http",
":",
"//",
"brucelindbloom",
".",
"co... | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/ColorUtils.php#L61-L81 |
markwatkinson/luminous | src/Luminous/Utils/ColorUtils.php | ColorUtils.cie76 | public static function cie76($refLab, $lab)
{
return sqrt(
pow($refLab[0] - $lab[0], 2) +
pow($refLab[1] - $lab[1], 2) +
pow($refLab[2] - $lab[2], 2)
);
} | php | public static function cie76($refLab, $lab)
{
return sqrt(
pow($refLab[0] - $lab[0], 2) +
pow($refLab[1] - $lab[1], 2) +
pow($refLab[2] - $lab[2], 2)
);
} | [
"public",
"static",
"function",
"cie76",
"(",
"$",
"refLab",
",",
"$",
"lab",
")",
"{",
"return",
"sqrt",
"(",
"pow",
"(",
"$",
"refLab",
"[",
"0",
"]",
"-",
"$",
"lab",
"[",
"0",
"]",
",",
"2",
")",
"+",
"pow",
"(",
"$",
"refLab",
"[",
"1",
... | Calculates the distance between two colors using the CIE76 algorithm
Algorithm from http://www.brucelindbloom.com/Eqn_DeltaE_CIE76.html | [
"Calculates",
"the",
"distance",
"between",
"two",
"colors",
"using",
"the",
"CIE76",
"algorithm",
"Algorithm",
"from",
"http",
":",
"//",
"www",
".",
"brucelindbloom",
".",
"com",
"/",
"Eqn_DeltaE_CIE76",
".",
"html"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/ColorUtils.php#L87-L94 |
markwatkinson/luminous | src/Luminous/Utils/ColorUtils.php | ColorUtils.cie94 | public static function cie94($refLab, $lab)
{
$C1 = sqrt(pow($refLab[1], 2) + pow($refLab[2], 2));
$C2 = sqrt(pow($lab[1], 2) + pow($lab[2], 2));
$SL = 1;
$SC = 1 + 0.045 * $C1;
$SH = 1 + 0.015 * $C1;
$ΔL = $refLab[0] - $lab[0];
$ΔC = $C1 - $C2;
$Δa = ... | php | public static function cie94($refLab, $lab)
{
$C1 = sqrt(pow($refLab[1], 2) + pow($refLab[2], 2));
$C2 = sqrt(pow($lab[1], 2) + pow($lab[2], 2));
$SL = 1;
$SC = 1 + 0.045 * $C1;
$SH = 1 + 0.015 * $C1;
$ΔL = $refLab[0] - $lab[0];
$ΔC = $C1 - $C2;
$Δa = ... | [
"public",
"static",
"function",
"cie94",
"(",
"$",
"refLab",
",",
"$",
"lab",
")",
"{",
"$",
"C1",
"=",
"sqrt",
"(",
"pow",
"(",
"$",
"refLab",
"[",
"1",
"]",
",",
"2",
")",
"+",
"pow",
"(",
"$",
"refLab",
"[",
"2",
"]",
",",
"2",
")",
")",... | Calculates the distance between two colors using the CIE94 algorithm
Algorithm from http://www.brucelindbloom.com/Eqn_DeltaE_CIE94.html | [
"Calculates",
"the",
"distance",
"between",
"two",
"colors",
"using",
"the",
"CIE94",
"algorithm",
"Algorithm",
"from",
"http",
":",
"//",
"www",
".",
"brucelindbloom",
".",
"com",
"/",
"Eqn_DeltaE_CIE94",
".",
"html"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/ColorUtils.php#L100-L113 |
markwatkinson/luminous | src/Luminous/Utils/ColorUtils.php | ColorUtils.ciede2000 | public static function ciede2000($refLab, $lab)
{
$LP = ($refLab[0] + $lab[0]) / 2;
$C1 = sqrt(pow($refLab[1], 2) + pow($refLab[2], 2));
$C2 = sqrt(pow($lab[1], 2) + pow($lab[2], 2));
$C = ($C1 + $C2) / 2;
$G = (1 - sqrt(pow($C, 7) / (pow($C, 7) + 6103515625))) / 2;
$... | php | public static function ciede2000($refLab, $lab)
{
$LP = ($refLab[0] + $lab[0]) / 2;
$C1 = sqrt(pow($refLab[1], 2) + pow($refLab[2], 2));
$C2 = sqrt(pow($lab[1], 2) + pow($lab[2], 2));
$C = ($C1 + $C2) / 2;
$G = (1 - sqrt(pow($C, 7) / (pow($C, 7) + 6103515625))) / 2;
$... | [
"public",
"static",
"function",
"ciede2000",
"(",
"$",
"refLab",
",",
"$",
"lab",
")",
"{",
"$",
"LP",
"=",
"(",
"$",
"refLab",
"[",
"0",
"]",
"+",
"$",
"lab",
"[",
"0",
"]",
")",
"/",
"2",
";",
"$",
"C1",
"=",
"sqrt",
"(",
"pow",
"(",
"$",... | Calculates the distance between two colors using the CIEDE2000 algorithm
Algorithm from http://www.brucelindbloom.com/Eqn_DeltaE_CIE2000.html | [
"Calculates",
"the",
"distance",
"between",
"two",
"colors",
"using",
"the",
"CIEDE2000",
"algorithm",
"Algorithm",
"from",
"http",
":",
"//",
"www",
".",
"brucelindbloom",
".",
"com",
"/",
"Eqn_DeltaE_CIE2000",
".",
"html"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/ColorUtils.php#L119-L165 |
markwatkinson/luminous | src/Luminous/Utils/ColorUtils.php | ColorUtils.nearestColor | public static function nearestColor($refLabs, $lab, $algorithm, $returnArrayKey = false, $cacheKey = "")
{
// Calculating a unique cache key takes even longer than calculating the distance, so the caller needs to craft
// a cache key by hand
$subKey = $lab[0] . $lab[1] . $lab[2];
$re... | php | public static function nearestColor($refLabs, $lab, $algorithm, $returnArrayKey = false, $cacheKey = "")
{
// Calculating a unique cache key takes even longer than calculating the distance, so the caller needs to craft
// a cache key by hand
$subKey = $lab[0] . $lab[1] . $lab[2];
$re... | [
"public",
"static",
"function",
"nearestColor",
"(",
"$",
"refLabs",
",",
"$",
"lab",
",",
"$",
"algorithm",
",",
"$",
"returnArrayKey",
"=",
"false",
",",
"$",
"cacheKey",
"=",
"\"\"",
")",
"{",
"// Calculating a unique cache key takes even longer than calculating ... | Searches a list of colors for the one with the shortest distance to a given color | [
"Searches",
"a",
"list",
"of",
"colors",
"for",
"the",
"one",
"with",
"the",
"shortest",
"distance",
"to",
"a",
"given",
"color"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/ColorUtils.php#L170-L204 |
inpsyde/wp-db-tools | src/Factory/TableSchemaFactory.php | TableSchemaFactory.create_from_yaml | public function create_from_yaml( $yaml ) {
$definition = Yaml::parse( $yaml )[ 'table' ];
if ( array_key_exists( 'prefix', $definition ) ) {
$definition[ 'base_name' ] = $definition[ 'name' ];
$definition[ 'name' ] = $this->apply_prefix( $definition[ 'prefix' ], $definition[ 'name' ] );
unset( $definiti... | php | public function create_from_yaml( $yaml ) {
$definition = Yaml::parse( $yaml )[ 'table' ];
if ( array_key_exists( 'prefix', $definition ) ) {
$definition[ 'base_name' ] = $definition[ 'name' ];
$definition[ 'name' ] = $this->apply_prefix( $definition[ 'prefix' ], $definition[ 'name' ] );
unset( $definiti... | [
"public",
"function",
"create_from_yaml",
"(",
"$",
"yaml",
")",
"{",
"$",
"definition",
"=",
"Yaml",
"::",
"parse",
"(",
"$",
"yaml",
")",
"[",
"'table'",
"]",
";",
"if",
"(",
"array_key_exists",
"(",
"'prefix'",
",",
"$",
"definition",
")",
")",
"{",... | @param string $yaml
@return TableSchema | [
"@param",
"string",
"$yaml"
] | train | https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Factory/TableSchemaFactory.php#L34-L45 |
inpsyde/wp-db-tools | src/Factory/TableSchemaFactory.php | TableSchemaFactory.apply_prefix | private function apply_prefix( $prefix_type, $name ) {
switch( $prefix_type ) {
case 'network' :
return $this->network_prefix . $name;
case 'site' :
return $this->site_prefix . $name;
}
throw new InvalidTableSchema( "Unknown prefix type: {$prefix_type}" );
} | php | private function apply_prefix( $prefix_type, $name ) {
switch( $prefix_type ) {
case 'network' :
return $this->network_prefix . $name;
case 'site' :
return $this->site_prefix . $name;
}
throw new InvalidTableSchema( "Unknown prefix type: {$prefix_type}" );
} | [
"private",
"function",
"apply_prefix",
"(",
"$",
"prefix_type",
",",
"$",
"name",
")",
"{",
"switch",
"(",
"$",
"prefix_type",
")",
"{",
"case",
"'network'",
":",
"return",
"$",
"this",
"->",
"network_prefix",
".",
"$",
"name",
";",
"case",
"'site'",
":"... | @param $prefix_type
@param $name
@return string
@throws InvalidTableSchema | [
"@param",
"$prefix_type",
"@param",
"$name"
] | train | https://github.com/inpsyde/wp-db-tools/blob/f16f4a96e1e326733ab0ef940e2c9247b6285694/src/Factory/TableSchemaFactory.php#L87-L97 |
mimmi20/Wurfl | src/Handlers/KindleHandler.php | KindleHandler.applyConclusiveMatch | public function applyConclusiveMatch($userAgent)
{
// Desktop-mode Kindle Fire
// Kindle Fire 2nd Gen Desktop Mode has no android version (even though "Build/I...." tells us it's ICS):
// Mozilla/5.0 (Linux; U; en-us; KFOT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.0 Safari/... | php | public function applyConclusiveMatch($userAgent)
{
// Desktop-mode Kindle Fire
// Kindle Fire 2nd Gen Desktop Mode has no android version (even though "Build/I...." tells us it's ICS):
// Mozilla/5.0 (Linux; U; en-us; KFOT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/2.0 Safari/... | [
"public",
"function",
"applyConclusiveMatch",
"(",
"$",
"userAgent",
")",
"{",
"// Desktop-mode Kindle Fire",
"// Kindle Fire 2nd Gen Desktop Mode has no android version (even though \"Build/I....\" tells us it's ICS):",
"// Mozilla/5.0 (Linux; U; en-us; KFOT Build/IML74K) AppleWebKit/535.19 (KH... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/KindleHandler.php#L66-L102 |
mimmi20/Wurfl | src/Handlers/KindleHandler.php | KindleHandler.applyRecoveryMatch | public function applyRecoveryMatch($userAgent)
{
$map = array(
'Kindle/1' => 'amazon_kindle_ver1',
'Kindle/2' => 'amazon_kindle2_ver1',
'Kindle/3' => 'amazon_kindle3_ver1',
'Kindle Fire' => 'amazon_kindle_fire_ver1',
'Silk' => 'amaz... | php | public function applyRecoveryMatch($userAgent)
{
$map = array(
'Kindle/1' => 'amazon_kindle_ver1',
'Kindle/2' => 'amazon_kindle2_ver1',
'Kindle/3' => 'amazon_kindle3_ver1',
'Kindle Fire' => 'amazon_kindle_fire_ver1',
'Silk' => 'amaz... | [
"public",
"function",
"applyRecoveryMatch",
"(",
"$",
"userAgent",
")",
"{",
"$",
"map",
"=",
"array",
"(",
"'Kindle/1'",
"=>",
"'amazon_kindle_ver1'",
",",
"'Kindle/2'",
"=>",
"'amazon_kindle2_ver1'",
",",
"'Kindle/3'",
"=>",
"'amazon_kindle3_ver1'",
",",
"'Kindle ... | @param string $userAgent
@return string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/KindleHandler.php#L109-L126 |
Webklex/translator | src/Translator/Middleware/TranslatorMiddleware.php | TranslatorMiddleware.handle | public function handle($request, Closure $next, $guard = null)
{
if (Session::has('locale')) {
app()->setLocale(session()->get('locale'));
TranslatorFacade::setLocale(session()->get('locale'));
}
return $next($request);
} | php | public function handle($request, Closure $next, $guard = null)
{
if (Session::has('locale')) {
app()->setLocale(session()->get('locale'));
TranslatorFacade::setLocale(session()->get('locale'));
}
return $next($request);
} | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
",",
"$",
"guard",
"=",
"null",
")",
"{",
"if",
"(",
"Session",
"::",
"has",
"(",
"'locale'",
")",
")",
"{",
"app",
"(",
")",
"->",
"setLocale",
"(",
"session",
"(",
... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@param string|null $guard
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/Webklex/translator/blob/6bef2c68da1c05df7d759da8458037eee5203986/src/Translator/Middleware/TranslatorMiddleware.php#L30-L38 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ConfigSchema/Validator.php | HTMLPurifier_ConfigSchema_Validator.validateDirectiveAllowed | public function validateDirectiveAllowed($d) {
if (is_null($d->allowed)) return;
$this->with($d, 'allowed')
->assertNotEmpty()
->assertIsLookup(); // handled by InterchangeBuilder
if (is_string($d->default) && !isset($d->allowed[$d->default])) {
$this->error('... | php | public function validateDirectiveAllowed($d) {
if (is_null($d->allowed)) return;
$this->with($d, 'allowed')
->assertNotEmpty()
->assertIsLookup(); // handled by InterchangeBuilder
if (is_string($d->default) && !isset($d->allowed[$d->default])) {
$this->error('... | [
"public",
"function",
"validateDirectiveAllowed",
"(",
"$",
"d",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"d",
"->",
"allowed",
")",
")",
"return",
";",
"$",
"this",
"->",
"with",
"(",
"$",
"d",
",",
"'allowed'",
")",
"->",
"assertNotEmpty",
"(",
")... | Extra validation if $allowed member variable of
HTMLPurifier_ConfigSchema_Interchange_Directive is defined. | [
"Extra",
"validation",
"if",
"$allowed",
"member",
"variable",
"of",
"HTMLPurifier_ConfigSchema_Interchange_Directive",
"is",
"defined",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ConfigSchema/Validator.php#L112-L125 |
mimmi20/Wurfl | src/Handlers/FennecOnAndroidHandler.php | FennecOnAndroidHandler.applyRecoveryMatch | public function applyRecoveryMatch($userAgent)
{
$isFennec = Utils::checkIfContains($userAgent, 'Fennec');
$isFirefox = Utils::checkIfContains($userAgent, 'Firefox');
if ($isFennec || $isFirefox) {
if ($isFennec || Utils::checkIfContains($userAgent, 'Mobile')) {
... | php | public function applyRecoveryMatch($userAgent)
{
$isFennec = Utils::checkIfContains($userAgent, 'Fennec');
$isFirefox = Utils::checkIfContains($userAgent, 'Firefox');
if ($isFennec || $isFirefox) {
if ($isFennec || Utils::checkIfContains($userAgent, 'Mobile')) {
... | [
"public",
"function",
"applyRecoveryMatch",
"(",
"$",
"userAgent",
")",
"{",
"$",
"isFennec",
"=",
"Utils",
"::",
"checkIfContains",
"(",
"$",
"userAgent",
",",
"'Fennec'",
")",
";",
"$",
"isFirefox",
"=",
"Utils",
"::",
"checkIfContains",
"(",
"$",
"userAge... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/FennecOnAndroidHandler.php#L76-L96 |
wpup/digster | src/cache/class-wordpress-cache-adapter.php | WordPress_Cache_Adapter.fetch | public function fetch( $key ) {
$key = $this->get_key( $key );
return wp_cache_get( $key, $this->group );
} | php | public function fetch( $key ) {
$key = $this->get_key( $key );
return wp_cache_get( $key, $this->group );
} | [
"public",
"function",
"fetch",
"(",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"get_key",
"(",
"$",
"key",
")",
";",
"return",
"wp_cache_get",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"group",
")",
";",
"}"
] | Fetch cache data.
@param string $key
@return mixed | [
"Fetch",
"cache",
"data",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/cache/class-wordpress-cache-adapter.php#L45-L48 |
wpup/digster | src/cache/class-wordpress-cache-adapter.php | WordPress_Cache_Adapter.save | public function save( $key, $value, $expire = 0 ) {
$key = $this->get_key( $key );
wp_cache_set( $key, $value, $this->group, $expire );
} | php | public function save( $key, $value, $expire = 0 ) {
$key = $this->get_key( $key );
wp_cache_set( $key, $value, $this->group, $expire );
} | [
"public",
"function",
"save",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"expire",
"=",
"0",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"get_key",
"(",
"$",
"key",
")",
";",
"wp_cache_set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
... | Save cache data.
@param string $key
@param mixed $value
@param int $expire | [
"Save",
"cache",
"data",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/cache/class-wordpress-cache-adapter.php#L68-L71 |
javihgil/doctrine-pagination | ORM/PaginatedQueryBuilder.php | PaginatedQueryBuilder.addOrder | public function addOrder(array $orderBy, $entityAlias = null)
{
foreach ($orderBy as $field => $order) {
if (preg_match('/^[a-z0-9][a-z0-9\_]+$/i', $field)) {
$this->addOrderBy(($entityAlias?$entityAlias.'.':'').$field, $order);
} else {
$this->addOrde... | php | public function addOrder(array $orderBy, $entityAlias = null)
{
foreach ($orderBy as $field => $order) {
if (preg_match('/^[a-z0-9][a-z0-9\_]+$/i', $field)) {
$this->addOrderBy(($entityAlias?$entityAlias.'.':'').$field, $order);
} else {
$this->addOrde... | [
"public",
"function",
"addOrder",
"(",
"array",
"$",
"orderBy",
",",
"$",
"entityAlias",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"orderBy",
"as",
"$",
"field",
"=>",
"$",
"order",
")",
"{",
"if",
"(",
"preg_match",
"(",
"'/^[a-z0-9][a-z0-9\\_]+$/i'",
... | @param array $orderBy
@param string $entityAlias
@return $this | [
"@param",
"array",
"$orderBy",
"@param",
"string",
"$entityAlias"
] | train | https://github.com/javihgil/doctrine-pagination/blob/7c6412992ba6df6e5ce5ff8e80479f60014358bf/ORM/PaginatedQueryBuilder.php#L18-L29 |
javihgil/doctrine-pagination | ORM/PaginatedQueryBuilder.php | PaginatedQueryBuilder.addPagination | public function addPagination($page, $rpp)
{
$offset = ($page - 1) * $rpp;
$limit = $rpp;
$this->setFirstResult($offset);
$this->setMaxResults($limit);
return $this;
} | php | public function addPagination($page, $rpp)
{
$offset = ($page - 1) * $rpp;
$limit = $rpp;
$this->setFirstResult($offset);
$this->setMaxResults($limit);
return $this;
} | [
"public",
"function",
"addPagination",
"(",
"$",
"page",
",",
"$",
"rpp",
")",
"{",
"$",
"offset",
"=",
"(",
"$",
"page",
"-",
"1",
")",
"*",
"$",
"rpp",
";",
"$",
"limit",
"=",
"$",
"rpp",
";",
"$",
"this",
"->",
"setFirstResult",
"(",
"$",
"o... | @param int $page
@param int $rpp
@return $this | [
"@param",
"int",
"$page",
"@param",
"int",
"$rpp"
] | train | https://github.com/javihgil/doctrine-pagination/blob/7c6412992ba6df6e5ce5ff8e80479f60014358bf/ORM/PaginatedQueryBuilder.php#L37-L46 |
markwatkinson/luminous | src/Luminous/Luminous.php | Luminous.registerDefaultScanners | private function registerDefaultScanners()
{
$this->settings = new Options();
$this->scanners->AddScanner(array('ada', 'adb', 'ads'), 'Luminous\\Scanners\\AdaScanner', 'Ada');
$this->scanners->AddScanner(
array('as', 'actionscript'),
'Luminous\\Scanners\\ActionScript... | php | private function registerDefaultScanners()
{
$this->settings = new Options();
$this->scanners->AddScanner(array('ada', 'adb', 'ads'), 'Luminous\\Scanners\\AdaScanner', 'Ada');
$this->scanners->AddScanner(
array('as', 'actionscript'),
'Luminous\\Scanners\\ActionScript... | [
"private",
"function",
"registerDefaultScanners",
"(",
")",
"{",
"$",
"this",
"->",
"settings",
"=",
"new",
"Options",
"(",
")",
";",
"$",
"this",
"->",
"scanners",
"->",
"AddScanner",
"(",
"array",
"(",
"'ada'",
",",
"'adb'",
",",
"'ads'",
")",
",",
"... | registers builtin scanners | [
"registers",
"builtin",
"scanners"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Luminous.php#L61-L115 |
markwatkinson/luminous | src/Luminous/Luminous.php | Luminous.getFormatter | public function getFormatter()
{
$fmt = $this->settings->format;
$formatter = null;
if (!is_string($fmt) && is_subclass_of($fmt, 'Luminous\\Formatters\\Formatter')) {
$formatter = clone $fmt;
} elseif ($fmt === 'html') {
$formatter = new HtmlFormatter();
... | php | public function getFormatter()
{
$fmt = $this->settings->format;
$formatter = null;
if (!is_string($fmt) && is_subclass_of($fmt, 'Luminous\\Formatters\\Formatter')) {
$formatter = clone $fmt;
} elseif ($fmt === 'html') {
$formatter = new HtmlFormatter();
... | [
"public",
"function",
"getFormatter",
"(",
")",
"{",
"$",
"fmt",
"=",
"$",
"this",
"->",
"settings",
"->",
"format",
";",
"$",
"formatter",
"=",
"null",
";",
"if",
"(",
"!",
"is_string",
"(",
"$",
"fmt",
")",
"&&",
"is_subclass_of",
"(",
"$",
"fmt",
... | Returns an instance of the current formatter | [
"Returns",
"an",
"instance",
"of",
"the",
"current",
"formatter"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Luminous.php#L120-L146 |
markwatkinson/luminous | src/Luminous/Luminous.php | Luminous.setFormatterOptions | private function setFormatterOptions(&$formatter)
{
$formatter->wrapLength = $this->settings->wrapWidth;
$formatter->lineNumbers = $this->settings->lineNumbers;
$formatter->startLine = $this->settings->startLine;
$formatter->link = $this->settings->autoLink;
$formatter->heigh... | php | private function setFormatterOptions(&$formatter)
{
$formatter->wrapLength = $this->settings->wrapWidth;
$formatter->lineNumbers = $this->settings->lineNumbers;
$formatter->startLine = $this->settings->startLine;
$formatter->link = $this->settings->autoLink;
$formatter->heigh... | [
"private",
"function",
"setFormatterOptions",
"(",
"&",
"$",
"formatter",
")",
"{",
"$",
"formatter",
"->",
"wrapLength",
"=",
"$",
"this",
"->",
"settings",
"->",
"wrapWidth",
";",
"$",
"formatter",
"->",
"lineNumbers",
"=",
"$",
"this",
"->",
"settings",
... | Sets up a formatter instance according to our current options/settings | [
"Sets",
"up",
"a",
"formatter",
"instance",
"according",
"to",
"our",
"current",
"options",
"/",
"settings"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Luminous.php#L151-L163 |
markwatkinson/luminous | src/Luminous/Luminous.php | Luminous.cacheId | private function cacheId($scanner, $source)
{
// to figure out the cache id, we mash a load of stuff together and
// md5 it. This gives us a unique (assuming no collisions) handle to
// a cache file, which depends on the input source, the relevant formatter
// settings, the version, ... | php | private function cacheId($scanner, $source)
{
// to figure out the cache id, we mash a load of stuff together and
// md5 it. This gives us a unique (assuming no collisions) handle to
// a cache file, which depends on the input source, the relevant formatter
// settings, the version, ... | [
"private",
"function",
"cacheId",
"(",
"$",
"scanner",
",",
"$",
"source",
")",
"{",
"// to figure out the cache id, we mash a load of stuff together and",
"// md5 it. This gives us a unique (assuming no collisions) handle to",
"// a cache file, which depends on the input source, the relev... | calculates a 'cache_id' for the input. This is dependent upon the
source code and the settings. This should be (near-as-feasible) unique
for any cobmination of source, language and settings | [
"calculates",
"a",
"cache_id",
"for",
"the",
"input",
".",
"This",
"is",
"dependent",
"upon",
"the",
"source",
"code",
"and",
"the",
"settings",
".",
"This",
"should",
"be",
"(",
"near",
"-",
"as",
"-",
"feasible",
")",
"unique",
"for",
"any",
"cobminati... | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Luminous.php#L170-L193 |
markwatkinson/luminous | src/Luminous/Luminous.php | Luminous.highlight | public function highlight($scanner, $source, $settings = null)
{
$oldSettings = null;
if ($settings !== null) {
if (!is_array($settings)) {
throw new Exception('Luminous internal error: Settings is not an array');
}
$oldSettings = clone $this->sett... | php | public function highlight($scanner, $source, $settings = null)
{
$oldSettings = null;
if ($settings !== null) {
if (!is_array($settings)) {
throw new Exception('Luminous internal error: Settings is not an array');
}
$oldSettings = clone $this->sett... | [
"public",
"function",
"highlight",
"(",
"$",
"scanner",
",",
"$",
"source",
",",
"$",
"settings",
"=",
"null",
")",
"{",
"$",
"oldSettings",
"=",
"null",
";",
"if",
"(",
"$",
"settings",
"!==",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$"... | The real highlighting function
@throw InvalidArgumentException if $scanner is not either a string or a
LuminousScanner instance, or if $source is not a string. | [
"The",
"real",
"highlighting",
"function"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Luminous.php#L200-L260 |
guillaumemonet/Rad | src/Rad/Database/PDODatabaseHandler.php | PDODatabaseHandler.prepare | public function prepare($sql, $options = null) {
try {
Log::getHandler()->debug($sql);
$stmt = parent::prepare($sql, $options);
} catch (PDOException $ex) {
Log::getHandler()->error($ex->getMessage());
}
return $stmt;
} | php | public function prepare($sql, $options = null) {
try {
Log::getHandler()->debug($sql);
$stmt = parent::prepare($sql, $options);
} catch (PDOException $ex) {
Log::getHandler()->error($ex->getMessage());
}
return $stmt;
} | [
"public",
"function",
"prepare",
"(",
"$",
"sql",
",",
"$",
"options",
"=",
"null",
")",
"{",
"try",
"{",
"Log",
"::",
"getHandler",
"(",
")",
"->",
"debug",
"(",
"$",
"sql",
")",
";",
"$",
"stmt",
"=",
"parent",
"::",
"prepare",
"(",
"$",
"sql",... | @param string $sql
@return PDOStatement | [
"@param",
"string",
"$sql"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Database/PDODatabaseHandler.php#L72-L80 |
guillaumemonet/Rad | src/Rad/Database/PDODatabaseHandler.php | PDODatabaseHandler.query | public function query($sql) {
try {
Log::getHandler()->debug($sql);
return parent::query($sql);
} catch (PDOException $ex) {
Log::getHandler()->error($ex->getMessage());
}
return false;
} | php | public function query($sql) {
try {
Log::getHandler()->debug($sql);
return parent::query($sql);
} catch (PDOException $ex) {
Log::getHandler()->error($ex->getMessage());
}
return false;
} | [
"public",
"function",
"query",
"(",
"$",
"sql",
")",
"{",
"try",
"{",
"Log",
"::",
"getHandler",
"(",
")",
"->",
"debug",
"(",
"$",
"sql",
")",
";",
"return",
"parent",
"::",
"query",
"(",
"$",
"sql",
")",
";",
"}",
"catch",
"(",
"PDOException",
... | @param string $sql
@return PDOStatement | [
"@param",
"string",
"$sql"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Database/PDODatabaseHandler.php#L87-L95 |
vardius/crud-bundle | Actions/Action/SaveAction.php | SaveAction.call | public function call(ActionEvent $event, string $format):Response
{
$controller = $event->getController();
$dataProvider = $event->getDataProvider();
$request = $event->getRequest();
if ($id = $request->get('id')) {
$data = $dataProvider->get($id);
$this->ch... | php | public function call(ActionEvent $event, string $format):Response
{
$controller = $event->getController();
$dataProvider = $event->getDataProvider();
$request = $event->getRequest();
if ($id = $request->get('id')) {
$data = $dataProvider->get($id);
$this->ch... | [
"public",
"function",
"call",
"(",
"ActionEvent",
"$",
"event",
",",
"string",
"$",
"format",
")",
":",
"Response",
"{",
"$",
"controller",
"=",
"$",
"event",
"->",
"getController",
"(",
")",
";",
"$",
"dataProvider",
"=",
"$",
"event",
"->",
"getDataPro... | {@inheritdoc} | [
"{"
] | train | https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Actions/Action/SaveAction.php#L39-L132 |
mimmi20/Wurfl | src/Configuration/InMemoryConfig.php | InMemoryConfig.persistence | public function persistence($provider, array $params = array())
{
$this->persistence = array_merge(array(Config::PROVIDER => $provider), array(Config::PARAMS => $params));
return $this;
} | php | public function persistence($provider, array $params = array())
{
$this->persistence = array_merge(array(Config::PROVIDER => $provider), array(Config::PARAMS => $params));
return $this;
} | [
"public",
"function",
"persistence",
"(",
"$",
"provider",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"persistence",
"=",
"array_merge",
"(",
"array",
"(",
"Config",
"::",
"PROVIDER",
"=>",
"$",
"provider",
")",
"... | Set persistence provider
@param string $provider
@param array $params
@return \Wurfl\Configuration\InMemoryConfig $this | [
"Set",
"persistence",
"provider"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Configuration/InMemoryConfig.php#L79-L84 |
mimmi20/Wurfl | src/Configuration/InMemoryConfig.php | InMemoryConfig.cache | public function cache($provider, array $params = array())
{
$this->cache = array_merge(array(config::PROVIDER => $provider), array(Config::PARAMS => $params));
return $this;
} | php | public function cache($provider, array $params = array())
{
$this->cache = array_merge(array(config::PROVIDER => $provider), array(Config::PARAMS => $params));
return $this;
} | [
"public",
"function",
"cache",
"(",
"$",
"provider",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"cache",
"=",
"array_merge",
"(",
"array",
"(",
"config",
"::",
"PROVIDER",
"=>",
"$",
"provider",
")",
",",
"array... | Set Cache provider
@param string $provider
@param array $params
@return \Wurfl\Configuration\InMemoryConfig $this | [
"Set",
"Cache",
"provider"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Configuration/InMemoryConfig.php#L94-L99 |
mimmi20/Wurfl | src/Configuration/InMemoryConfig.php | InMemoryConfig.logDir | public function logDir($dir)
{
$this->logDir = $dir;
$this->buildFileLogger($this->logDir);
return $this;
} | php | public function logDir($dir)
{
$this->logDir = $dir;
$this->buildFileLogger($this->logDir);
return $this;
} | [
"public",
"function",
"logDir",
"(",
"$",
"dir",
")",
"{",
"$",
"this",
"->",
"logDir",
"=",
"$",
"dir",
";",
"$",
"this",
"->",
"buildFileLogger",
"(",
"$",
"this",
"->",
"logDir",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set logging directory
@param string $dir
@return \Wurfl\Configuration\InMemoryConfig $this | [
"Set",
"logging",
"directory"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Configuration/InMemoryConfig.php#L108-L115 |
boxberry-delivery/php-api-common | src/Message/Response/AbstractResponse.php | AbstractResponse.getCollection | public function getCollection($collectionClass = CreateFromAttributesInterface::class)
{
$collection = [];
if ($this->isSuccessful()) {
$data = $this->getData();
foreach ($data as $attributes) {
/** @var AbstractModel $collectionClass */
$colle... | php | public function getCollection($collectionClass = CreateFromAttributesInterface::class)
{
$collection = [];
if ($this->isSuccessful()) {
$data = $this->getData();
foreach ($data as $attributes) {
/** @var AbstractModel $collectionClass */
$colle... | [
"public",
"function",
"getCollection",
"(",
"$",
"collectionClass",
"=",
"CreateFromAttributesInterface",
"::",
"class",
")",
"{",
"$",
"collection",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"isSuccessful",
"(",
")",
")",
"{",
"$",
"data",
"=",
... | @inheritdoc
@return AbstractModel[]|object[] | [
"@inheritdoc"
] | train | https://github.com/boxberry-delivery/php-api-common/blob/4fab9ad184968ead3bfcb98b491e289bfb589098/src/Message/Response/AbstractResponse.php#L63-L75 |
liuguangw/mvc | src/services/ErrorHandler.php | ErrorHandler.showErrorMsg | private function showErrorMsg(int $httpCode, int $errorCode, string $errorType, string $message, array $traceArr, string $file, int $line)
{
if (empty($traceArr)) {
$traceArr = debug_backtrace();
}
$content = $this->getErrContent();
$mainTitle = 'HTTP 错误 ' . $httpCode;
... | php | private function showErrorMsg(int $httpCode, int $errorCode, string $errorType, string $message, array $traceArr, string $file, int $line)
{
if (empty($traceArr)) {
$traceArr = debug_backtrace();
}
$content = $this->getErrContent();
$mainTitle = 'HTTP 错误 ' . $httpCode;
... | [
"private",
"function",
"showErrorMsg",
"(",
"int",
"$",
"httpCode",
",",
"int",
"$",
"errorCode",
",",
"string",
"$",
"errorType",
",",
"string",
"$",
"message",
",",
"array",
"$",
"traceArr",
",",
"string",
"$",
"file",
",",
"int",
"$",
"line",
")",
"... | 显示错误消息
@param int $code
错误代码
@param string $errorType
错误类型
@param string $message
错误消息
@param array $traceArr
错误追踪数组
@return void | [
"显示错误消息"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/services/ErrorHandler.php#L48-L89 |
liuguangw/mvc | src/services/ErrorHandler.php | ErrorHandler.getTableHtml | private function getTableHtml(array &$traceArr): string
{
$showSource = Application::$app->config->getValue('ERROR_HANDLER_SHOW_SOURCE');
$tableHtml = '<table>
<tr><th>#stack</th><th>func</th><th>args</th><th>location</th></tr>';
$stackIndex = 0;
$filesArr = $linesArr = $contentArr =... | php | private function getTableHtml(array &$traceArr): string
{
$showSource = Application::$app->config->getValue('ERROR_HANDLER_SHOW_SOURCE');
$tableHtml = '<table>
<tr><th>#stack</th><th>func</th><th>args</th><th>location</th></tr>';
$stackIndex = 0;
$filesArr = $linesArr = $contentArr =... | [
"private",
"function",
"getTableHtml",
"(",
"array",
"&",
"$",
"traceArr",
")",
":",
"string",
"{",
"$",
"showSource",
"=",
"Application",
"::",
"$",
"app",
"->",
"config",
"->",
"getValue",
"(",
"'ERROR_HANDLER_SHOW_SOURCE'",
")",
";",
"$",
"tableHtml",
"="... | 将调试跟踪数组转换为table
@param array $traceArr
调试跟踪数组
@return string | [
"将调试跟踪数组转换为table"
] | train | https://github.com/liuguangw/mvc/blob/70f98f37ec59fae50650102a99fbcab88bef9f54/src/services/ErrorHandler.php#L107-L191 |
LordDashMe/php-static-class-interface | src/Facade.php | Facade.getResolvedClassInstance | protected static function getResolvedClassInstance()
{
$classNamespace = static::getStaticClassAccessor();
$resolvedClassInstance = self::getClass($classNamespace);
if (! $resolvedClassInstance) {
return self::resolveClassNameSpace($classNamespace);
}
... | php | protected static function getResolvedClassInstance()
{
$classNamespace = static::getStaticClassAccessor();
$resolvedClassInstance = self::getClass($classNamespace);
if (! $resolvedClassInstance) {
return self::resolveClassNameSpace($classNamespace);
}
... | [
"protected",
"static",
"function",
"getResolvedClassInstance",
"(",
")",
"{",
"$",
"classNamespace",
"=",
"static",
"::",
"getStaticClassAccessor",
"(",
")",
";",
"$",
"resolvedClassInstance",
"=",
"self",
"::",
"getClass",
"(",
"$",
"classNamespace",
")",
";",
... | Check if the class namespace already have a cached resolved instance,
if not then the class namespace must be resolve.
@return mixed | [
"Check",
"if",
"the",
"class",
"namespace",
"already",
"have",
"a",
"cached",
"resolved",
"instance",
"if",
"not",
"then",
"the",
"class",
"namespace",
"must",
"be",
"resolve",
"."
] | train | https://github.com/LordDashMe/php-static-class-interface/blob/7c0855e47158c81e041723bede48a7b35652edb3/src/Facade.php#L83-L93 |
LordDashMe/php-static-class-interface | src/Facade.php | Facade.resolveClassNameSpace | protected static function resolveClassNameSpace($classNamespace)
{
if (! \is_string($classNamespace)) {
throw ClassNamespaceResolverException::isNotString();
}
if (! \class_exists($classNamespace)) {
throw ClassNamespaceResolverException::isNotExist();
}
... | php | protected static function resolveClassNameSpace($classNamespace)
{
if (! \is_string($classNamespace)) {
throw ClassNamespaceResolverException::isNotString();
}
if (! \class_exists($classNamespace)) {
throw ClassNamespaceResolverException::isNotExist();
}
... | [
"protected",
"static",
"function",
"resolveClassNameSpace",
"(",
"$",
"classNamespace",
")",
"{",
"if",
"(",
"!",
"\\",
"is_string",
"(",
"$",
"classNamespace",
")",
")",
"{",
"throw",
"ClassNamespaceResolverException",
"::",
"isNotString",
"(",
")",
";",
"}",
... | Resolver for service class namespace.
Set the resolved service class instance to the class property.
@param string $classNamespace
@return mixed | [
"Resolver",
"for",
"service",
"class",
"namespace",
".",
"Set",
"the",
"resolved",
"service",
"class",
"instance",
"to",
"the",
"class",
"property",
"."
] | train | https://github.com/LordDashMe/php-static-class-interface/blob/7c0855e47158c81e041723bede48a7b35652edb3/src/Facade.php#L103-L120 |
unimapper/unimapper | src/Entity/Reflection/Property.php | Property._initType | private function _initType($definition)
{
if (isset(self::$typeAliases[$definition])) {
$definition = self::$typeAliases[$definition];
}
if (self::isScalarType($definition)
|| in_array(
$definition,
[self::TYPE_ARRAY, self::TYPE_DATE, ... | php | private function _initType($definition)
{
if (isset(self::$typeAliases[$definition])) {
$definition = self::$typeAliases[$definition];
}
if (self::isScalarType($definition)
|| in_array(
$definition,
[self::TYPE_ARRAY, self::TYPE_DATE, ... | [
"private",
"function",
"_initType",
"(",
"$",
"definition",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"typeAliases",
"[",
"$",
"definition",
"]",
")",
")",
"{",
"$",
"definition",
"=",
"self",
"::",
"$",
"typeAliases",
"[",
"$",
"definition... | Initialize property type
@param string $definition
@return mixed
@throws Exception\PropertyException | [
"Initialize",
"property",
"type"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection/Property.php#L209-L240 |
unimapper/unimapper | src/Entity/Reflection/Property.php | Property.validateValueType | public function validateValueType($value)
{
if ($this->hasOption(Entity\Reflection\Property\Option\Primary::KEY)
&& (Entity\Reflection\Property\Option\Primary::isEmpty($value))
) {
throw new Exception\InvalidArgumentException(
"Primary value can not be empty s... | php | public function validateValueType($value)
{
if ($this->hasOption(Entity\Reflection\Property\Option\Primary::KEY)
&& (Entity\Reflection\Property\Option\Primary::isEmpty($value))
) {
throw new Exception\InvalidArgumentException(
"Primary value can not be empty s... | [
"public",
"function",
"validateValueType",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasOption",
"(",
"Entity",
"\\",
"Reflection",
"\\",
"Property",
"\\",
"Option",
"\\",
"Primary",
"::",
"KEY",
")",
"&&",
"(",
"Entity",
"\\",
"Reflect... | Validate value type
@param mixed $value Given value
@throws Exception\InvalidArgumentException
@throws \Exception | [
"Validate",
"value",
"type"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection/Property.php#L250-L358 |
unimapper/unimapper | src/Entity/Reflection/Property.php | Property.convertValue | public function convertValue($value)
{
if ($value === null || ($value === "" && $this->type !== self::TYPE_STRING)) {
return;
}
if (self::isScalarType($this->type) || $this->type === self::TYPE_ARRAY) {
// Scalar and array
if ($this->type === self::TYPE_... | php | public function convertValue($value)
{
if ($value === null || ($value === "" && $this->type !== self::TYPE_STRING)) {
return;
}
if (self::isScalarType($this->type) || $this->type === self::TYPE_ARRAY) {
// Scalar and array
if ($this->type === self::TYPE_... | [
"public",
"function",
"convertValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
"||",
"(",
"$",
"value",
"===",
"\"\"",
"&&",
"$",
"this",
"->",
"type",
"!==",
"self",
"::",
"TYPE_STRING",
")",
")",
"{",
"return",
";",
"}... | Try to convert value on required type automatically
@param mixed $value
@return mixed
@throws Exception\InvalidArgumentException | [
"Try",
"to",
"convert",
"value",
"on",
"required",
"type",
"automatically"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection/Property.php#L369-L428 |
unimapper/unimapper | src/Entity/Reflection/Property.php | Property.getOption | public function getOption($key)
{
if (!$this->hasOption($key)) {
throw new Exception\InvalidArgumentException(
"Option " . $key . " not defined on "
. $this->reflection->getClassName() . "::$"
. $this->name . "!"
);
}
re... | php | public function getOption($key)
{
if (!$this->hasOption($key)) {
throw new Exception\InvalidArgumentException(
"Option " . $key . " not defined on "
. $this->reflection->getClassName() . "::$"
. $this->name . "!"
);
}
re... | [
"public",
"function",
"getOption",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasOption",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"InvalidArgumentException",
"(",
"\"Option \"",
".",
"$",
"key",
".",
"\" n... | Get option
@param string $key
@return mixed
@throws Exception\InvalidArgumentException | [
"Get",
"option"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection/Property.php#L451-L461 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer/ConfigForm.php | HTMLPurifier_Printer_ConfigForm.renderNamespace | protected function renderNamespace($ns, $directives) {
$ret = '';
$ret .= $this->start('tbody', array('class' => 'namespace'));
$ret .= $this->start('tr');
$ret .= $this->element('th', $ns, array('colspan' => 2));
$ret .= $this->end('tr');
$ret .= $this->end('tbody');... | php | protected function renderNamespace($ns, $directives) {
$ret = '';
$ret .= $this->start('tbody', array('class' => 'namespace'));
$ret .= $this->start('tr');
$ret .= $this->element('th', $ns, array('colspan' => 2));
$ret .= $this->end('tr');
$ret .= $this->end('tbody');... | [
"protected",
"function",
"renderNamespace",
"(",
"$",
"ns",
",",
"$",
"directives",
")",
"{",
"$",
"ret",
"=",
"''",
";",
"$",
"ret",
".=",
"$",
"this",
"->",
"start",
"(",
"'tbody'",
",",
"array",
"(",
"'class'",
"=>",
"'namespace'",
")",
")",
";",
... | Renders a single namespace
@param $ns String namespace name
@param $directive Associative array of directives to values | [
"Renders",
"a",
"single",
"namespace"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Printer/ConfigForm.php#L127-L181 |
DevGroup-ru/yii2-data-structure-tools | src/search/helpers/PropertiesFilterHelper.php | PropertiesFilterHelper.filterObjects | public static function filterObjects($propertySelections = [], $returnType = Filter::RETURN_ALL)
{
$selections = [];
$selectionsCount = count($propertySelections);
if ($selectionsCount == 0) {
return [];
}
$tags = [];
/**
* Что тут плохо:
... | php | public static function filterObjects($propertySelections = [], $returnType = Filter::RETURN_ALL)
{
$selections = [];
$selectionsCount = count($propertySelections);
if ($selectionsCount == 0) {
return [];
}
$tags = [];
/**
* Что тут плохо:
... | [
"public",
"static",
"function",
"filterObjects",
"(",
"$",
"propertySelections",
"=",
"[",
"]",
",",
"$",
"returnType",
"=",
"Filter",
"::",
"RETURN_ALL",
")",
"{",
"$",
"selections",
"=",
"[",
"]",
";",
"$",
"selectionsCount",
"=",
"count",
"(",
"$",
"p... | TODO check for correct behavior with empty $propertySelections
@param array $propertySelections
@param int $returnType
@return mixed|\yii\db\ActiveQuery[] | [
"TODO",
"check",
"for",
"correct",
"behavior",
"with",
"empty",
"$propertySelections"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/search/helpers/PropertiesFilterHelper.php#L30-L121 |
gorkalaucirica/HipchatAPIv2Client | Model/User.php | User.parseJson | public function parseJson($json)
{
$this->mentionName = $json['mention_name'];
$this->id = $json['id'];
$this->name = $json['name'];
if (isset($json['links'])) {
$this->links = $json['links'];
}
if(isset($json['xmpp_jid'])) {
$this->xmppJid = $... | php | public function parseJson($json)
{
$this->mentionName = $json['mention_name'];
$this->id = $json['id'];
$this->name = $json['name'];
if (isset($json['links'])) {
$this->links = $json['links'];
}
if(isset($json['xmpp_jid'])) {
$this->xmppJid = $... | [
"public",
"function",
"parseJson",
"(",
"$",
"json",
")",
"{",
"$",
"this",
"->",
"mentionName",
"=",
"$",
"json",
"[",
"'mention_name'",
"]",
";",
"$",
"this",
"->",
"id",
"=",
"$",
"json",
"[",
"'id'",
"]",
";",
"$",
"this",
"->",
"name",
"=",
... | Parses response given by the API and maps the fields to User object
@param array $json json_decoded response in json given by the server
@return void | [
"Parses",
"response",
"given",
"by",
"the",
"API",
"and",
"maps",
"the",
"fields",
"to",
"User",
"object"
] | train | https://github.com/gorkalaucirica/HipchatAPIv2Client/blob/eef9c91d5efe5ae9cad27c503601ffff089c9547/Model/User.php#L61-L81 |
bariew/yii2-rbac-cms-module | controllers/AuthItemChildController.php | AuthItemChildController.actionTree | public function actionTree($name)
{
$parent = $this->findParentModel($name);
$children = $parent->getPermissions()->select('name')->column();
$actions = AuthItemChild::permissionList();
return $this->renderPartial('tree', compact('parent', 'children', 'actions'));
} | php | public function actionTree($name)
{
$parent = $this->findParentModel($name);
$children = $parent->getPermissions()->select('name')->column();
$actions = AuthItemChild::permissionList();
return $this->renderPartial('tree', compact('parent', 'children', 'actions'));
} | [
"public",
"function",
"actionTree",
"(",
"$",
"name",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"findParentModel",
"(",
"$",
"name",
")",
";",
"$",
"children",
"=",
"$",
"parent",
"->",
"getPermissions",
"(",
")",
"->",
"select",
"(",
"'name'",
... | Обновление модели.
@param integer $name parent model name
@return mixed | [
"Обновление",
"модели",
"."
] | train | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/controllers/AuthItemChildController.php#L42-L48 |
bariew/yii2-rbac-cms-module | controllers/AuthItemChildController.php | AuthItemChildController.actionAdd | public function actionAdd($id, $parent_id, $add = 1)
{
$parent = $this->findParentModel($parent_id);
$model = $this->findParentModel();
$model->type = Item::TYPE_PERMISSION;
$model->name = $id;
if ((!$child = $model::findOne($id)) && $add) {
$child = $model;
... | php | public function actionAdd($id, $parent_id, $add = 1)
{
$parent = $this->findParentModel($parent_id);
$model = $this->findParentModel();
$model->type = Item::TYPE_PERMISSION;
$model->name = $id;
if ((!$child = $model::findOne($id)) && $add) {
$child = $model;
... | [
"public",
"function",
"actionAdd",
"(",
"$",
"id",
",",
"$",
"parent_id",
",",
"$",
"add",
"=",
"1",
")",
"{",
"$",
"parent",
"=",
"$",
"this",
"->",
"findParentModel",
"(",
"$",
"parent_id",
")",
";",
"$",
"model",
"=",
"$",
"this",
"->",
"findPar... | Creates new permission attached to $id owner.
@param integer $id parent id
@return \yii\web\View action view | [
"Creates",
"new",
"permission",
"attached",
"to",
"$id",
"owner",
"."
] | train | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/controllers/AuthItemChildController.php#L55-L69 |
f3ath/appnexusclient | src/HttpClient.php | HttpClient.call | public function call($method, $url, array $post = array(), array $headers = array())
{
$options = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
);
switch ($method) {
case HttpMethod::GET:
... | php | public function call($method, $url, array $post = array(), array $headers = array())
{
$options = array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
);
switch ($method) {
case HttpMethod::GET:
... | [
"public",
"function",
"call",
"(",
"$",
"method",
",",
"$",
"url",
",",
"array",
"$",
"post",
"=",
"array",
"(",
")",
",",
"array",
"$",
"headers",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"CURLOPT_URL",
"=>",
"$",
"ur... | Do raw HTTP call
@param string $method
@param string $url
@param array $post POST data
@param array $headers
@return object response | [
"Do",
"raw",
"HTTP",
"call"
] | train | https://github.com/f3ath/appnexusclient/blob/cfe3f3a98a9c2883484154c8997c7459b1504742/src/HttpClient.php#L39-L84 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/DefinitionCache/Serializer.php | HTMLPurifier_DefinitionCache_Serializer._prepareDir | private function _prepareDir($config) {
$directory = $this->generateDirectoryPath($config);
if (!is_dir($directory)) {
$base = $this->generateBaseDirectoryPath($config);
if (!is_dir($base)) {
trigger_error('Base directory '.$base.' does not exist,
... | php | private function _prepareDir($config) {
$directory = $this->generateDirectoryPath($config);
if (!is_dir($directory)) {
$base = $this->generateBaseDirectoryPath($config);
if (!is_dir($base)) {
trigger_error('Base directory '.$base.' does not exist,
... | [
"private",
"function",
"_prepareDir",
"(",
"$",
"config",
")",
"{",
"$",
"directory",
"=",
"$",
"this",
"->",
"generateDirectoryPath",
"(",
"$",
"config",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"directory",
")",
")",
"{",
"$",
"base",
"=",
"$"... | Prepares the directory that this type stores the serials in
@return True if successful | [
"Prepares",
"the",
"directory",
"that",
"this",
"type",
"stores",
"the",
"serials",
"in"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/DefinitionCache/Serializer.php#L110-L129 |
KejawenLab/PetrukUsername | UsernameFactory.php | UsernameFactory.generate | public function generate(string $fullName, \DateTimeInterface $birthday, int $characterLimit = 8, int $maxUsernamePerPrefix = 1000)
{
$fullName = strtoupper($fullName);
$characters = array();
$isShort = false;
if ($characterLimit > strlen($fullName)) {
$shortGenerator = ... | php | public function generate(string $fullName, \DateTimeInterface $birthday, int $characterLimit = 8, int $maxUsernamePerPrefix = 1000)
{
$fullName = strtoupper($fullName);
$characters = array();
$isShort = false;
if ($characterLimit > strlen($fullName)) {
$shortGenerator = ... | [
"public",
"function",
"generate",
"(",
"string",
"$",
"fullName",
",",
"\\",
"DateTimeInterface",
"$",
"birthday",
",",
"int",
"$",
"characterLimit",
"=",
"8",
",",
"int",
"$",
"maxUsernamePerPrefix",
"=",
"1000",
")",
"{",
"$",
"fullName",
"=",
"strtoupper"... | @param string $fullName
@param \DateTimeInterface $birthday
@param int $characterLimit
@param int $maxUsernamePerPrefix
@return null|string | [
"@param",
"string",
"$fullName",
"@param",
"\\",
"DateTimeInterface",
"$birthday",
"@param",
"int",
"$characterLimit",
"@param",
"int",
"$maxUsernamePerPrefix"
] | train | https://github.com/KejawenLab/PetrukUsername/blob/a602cf9976415c94c2346a22b5df87fd53069b99/UsernameFactory.php#L70-L94 |
KejawenLab/PetrukUsername | UsernameFactory.php | UsernameFactory.getUsername | private function getUsername(\DateTimeInterface $birthday, array $characters, int $maxUsernamePerPrefix)
{
$dates = DateGenerator::generate($birthday);
$this->characters = $characters;
$this->dates = $dates;
$realUsername = null;
foreach ($characters as $character) {
... | php | private function getUsername(\DateTimeInterface $birthday, array $characters, int $maxUsernamePerPrefix)
{
$dates = DateGenerator::generate($birthday);
$this->characters = $characters;
$this->dates = $dates;
$realUsername = null;
foreach ($characters as $character) {
... | [
"private",
"function",
"getUsername",
"(",
"\\",
"DateTimeInterface",
"$",
"birthday",
",",
"array",
"$",
"characters",
",",
"int",
"$",
"maxUsernamePerPrefix",
")",
"{",
"$",
"dates",
"=",
"DateGenerator",
"::",
"generate",
"(",
"$",
"birthday",
")",
";",
"... | @param \DateTimeInterface $birthday
@param array $characters
@param int $maxUsernamePerPrefix
@return string | [
"@param",
"\\",
"DateTimeInterface",
"$birthday",
"@param",
"array",
"$characters",
"@param",
"int",
"$maxUsernamePerPrefix"
] | train | https://github.com/KejawenLab/PetrukUsername/blob/a602cf9976415c94c2346a22b5df87fd53069b99/UsernameFactory.php#L159-L207 |
KejawenLab/PetrukUsername | UsernameFactory.php | UsernameFactory.doGenerate | private function doGenerate(string $fullName, int $characterLimit, array $characters = [])
{
$balineseGenerator = new BalineseUsernameGenerator();
if (-1 !== $balineseGenerator->isReservedName($fullName)) {
$characters = array_merge($characters, $balineseGenerator->generate($fullName, $c... | php | private function doGenerate(string $fullName, int $characterLimit, array $characters = [])
{
$balineseGenerator = new BalineseUsernameGenerator();
if (-1 !== $balineseGenerator->isReservedName($fullName)) {
$characters = array_merge($characters, $balineseGenerator->generate($fullName, $c... | [
"private",
"function",
"doGenerate",
"(",
"string",
"$",
"fullName",
",",
"int",
"$",
"characterLimit",
",",
"array",
"$",
"characters",
"=",
"[",
"]",
")",
"{",
"$",
"balineseGenerator",
"=",
"new",
"BalineseUsernameGenerator",
"(",
")",
";",
"if",
"(",
"... | @param string $fullName
@param int $characterLimit
@param array $characters
@return array | [
"@param",
"string",
"$fullName",
"@param",
"int",
"$characterLimit",
"@param",
"array",
"$characters"
] | train | https://github.com/KejawenLab/PetrukUsername/blob/a602cf9976415c94c2346a22b5df87fd53069b99/UsernameFactory.php#L232-L253 |
unimapper/unimapper | src/Repository.php | Repository.save | public function save(Entity $entity)
{
$requiredClass = Convention::nameToClass($this->getEntityName(), Convention::ENTITY_MASK);
if (!$entity instanceof $requiredClass) {
throw new Exception\RepositoryException(
"Entity must be instance of ". $requiredClass . "!"
... | php | public function save(Entity $entity)
{
$requiredClass = Convention::nameToClass($this->getEntityName(), Convention::ENTITY_MASK);
if (!$entity instanceof $requiredClass) {
throw new Exception\RepositoryException(
"Entity must be instance of ". $requiredClass . "!"
... | [
"public",
"function",
"save",
"(",
"Entity",
"$",
"entity",
")",
"{",
"$",
"requiredClass",
"=",
"Convention",
"::",
"nameToClass",
"(",
"$",
"this",
"->",
"getEntityName",
"(",
")",
",",
"Convention",
"::",
"ENTITY_MASK",
")",
";",
"if",
"(",
"!",
"$",
... | Insert/update entity
@param Entity $entity
@return Entity
@throws Exception\RepositoryException | [
"Insert",
"/",
"update",
"entity"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L31-L64 |
unimapper/unimapper | src/Repository.php | Repository.create | public function create(Entity $entity)
{
if (!$entity->getValidator()->validate()) {
throw new Exception\ValidatorException($entity->getValidator());
}
$values = $entity->getData();
$reflection = $entity::getReflection();
// Prevent to force empty primary prope... | php | public function create(Entity $entity)
{
if (!$entity->getValidator()->validate()) {
throw new Exception\ValidatorException($entity->getValidator());
}
$values = $entity->getData();
$reflection = $entity::getReflection();
// Prevent to force empty primary prope... | [
"public",
"function",
"create",
"(",
"Entity",
"$",
"entity",
")",
"{",
"if",
"(",
"!",
"$",
"entity",
"->",
"getValidator",
"(",
")",
"->",
"validate",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"ValidatorException",
"(",
"$",
"entity",
"-... | Create a new record
@param Entity $entity
@return mixed
@throws Exception\ValidatorException
@throws Exception\RepositoryException | [
"Create",
"a",
"new",
"record"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L76-L105 |
unimapper/unimapper | src/Repository.php | Repository.update | public function update(Entity $entity, $primaryValue)
{
if (!$entity->getValidator()->validate()) {
throw new Exception\ValidatorException($entity->getValidator());
}
try {
if (!$this->query()->updateOne($primaryValue, $entity->getData())->run($this->connection)) {
... | php | public function update(Entity $entity, $primaryValue)
{
if (!$entity->getValidator()->validate()) {
throw new Exception\ValidatorException($entity->getValidator());
}
try {
if (!$this->query()->updateOne($primaryValue, $entity->getData())->run($this->connection)) {
... | [
"public",
"function",
"update",
"(",
"Entity",
"$",
"entity",
",",
"$",
"primaryValue",
")",
"{",
"if",
"(",
"!",
"$",
"entity",
"->",
"getValidator",
"(",
")",
"->",
"validate",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"ValidatorException"... | Update single record
@param Entity $entity
@param mixed $primaryValue
@throws Exception\ValidatorException
@throws Exception\RepositoryException | [
"Update",
"single",
"record"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L116-L132 |
unimapper/unimapper | src/Repository.php | Repository.updateBy | public function updateBy(Entity $entity, array $filter = [])
{
if (!$entity->getValidator()->validate()) {
throw new Exception\ValidatorException($entity->getValidator());
}
try {
return $this->query()->update($entity->getData())
->setFilter($filter)
... | php | public function updateBy(Entity $entity, array $filter = [])
{
if (!$entity->getValidator()->validate()) {
throw new Exception\ValidatorException($entity->getValidator());
}
try {
return $this->query()->update($entity->getData())
->setFilter($filter)
... | [
"public",
"function",
"updateBy",
"(",
"Entity",
"$",
"entity",
",",
"array",
"$",
"filter",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"entity",
"->",
"getValidator",
"(",
")",
"->",
"validate",
"(",
")",
")",
"{",
"throw",
"new",
"Exception",
... | Update records
@param Entity $entity
@param array $filter
@return int Affected records count
@throws Exception\RepositoryException
@throws Exception\ValidatorException | [
"Update",
"records"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L145-L158 |
unimapper/unimapper | src/Repository.php | Repository.destroy | public function destroy(Entity $entity)
{
$requiredClass = Convention::nameToClass($this->getEntityName(), Convention::ENTITY_MASK);
if (!$entity instanceof $requiredClass) {
throw new Exception\RepositoryException(
"Entity must be instance of ". $requiredClass . "!"
... | php | public function destroy(Entity $entity)
{
$requiredClass = Convention::nameToClass($this->getEntityName(), Convention::ENTITY_MASK);
if (!$entity instanceof $requiredClass) {
throw new Exception\RepositoryException(
"Entity must be instance of ". $requiredClass . "!"
... | [
"public",
"function",
"destroy",
"(",
"Entity",
"$",
"entity",
")",
"{",
"$",
"requiredClass",
"=",
"Convention",
"::",
"nameToClass",
"(",
"$",
"this",
"->",
"getEntityName",
"(",
")",
",",
"Convention",
"::",
"ENTITY_MASK",
")",
";",
"if",
"(",
"!",
"$... | Delete single record
@param Entity $entity
@return boolean
@throws Exception\RepositoryException | [
"Delete",
"single",
"record"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L185-L208 |
unimapper/unimapper | src/Repository.php | Repository.destroyBy | public function destroyBy(array $filter = [])
{
try {
return $this->query()->delete()
->setFilter($filter)
->run($this->connection);
} catch (Exception\QueryException $e) {
throw new Exception\RepositoryException($e->getMessage());
}
... | php | public function destroyBy(array $filter = [])
{
try {
return $this->query()->delete()
->setFilter($filter)
->run($this->connection);
} catch (Exception\QueryException $e) {
throw new Exception\RepositoryException($e->getMessage());
}
... | [
"public",
"function",
"destroyBy",
"(",
"array",
"$",
"filter",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"query",
"(",
")",
"->",
"delete",
"(",
")",
"->",
"setFilter",
"(",
"$",
"filter",
")",
"->",
"run",
"(",
"$",
"thi... | Delete records
@param array $filter
@return int Deleted records count
@throws Exception\RepositoryException | [
"Delete",
"records"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L219-L228 |
unimapper/unimapper | src/Repository.php | Repository.find | public function find(array $filter = [], array $orderBy = [], $limit = 0,
$offset = 0, array $associate = []
) {
try {
$query = $this->query()
->select()
->associate($associate)
->setFilter($filter);
foreach ($orderBy as $orde... | php | public function find(array $filter = [], array $orderBy = [], $limit = 0,
$offset = 0, array $associate = []
) {
try {
$query = $this->query()
->select()
->associate($associate)
->setFilter($filter);
foreach ($orderBy as $orde... | [
"public",
"function",
"find",
"(",
"array",
"$",
"filter",
"=",
"[",
"]",
",",
"array",
"$",
"orderBy",
"=",
"[",
"]",
",",
"$",
"limit",
"=",
"0",
",",
"$",
"offset",
"=",
"0",
",",
"array",
"$",
"associate",
"=",
"[",
"]",
")",
"{",
"try",
... | Find all records
@param array $filter
@param array $orderBy
@param int $limit
@param int $offset
@param array $associate
@return Entity\Collection
@throws Exception\RepositoryException | [
"Find",
"all",
"records"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L254-L272 |
unimapper/unimapper | src/Repository.php | Repository.findPrimaries | public function findPrimaries(array $primaryValues, array $associate = [])
{
$reflection = Entity\Reflection::load($this->getEntityName());
if (!$reflection->hasPrimary()) {
throw new Exception\RepositoryException(
"Method can not be used because entity " . $this->getEnt... | php | public function findPrimaries(array $primaryValues, array $associate = [])
{
$reflection = Entity\Reflection::load($this->getEntityName());
if (!$reflection->hasPrimary()) {
throw new Exception\RepositoryException(
"Method can not be used because entity " . $this->getEnt... | [
"public",
"function",
"findPrimaries",
"(",
"array",
"$",
"primaryValues",
",",
"array",
"$",
"associate",
"=",
"[",
"]",
")",
"{",
"$",
"reflection",
"=",
"Entity",
"\\",
"Reflection",
"::",
"load",
"(",
"$",
"this",
"->",
"getEntityName",
"(",
")",
")"... | Find records by set of primary values
@param array $primaryValues
@param array $associate
@return Entity\Collection
@throws Exception\RepositoryException | [
"Find",
"records",
"by",
"set",
"of",
"primary",
"values"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Repository.php#L295-L328 |
antarestupin/Accessible | lib/Accessible/MethodManager/CollectionManager.php | CollectionManager.collectionContains | public static function collectionContains($needle, $haystack)
{
foreach ($haystack as $value) {
if ($value === $needle) {
return true;
}
}
return false;
} | php | public static function collectionContains($needle, $haystack)
{
foreach ($haystack as $value) {
if ($value === $needle) {
return true;
}
}
return false;
} | [
"public",
"static",
"function",
"collectionContains",
"(",
"$",
"needle",
",",
"$",
"haystack",
")",
"{",
"foreach",
"(",
"$",
"haystack",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"$",
"needle",
")",
"{",
"return",
"true",
";",
"... | Indicates wether given collection contains the wanted item or not.
@param mixed $needle
@param array $haystack
@return bool | [
"Indicates",
"wether",
"given",
"collection",
"contains",
"the",
"wanted",
"item",
"or",
"not",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/MethodManager/CollectionManager.php#L15-L24 |
crysalead/net | src/Http/Psr7/ServerRequestTrait.php | ServerRequestTrait.withCookieParams | public function withCookieParams(array $cookies)
{
$request = clone $this;
$headers = $request->headers();
$headers['Cookie'] = CookieValues::toString($cookies);
return $request;
} | php | public function withCookieParams(array $cookies)
{
$request = clone $this;
$headers = $request->headers();
$headers['Cookie'] = CookieValues::toString($cookies);
return $request;
} | [
"public",
"function",
"withCookieParams",
"(",
"array",
"$",
"cookies",
")",
"{",
"$",
"request",
"=",
"clone",
"$",
"this",
";",
"$",
"headers",
"=",
"$",
"request",
"->",
"headers",
"(",
")",
";",
"$",
"headers",
"[",
"'Cookie'",
"]",
"=",
"CookieVal... | Return an instance with the specified cookies.
The data IS NOT REQUIRED to come from the $_COOKIE superglobal, but MUST
be compatible with the structure of $_COOKIE. Typically, this data will
be injected at instantiation.
This method MUST NOT update the related Cookie header of the request
instance, nor related value... | [
"Return",
"an",
"instance",
"with",
"the",
"specified",
"cookies",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/ServerRequestTrait.php#L58-L64 |
crysalead/net | src/Http/Psr7/ServerRequestTrait.php | ServerRequestTrait.getParsedBody | public function getParsedBody()
{
$headers = $this->headers();
$contentType = isset($headers['Content-Type']) ? $headers['Content-Type']->value() : null;
if ($contentType === 'application/x-www-form-urlencoded' || $contentType === 'multipart/form-data') {
return $this->form();
... | php | public function getParsedBody()
{
$headers = $this->headers();
$contentType = isset($headers['Content-Type']) ? $headers['Content-Type']->value() : null;
if ($contentType === 'application/x-www-form-urlencoded' || $contentType === 'multipart/form-data') {
return $this->form();
... | [
"public",
"function",
"getParsedBody",
"(",
")",
"{",
"$",
"headers",
"=",
"$",
"this",
"->",
"headers",
"(",
")",
";",
"$",
"contentType",
"=",
"isset",
"(",
"$",
"headers",
"[",
"'Content-Type'",
"]",
")",
"?",
"$",
"headers",
"[",
"'Content-Type'",
... | Retrieve any parameters provided in the request body.
If the request Content-Type is either application/x-www-form-urlencoded
or multipart/form-data, and the request method is POST, this method MUST
return the contents of $_POST.
Otherwise, this method may return any results of deserializing
the request body content;... | [
"Retrieve",
"any",
"parameters",
"provided",
"in",
"the",
"request",
"body",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/ServerRequestTrait.php#L162-L170 |
crysalead/net | src/Http/Psr7/ServerRequestTrait.php | ServerRequestTrait.withParsedBody | public function withParsedBody($data)
{
$request = clone $this;
$headers = $request->headers();
$contentType = isset($headers['Content-Type']) ? $headers['Content-Type']->value() : null;
if ($contentType === 'application/x-www-form-urlencoded' || $contentType === 'multipart/form-data... | php | public function withParsedBody($data)
{
$request = clone $this;
$headers = $request->headers();
$contentType = isset($headers['Content-Type']) ? $headers['Content-Type']->value() : null;
if ($contentType === 'application/x-www-form-urlencoded' || $contentType === 'multipart/form-data... | [
"public",
"function",
"withParsedBody",
"(",
"$",
"data",
")",
"{",
"$",
"request",
"=",
"clone",
"$",
"this",
";",
"$",
"headers",
"=",
"$",
"request",
"->",
"headers",
"(",
")",
";",
"$",
"contentType",
"=",
"isset",
"(",
"$",
"headers",
"[",
"'Con... | Return an instance with the specified body parameters.
These MAY be injected during instantiation.
If the request Content-Type is either application/x-www-form-urlencoded
or multipart/form-data, and the request method is POST, use this method
ONLY to inject the contents of $_POST.
The data IS NOT REQUIRED to come fr... | [
"Return",
"an",
"instance",
"with",
"the",
"specified",
"body",
"parameters",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/ServerRequestTrait.php#L200-L210 |
crysalead/net | src/Http/Psr7/ServerRequestTrait.php | ServerRequestTrait.getAttribute | public function getAttribute($name, $default = null)
{
$params = $this->params();
return isset($params[$name]) ? $params[$name] : $default;
} | php | public function getAttribute($name, $default = null)
{
$params = $this->params();
return isset($params[$name]) ? $params[$name] : $default;
} | [
"public",
"function",
"getAttribute",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"params",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"params",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"para... | Retrieve a single derived request attribute.
Retrieves a single derived request attribute as described in
getAttributes(). If the attribute has not been previously set, returns
the default value as provided.
This method obviates the need for a hasAttribute() method, as it allows
specifying a default value to return i... | [
"Retrieve",
"a",
"single",
"derived",
"request",
"attribute",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/ServerRequestTrait.php#L243-L247 |
crysalead/net | src/Http/Psr7/ServerRequestTrait.php | ServerRequestTrait.withAttribute | public function withAttribute($name, $value)
{
$request = clone $this;
$params = $request->params();
$params[$name] = $value;
$request->params($params);
return $request;
} | php | public function withAttribute($name, $value)
{
$request = clone $this;
$params = $request->params();
$params[$name] = $value;
$request->params($params);
return $request;
} | [
"public",
"function",
"withAttribute",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"request",
"=",
"clone",
"$",
"this",
";",
"$",
"params",
"=",
"$",
"request",
"->",
"params",
"(",
")",
";",
"$",
"params",
"[",
"$",
"name",
"]",
"=",
"$... | Return an instance with the specified derived request attribute.
This method allows setting a single derived request attribute as
described in getAttributes().
This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return an instance that has the
updated attribute.
@see ... | [
"Return",
"an",
"instance",
"with",
"the",
"specified",
"derived",
"request",
"attribute",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/ServerRequestTrait.php#L264-L271 |
crysalead/net | src/Http/Psr7/ServerRequestTrait.php | ServerRequestTrait.withoutAttribute | public function withoutAttribute($name)
{
$request = clone $this;
$params = $request->params();
unset($params[$name]);
$request->params($params);
return $request;
} | php | public function withoutAttribute($name)
{
$request = clone $this;
$params = $request->params();
unset($params[$name]);
$request->params($params);
return $request;
} | [
"public",
"function",
"withoutAttribute",
"(",
"$",
"name",
")",
"{",
"$",
"request",
"=",
"clone",
"$",
"this",
";",
"$",
"params",
"=",
"$",
"request",
"->",
"params",
"(",
")",
";",
"unset",
"(",
"$",
"params",
"[",
"$",
"name",
"]",
")",
";",
... | Return an instance that removes the specified derived request attribute.
This method allows removing a single derived request attribute as
described in getAttributes().
This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return an instance that removes
the attribute.
... | [
"Return",
"an",
"instance",
"that",
"removes",
"the",
"specified",
"derived",
"request",
"attribute",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/ServerRequestTrait.php#L287-L294 |
crysalead/net | src/Transport/Protocol/Http/Curl.php | Curl._initRequest | protected function _initRequest($socket, $response)
{
$stream = $this->_classes['stream'];
$curlOptions = $socket->options();
$curlOptions[CURLOPT_INFILESIZE] = $socket->outgoing()->length();
if (isset($curlOptions[CURLOPT_FILE])) {
$response->body(fopen($curlOptions[CU... | php | protected function _initRequest($socket, $response)
{
$stream = $this->_classes['stream'];
$curlOptions = $socket->options();
$curlOptions[CURLOPT_INFILESIZE] = $socket->outgoing()->length();
if (isset($curlOptions[CURLOPT_FILE])) {
$response->body(fopen($curlOptions[CU... | [
"protected",
"function",
"_initRequest",
"(",
"$",
"socket",
",",
"$",
"response",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"_classes",
"[",
"'stream'",
"]",
";",
"$",
"curlOptions",
"=",
"$",
"socket",
"->",
"options",
"(",
")",
";",
"$",
"c... | Initialize a socket to be ready to send data.
@param integer $max The number of simultaneous allowed connections. | [
"Initialize",
"a",
"socket",
"to",
"be",
"ready",
"to",
"send",
"data",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Http/Curl.php#L117-L134 |
crysalead/net | src/Transport/Protocol/Http/Curl.php | Curl.send | public function send($request, $response, $options = [])
{
$this->push($request, $response, $options);
$result = $this->flush(10, $options);
return $response;
} | php | public function send($request, $response, $options = [])
{
$this->push($request, $response, $options);
$result = $this->flush(10, $options);
return $response;
} | [
"public",
"function",
"send",
"(",
"$",
"request",
",",
"$",
"response",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"push",
"(",
"$",
"request",
",",
"$",
"response",
",",
"$",
"options",
")",
";",
"$",
"result",
"=",
"$",
... | Sends a request.
@param integer $max The number of simultaneous allowed connections.
@return array The response. | [
"Sends",
"a",
"request",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Http/Curl.php#L286-L291 |
crysalead/net | src/Transport/Protocol/Http/Curl.php | Curl.push | public function push($request, $response, $options = [])
{
$socket = $request instanceof $this->_classes['socket'] ? $request : $this($request, $options);
$this->_queue[$socket->id()] = [
'socket' => $socket,
'response' => $response
];
} | php | public function push($request, $response, $options = [])
{
$socket = $request instanceof $this->_classes['socket'] ? $request : $this($request, $options);
$this->_queue[$socket->id()] = [
'socket' => $socket,
'response' => $response
];
} | [
"public",
"function",
"push",
"(",
"$",
"request",
",",
"$",
"response",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"socket",
"=",
"$",
"request",
"instanceof",
"$",
"this",
"->",
"_classes",
"[",
"'socket'",
"]",
"?",
"$",
"request",
":",
... | Push a request in the queue. | [
"Push",
"a",
"request",
"in",
"the",
"queue",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Http/Curl.php#L296-L304 |
crysalead/net | src/Transport/Protocol/Http/Curl.php | Curl.flush | public function flush($max = 10, $options = [])
{
$defaults = [
'selectTimeout' => 1.0
];
$options += $defaults;
do {
$this->select($options['selectTimeout']);
$this->process($max);
} while ($this->_running > 0);
$results = $thi... | php | public function flush($max = 10, $options = [])
{
$defaults = [
'selectTimeout' => 1.0
];
$options += $defaults;
do {
$this->select($options['selectTimeout']);
$this->process($max);
} while ($this->_running > 0);
$results = $thi... | [
"public",
"function",
"flush",
"(",
"$",
"max",
"=",
"10",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"[",
"'selectTimeout'",
"=>",
"1.0",
"]",
";",
"$",
"options",
"+=",
"$",
"defaults",
";",
"do",
"{",
"$",
"this",
"->"... | Runs until all outstanding requests have been completed.
@param integer $max The number of simultaneous allowed connections.
@return array The array of responses. | [
"Runs",
"until",
"all",
"outstanding",
"requests",
"have",
"been",
"completed",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Http/Curl.php#L312-L328 |
crysalead/net | src/Transport/Protocol/Http/Curl.php | Curl.process | public function process($max = 10)
{
$this->_fillup($max);
curl_multi_exec($this->_curl, $this->_running);
while ($info = curl_multi_info_read($this->_curl)) {
$handle = $info['handle'];
$id = (integer) $handle;
if (!isset($this->_handles[$id])) {
... | php | public function process($max = 10)
{
$this->_fillup($max);
curl_multi_exec($this->_curl, $this->_running);
while ($info = curl_multi_info_read($this->_curl)) {
$handle = $info['handle'];
$id = (integer) $handle;
if (!isset($this->_handles[$id])) {
... | [
"public",
"function",
"process",
"(",
"$",
"max",
"=",
"10",
")",
"{",
"$",
"this",
"->",
"_fillup",
"(",
"$",
"max",
")",
";",
"curl_multi_exec",
"(",
"$",
"this",
"->",
"_curl",
",",
"$",
"this",
"->",
"_running",
")",
";",
"while",
"(",
"$",
"... | Process one curl exec call only (non blocking call).
@param integer $max The number of simultaneous allowed connections. | [
"Process",
"one",
"curl",
"exec",
"call",
"only",
"(",
"non",
"blocking",
"call",
")",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Http/Curl.php#L349-L385 |
crysalead/net | src/Transport/Protocol/Http/Curl.php | Curl._fillup | protected function _fillup($max)
{
$nb = $max - $this->_running;
$list = array_splice($this->_queue, 0, $nb);
foreach ($list as $item) {
$handle = $this->_initRequest($item['socket'], $item['response']);
$this->_handles[(integer) $handle] = $item;
curl_mul... | php | protected function _fillup($max)
{
$nb = $max - $this->_running;
$list = array_splice($this->_queue, 0, $nb);
foreach ($list as $item) {
$handle = $this->_initRequest($item['socket'], $item['response']);
$this->_handles[(integer) $handle] = $item;
curl_mul... | [
"protected",
"function",
"_fillup",
"(",
"$",
"max",
")",
"{",
"$",
"nb",
"=",
"$",
"max",
"-",
"$",
"this",
"->",
"_running",
";",
"$",
"list",
"=",
"array_splice",
"(",
"$",
"this",
"->",
"_queue",
",",
"0",
",",
"$",
"nb",
")",
";",
"foreach",... | Fill the multi handle up to the maximum allowed connections.
@param integer $max The number of simultaneous allowed connections. | [
"Fill",
"the",
"multi",
"handle",
"up",
"to",
"the",
"maximum",
"allowed",
"connections",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Transport/Protocol/Http/Curl.php#L392-L401 |
AmsTaFFix/silex-captcha | source/CaptchaServiceProvider.php | CaptchaServiceProvider.register | public function register(Container $app)
{
// Load defaults
foreach ($this->settings as $key => $value) {
$key = 'captcha.'.$key;
if (!isset($app[$key])) {
$app[$key] = $value;
}
}
// Instance of builder
$app['captcha.builde... | php | public function register(Container $app)
{
// Load defaults
foreach ($this->settings as $key => $value) {
$key = 'captcha.'.$key;
if (!isset($app[$key])) {
$app[$key] = $value;
}
}
// Instance of builder
$app['captcha.builde... | [
"public",
"function",
"register",
"(",
"Container",
"$",
"app",
")",
"{",
"// Load defaults",
"foreach",
"(",
"$",
"this",
"->",
"settings",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"key",
"=",
"'captcha.'",
".",
"$",
"key",
";",
"if",
"(... | {@inheritdoc} | [
"{"
] | train | https://github.com/AmsTaFFix/silex-captcha/blob/b61584a18dae2dbd332ae083815e24cb3b61bbdb/source/CaptchaServiceProvider.php#L51-L85 |
AmsTaFFix/silex-captcha | source/CaptchaServiceProvider.php | CaptchaServiceProvider.connect | public function connect(Application $app)
{
/** @var $collection ControllerCollection */
$collection = $app['controllers_factory'];
// Display image and store phrase to the session
// Note: SessionServiceProvider should be enabled
$collection->get(
'/captcha',
... | php | public function connect(Application $app)
{
/** @var $collection ControllerCollection */
$collection = $app['controllers_factory'];
// Display image and store phrase to the session
// Note: SessionServiceProvider should be enabled
$collection->get(
'/captcha',
... | [
"public",
"function",
"connect",
"(",
"Application",
"$",
"app",
")",
"{",
"/** @var $collection ControllerCollection */",
"$",
"collection",
"=",
"$",
"app",
"[",
"'controllers_factory'",
"]",
";",
"// Display image and store phrase to the session",
"// Note: SessionServiceP... | {@inheritdoc} | [
"{"
] | train | https://github.com/AmsTaFFix/silex-captcha/blob/b61584a18dae2dbd332ae083815e24cb3b61bbdb/source/CaptchaServiceProvider.php#L99-L135 |
Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/DateHelper.php | DateHelper.rangeThisWeek | public static function rangeThisWeek()
{
$ts = strtotime(date('Y-m-d')) + 86400;
do {
$ts -= 86400;
$startDate = date('N', $ts);
} while ($startDate != '1');
return [$ts, $ts + (86400 * 6)];
} | php | public static function rangeThisWeek()
{
$ts = strtotime(date('Y-m-d')) + 86400;
do {
$ts -= 86400;
$startDate = date('N', $ts);
} while ($startDate != '1');
return [$ts, $ts + (86400 * 6)];
} | [
"public",
"static",
"function",
"rangeThisWeek",
"(",
")",
"{",
"$",
"ts",
"=",
"strtotime",
"(",
"date",
"(",
"'Y-m-d'",
")",
")",
"+",
"86400",
";",
"do",
"{",
"$",
"ts",
"-=",
"86400",
";",
"$",
"startDate",
"=",
"date",
"(",
"'N'",
",",
"$",
... | Returns a date range for the current week.
@return array | [
"Returns",
"a",
"date",
"range",
"for",
"the",
"current",
"week",
"."
] | train | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/DateHelper.php#L35-L44 |
Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/DateHelper.php | DateHelper.rangeThisMonth | public static function rangeThisMonth()
{
$currentMonth = date('Y-m-01', time());
$currentMonthTs = self::toTs($currentMonth);
return [$currentMonthTs, $currentMonthTs + (86400 * (date('t') - 1))];
} | php | public static function rangeThisMonth()
{
$currentMonth = date('Y-m-01', time());
$currentMonthTs = self::toTs($currentMonth);
return [$currentMonthTs, $currentMonthTs + (86400 * (date('t') - 1))];
} | [
"public",
"static",
"function",
"rangeThisMonth",
"(",
")",
"{",
"$",
"currentMonth",
"=",
"date",
"(",
"'Y-m-01'",
",",
"time",
"(",
")",
")",
";",
"$",
"currentMonthTs",
"=",
"self",
"::",
"toTs",
"(",
"$",
"currentMonth",
")",
";",
"return",
"[",
"$... | Returns a date range for the current month.
@return array | [
"Returns",
"a",
"date",
"range",
"for",
"the",
"current",
"month",
"."
] | train | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/DateHelper.php#L75-L81 |
Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/DateHelper.php | DateHelper.rangeLastMonth | public static function rangeLastMonth()
{
$lastMonth = date('m') - 1;
if ($lastMonth <= 0) {
$lastMonth = 12;
}
$lastMonth = date('Y') . '-' . $lastMonth . '-01';
return [self::toTs($lastMonth), self::toTs($lastMonth) + (86400 * (date('t', strtotime($lastMonth))-... | php | public static function rangeLastMonth()
{
$lastMonth = date('m') - 1;
if ($lastMonth <= 0) {
$lastMonth = 12;
}
$lastMonth = date('Y') . '-' . $lastMonth . '-01';
return [self::toTs($lastMonth), self::toTs($lastMonth) + (86400 * (date('t', strtotime($lastMonth))-... | [
"public",
"static",
"function",
"rangeLastMonth",
"(",
")",
"{",
"$",
"lastMonth",
"=",
"date",
"(",
"'m'",
")",
"-",
"1",
";",
"if",
"(",
"$",
"lastMonth",
"<=",
"0",
")",
"{",
"$",
"lastMonth",
"=",
"12",
";",
"}",
"$",
"lastMonth",
"=",
"date",
... | Returns a date range for the previous month.
@return array | [
"Returns",
"a",
"date",
"range",
"for",
"the",
"previous",
"month",
"."
] | train | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/DateHelper.php#L88-L97 |
Webiny/AnalyticsDb | src/Webiny/AnalyticsDb/DateHelper.php | DateHelper.rangeQ1 | public static function rangeQ1($year = null)
{
$year = empty($year) ? date('Y') : $year;
$start = $year . '-01-01';
$end = $year . '-03-31';
return [self::toTs($start), self::toTs($end)];
} | php | public static function rangeQ1($year = null)
{
$year = empty($year) ? date('Y') : $year;
$start = $year . '-01-01';
$end = $year . '-03-31';
return [self::toTs($start), self::toTs($end)];
} | [
"public",
"static",
"function",
"rangeQ1",
"(",
"$",
"year",
"=",
"null",
")",
"{",
"$",
"year",
"=",
"empty",
"(",
"$",
"year",
")",
"?",
"date",
"(",
"'Y'",
")",
":",
"$",
"year",
";",
"$",
"start",
"=",
"$",
"year",
".",
"'-01-01'",
";",
"$"... | Returns a date range for quarter 1 of the given year.
Note: if the year is not give, the current year is used.
@param int $year
@return array | [
"Returns",
"a",
"date",
"range",
"for",
"quarter",
"1",
"of",
"the",
"given",
"year",
".",
"Note",
":",
"if",
"the",
"year",
"is",
"not",
"give",
"the",
"current",
"year",
"is",
"used",
"."
] | train | https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/DateHelper.php#L162-L169 |
antarestupin/Accessible | lib/Accessible/Configuration.php | Configuration.getAnnotationReader | public static function getAnnotationReader()
{
if (self::$annotationReader === null) {
self::$annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache());
}
return self::$annotationReader;
} | php | public static function getAnnotationReader()
{
if (self::$annotationReader === null) {
self::$annotationReader = new CachedReader(new AnnotationReader(), new ArrayCache());
}
return self::$annotationReader;
} | [
"public",
"static",
"function",
"getAnnotationReader",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"annotationReader",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"annotationReader",
"=",
"new",
"CachedReader",
"(",
"new",
"AnnotationReader",
"(",
")",
",",... | Get the annotation reader that is used.
Initializes it if it doesn't already exists.
@return Reader The annotation reader. | [
"Get",
"the",
"annotation",
"reader",
"that",
"is",
"used",
".",
"Initializes",
"it",
"if",
"it",
"doesn",
"t",
"already",
"exists",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Configuration.php#L70-L77 |
antarestupin/Accessible | lib/Accessible/Configuration.php | Configuration.getConstraintsValidator | public static function getConstraintsValidator()
{
if (self::$constraintsValidator === null) {
self::$constraintsValidator = Validation::createValidatorBuilder()
->enableAnnotationMapping(self::getAnnotationReader())
->getValidator();
}
return sel... | php | public static function getConstraintsValidator()
{
if (self::$constraintsValidator === null) {
self::$constraintsValidator = Validation::createValidatorBuilder()
->enableAnnotationMapping(self::getAnnotationReader())
->getValidator();
}
return sel... | [
"public",
"static",
"function",
"getConstraintsValidator",
"(",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"constraintsValidator",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"constraintsValidator",
"=",
"Validation",
"::",
"createValidatorBuilder",
"(",
")",
"->",... | Get the constraints validator that is used.
Initializes it if it doesn't already exists.
@return ConstraintValidator The annotation reader. | [
"Get",
"the",
"constraints",
"validator",
"that",
"is",
"used",
".",
"Initializes",
"it",
"if",
"it",
"doesn",
"t",
"already",
"exists",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Configuration.php#L95-L104 |
antarestupin/Accessible | lib/Accessible/Configuration.php | Configuration.setCache | private static function setCache(Cache &$cacheToChange = null, Cache $cache = null, $namespace = null)
{
if ($namespace === null) {
$namespace = self::$cacheDefaultNamespace;
}
if (!is_string($namespace)) {
throw new \InvalidArgumentException("The namespace must be a ... | php | private static function setCache(Cache &$cacheToChange = null, Cache $cache = null, $namespace = null)
{
if ($namespace === null) {
$namespace = self::$cacheDefaultNamespace;
}
if (!is_string($namespace)) {
throw new \InvalidArgumentException("The namespace must be a ... | [
"private",
"static",
"function",
"setCache",
"(",
"Cache",
"&",
"$",
"cacheToChange",
"=",
"null",
",",
"Cache",
"$",
"cache",
"=",
"null",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"namespace",
"===",
"null",
")",
"{",
"$",
"name... | Set a cache driver.
@param Cache $cacheToChange The cache to change.
@param Cache $cache The cache driver.
@param string $namespace The cache namespace. | [
"Set",
"a",
"cache",
"driver",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Configuration.php#L173-L186 |
antarestupin/Accessible | lib/Accessible/Configuration.php | Configuration.setCacheDriver | public static function setCacheDriver(Cache $cache = null, $namespace = null)
{
self::setCache(self::$cacheDriver, $cache, $namespace);
} | php | public static function setCacheDriver(Cache $cache = null, $namespace = null)
{
self::setCache(self::$cacheDriver, $cache, $namespace);
} | [
"public",
"static",
"function",
"setCacheDriver",
"(",
"Cache",
"$",
"cache",
"=",
"null",
",",
"$",
"namespace",
"=",
"null",
")",
"{",
"self",
"::",
"setCache",
"(",
"self",
"::",
"$",
"cacheDriver",
",",
"$",
"cache",
",",
"$",
"namespace",
")",
";"... | Set the cache driver that will be used.
@param Cache $cache The cache driver.
@param string $namespace The cache namespace. | [
"Set",
"the",
"cache",
"driver",
"that",
"will",
"be",
"used",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Configuration.php#L204-L207 |
sifophp/sifo-common-instance | classes/HelperPasswordGenerator.php | HelperPasswordGenerator.beNice | public static function beNice( $strength = self::ALL_LOWER_CASE, $lenght = 8, $append_numbers = 2 )
{
$password = '';
$vocals = self::EVEN_CHARS;
$consonants = self::ODD_CHARS;
// Strength 1: Add upper case to vocals.
if ( $strength > 0 )
{
$vocals .= strtoupper( $vocals );
}
// Strength 2: Add u... | php | public static function beNice( $strength = self::ALL_LOWER_CASE, $lenght = 8, $append_numbers = 2 )
{
$password = '';
$vocals = self::EVEN_CHARS;
$consonants = self::ODD_CHARS;
// Strength 1: Add upper case to vocals.
if ( $strength > 0 )
{
$vocals .= strtoupper( $vocals );
}
// Strength 2: Add u... | [
"public",
"static",
"function",
"beNice",
"(",
"$",
"strength",
"=",
"self",
"::",
"ALL_LOWER_CASE",
",",
"$",
"lenght",
"=",
"8",
",",
"$",
"append_numbers",
"=",
"2",
")",
"{",
"$",
"password",
"=",
"''",
";",
"$",
"vocals",
"=",
"self",
"::",
"EVE... | Generate a random human readable password.
@param integer $strength Strength of the password.
@param integer $lenght Lenght of the password (excluding the final numbers).
@param integer $append_numbers Lenght of the number to append.
@return unknown | [
"Generate",
"a",
"random",
"human",
"readable",
"password",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/classes/HelperPasswordGenerator.php#L29-L76 |
bariew/yii2-rbac-cms-module | models/AuthItem.php | AuthItem.checkAccess | public static function checkAccess($permissionName, $user = false, $params = [])
{
if (is_array($permissionName)) {
$permissionName = self::createPermissionName($permissionName);
}
if (!$user) {
$user = Yii::$app->user;
}
if (!$user->isGuest && !isset... | php | public static function checkAccess($permissionName, $user = false, $params = [])
{
if (is_array($permissionName)) {
$permissionName = self::createPermissionName($permissionName);
}
if (!$user) {
$user = Yii::$app->user;
}
if (!$user->isGuest && !isset... | [
"public",
"static",
"function",
"checkAccess",
"(",
"$",
"permissionName",
",",
"$",
"user",
"=",
"false",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"permissionName",
")",
")",
"{",
"$",
"permissionName",
"=",
"self"... | Check whether the user has access to permission.
@param mixed $permissionName permission name or its components for self::createPermissionName.
@param mixed $user user
@param array $params
@return boolean whether user has access to permission name. | [
"Check",
"whether",
"the",
"user",
"has",
"access",
"to",
"permission",
"."
] | train | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/models/AuthItem.php#L102-L127 |
bariew/yii2-rbac-cms-module | models/AuthItem.php | AuthItem.move | public function move($oldParent, $newParent)
{
return $oldParent->removeChild($this)
? $newParent->addChild($this)
: false;
} | php | public function move($oldParent, $newParent)
{
return $oldParent->removeChild($this)
? $newParent->addChild($this)
: false;
} | [
"public",
"function",
"move",
"(",
"$",
"oldParent",
",",
"$",
"newParent",
")",
"{",
"return",
"$",
"oldParent",
"->",
"removeChild",
"(",
"$",
"this",
")",
"?",
"$",
"newParent",
"->",
"addChild",
"(",
"$",
"this",
")",
":",
"false",
";",
"}"
] | Detaches this model from its old parent
and attaches to the new one.
@param AuthItem $oldParent item
@param AuthItem $newParent item
@return boolean whether model has been moved. | [
"Detaches",
"this",
"model",
"from",
"its",
"old",
"parent",
"and",
"attaches",
"to",
"the",
"new",
"one",
"."
] | train | https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/models/AuthItem.php#L302-L307 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.