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 |
|---|---|---|---|---|---|---|---|---|---|---|
DevGroup-ru/yii2-data-structure-tools | src/Properties/actions/ListPropertyGroups.php | ListPropertyGroups.applicablePropertyModels | private function applicablePropertyModels()
{
return Yii::$app->cache->lazy(function () {
$query = new Query();
$rows = $query
->select(['id', 'class_name', 'name'])
->from(ApplicablePropertyModels::tableName())
->indexBy('id')
... | php | private function applicablePropertyModels()
{
return Yii::$app->cache->lazy(function () {
$query = new Query();
$rows = $query
->select(['id', 'class_name', 'name'])
->from(ApplicablePropertyModels::tableName())
->indexBy('id')
... | [
"private",
"function",
"applicablePropertyModels",
"(",
")",
"{",
"return",
"Yii",
"::",
"$",
"app",
"->",
"cache",
"->",
"lazy",
"(",
"function",
"(",
")",
"{",
"$",
"query",
"=",
"new",
"Query",
"(",
")",
";",
"$",
"rows",
"=",
"$",
"query",
"->",
... | Returns applicable property models rows indexed by id and containing class_name and name.
The difference from PropertiesHelper::applicablePropertyModels is in array structure and having name field.
@return array | [
"Returns",
"applicable",
"property",
"models",
"rows",
"indexed",
"by",
"id",
"and",
"containing",
"class_name",
"and",
"name",
".",
"The",
"difference",
"from",
"PropertiesHelper",
"::",
"applicablePropertyModels",
"is",
"in",
"array",
"structure",
"and",
"having",... | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/Properties/actions/ListPropertyGroups.php#L71-L96 |
ipunkt/social-auth | src/Ipunkt/SocialAuth/SocialAuthServiceProvider.php | SocialAuthServiceProvider.register | public function register()
{
$this->setHybridauth();
$this->setBinds();
Event::listen('auth.logout', 'Ipunkt\SocialAuth\SocialLoginController@logout');
Event::listen('social-auth.register', 'Ipunkt\SocialAuth\EventListeners\UpdateProfileEventListener@register');
Event::listen('social-auth.attach', 'Ipunkt\S... | php | public function register()
{
$this->setHybridauth();
$this->setBinds();
Event::listen('auth.logout', 'Ipunkt\SocialAuth\SocialLoginController@logout');
Event::listen('social-auth.register', 'Ipunkt\SocialAuth\EventListeners\UpdateProfileEventListener@register');
Event::listen('social-auth.attach', 'Ipunkt\S... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"setHybridauth",
"(",
")",
";",
"$",
"this",
"->",
"setBinds",
"(",
")",
";",
"Event",
"::",
"listen",
"(",
"'auth.logout'",
",",
"'Ipunkt\\SocialAuth\\SocialLoginController@logout'",
")",
";"... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/Ipunkt/SocialAuth/SocialAuthServiceProvider.php#L36-L44 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.retrieveApplicablePropertyModels | private static function retrieveApplicablePropertyModels($forceRefresh = false)
{
if ($forceRefresh === true) {
Yii::$app->cache->delete('ApplicablePropertyModels');
static::$applicablePropertyModels = null;
}
if (static::$applicablePropertyModels === null) {
... | php | private static function retrieveApplicablePropertyModels($forceRefresh = false)
{
if ($forceRefresh === true) {
Yii::$app->cache->delete('ApplicablePropertyModels');
static::$applicablePropertyModels = null;
}
if (static::$applicablePropertyModels === null) {
... | [
"private",
"static",
"function",
"retrieveApplicablePropertyModels",
"(",
"$",
"forceRefresh",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"forceRefresh",
"===",
"true",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"cache",
"->",
"delete",
"(",
"'ApplicablePropertyMod... | @param bool|false $forceRefresh
@return array | [
"@param",
"bool|false",
"$forceRefresh"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L34-L68 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.applicablePropertyModelId | public static function applicablePropertyModelId($class, $forceRefresh = false)
{
//ability to store properties of all model heirs in the one set of tables
if (true === method_exists($class, 'getApplicableClass')) {
$modelClass = call_user_func([$class, 'getApplicableClass']);
} ... | php | public static function applicablePropertyModelId($class, $forceRefresh = false)
{
//ability to store properties of all model heirs in the one set of tables
if (true === method_exists($class, 'getApplicableClass')) {
$modelClass = call_user_func([$class, 'getApplicableClass']);
} ... | [
"public",
"static",
"function",
"applicablePropertyModelId",
"(",
"$",
"class",
",",
"$",
"forceRefresh",
"=",
"false",
")",
"{",
"//ability to store properties of all model heirs in the one set of tables",
"if",
"(",
"true",
"===",
"method_exists",
"(",
"$",
"class",
"... | Returns id of property_group_models record for requested classname
@param ActiveRecord | string $class
@param bool|false $forceRefresh
@return integer
@throws \yii\base\Exception | [
"Returns",
"id",
"of",
"property_group_models",
"record",
"for",
"requested",
"classname"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L79-L94 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.classNameForApplicablePropertyModelId | public static function classNameForApplicablePropertyModelId($id, $forceRefresh = false)
{
self::retrieveApplicablePropertyModels($forceRefresh);
return array_search($id, self::$applicablePropertyModels, true);
} | php | public static function classNameForApplicablePropertyModelId($id, $forceRefresh = false)
{
self::retrieveApplicablePropertyModels($forceRefresh);
return array_search($id, self::$applicablePropertyModels, true);
} | [
"public",
"static",
"function",
"classNameForApplicablePropertyModelId",
"(",
"$",
"id",
",",
"$",
"forceRefresh",
"=",
"false",
")",
"{",
"self",
"::",
"retrieveApplicablePropertyModels",
"(",
"$",
"forceRefresh",
")",
";",
"return",
"array_search",
"(",
"$",
"id... | Returns class name of Model for which property or property_group model record is associated
@param string $id
@param bool|false $forceRefresh
@return string|false | [
"Returns",
"class",
"name",
"of",
"Model",
"for",
"which",
"property",
"or",
"property_group",
"model",
"record",
"is",
"associated"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L104-L108 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.fillProperties | public static function fillProperties(&$models, $frontend = false)
{
if (count($models) === 0) {
return [];
}
//! @todo Add check for not retrieving properties twice
static::fillPropertyGroups($models);
static::ensurePropertiesAttributes($models);
$stora... | php | public static function fillProperties(&$models, $frontend = false)
{
if (count($models) === 0) {
return [];
}
//! @todo Add check for not retrieving properties twice
static::fillPropertyGroups($models);
static::ensurePropertiesAttributes($models);
$stora... | [
"public",
"static",
"function",
"fillProperties",
"(",
"&",
"$",
"models",
",",
"$",
"frontend",
"=",
"false",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"models",
")",
"===",
"0",
")",
"{",
"return",
"[",
"]",
";",
"}",
"//! @todo Add check for not retriev... | @param \yii\db\ActiveRecord[] $models
@param bool $frontend
@return array|\yii\db\ActiveRecord[] | [
"@param",
"\\",
"yii",
"\\",
"db",
"\\",
"ActiveRecord",
"[]",
"$models",
"@param",
"bool",
"$frontend"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L127-L157 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.generateCacheKey | public static function generateCacheKey($models, $postfix = 'properties')
{
$ids = ArrayHelper::getColumn($models, 'id', false);
sort($ids);
/** @var \yii\db\ActiveRecord $first */
$first = reset($models);
return $first::tableName() . ':' . implode(',', $ids) . "-$postfix";
... | php | public static function generateCacheKey($models, $postfix = 'properties')
{
$ids = ArrayHelper::getColumn($models, 'id', false);
sort($ids);
/** @var \yii\db\ActiveRecord $first */
$first = reset($models);
return $first::tableName() . ':' . implode(',', $ids) . "-$postfix";
... | [
"public",
"static",
"function",
"generateCacheKey",
"(",
"$",
"models",
",",
"$",
"postfix",
"=",
"'properties'",
")",
"{",
"$",
"ids",
"=",
"ArrayHelper",
"::",
"getColumn",
"(",
"$",
"models",
",",
"'id'",
",",
"false",
")",
";",
"sort",
"(",
"$",
"i... | Generates cache key based on models array, model table name and postfix
@param \yii\db\ActiveRecord[] $models
@param string $postfix
@return string | [
"Generates",
"cache",
"key",
"based",
"on",
"models",
"array",
"model",
"table",
"name",
"and",
"postfix"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L167-L174 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.deleteAllProperties | public static function deleteAllProperties(&$models)
{
$storageHandlers = PropertyStorageHelper::getHandlersForModel(reset($models));
Yii::beginProfile('Fill properties for models');
foreach ($storageHandlers as $handler) {
Yii::beginProfile($handler);
$handler->de... | php | public static function deleteAllProperties(&$models)
{
$storageHandlers = PropertyStorageHelper::getHandlersForModel(reset($models));
Yii::beginProfile('Fill properties for models');
foreach ($storageHandlers as $handler) {
Yii::beginProfile($handler);
$handler->de... | [
"public",
"static",
"function",
"deleteAllProperties",
"(",
"&",
"$",
"models",
")",
"{",
"$",
"storageHandlers",
"=",
"PropertyStorageHelper",
"::",
"getHandlersForModel",
"(",
"reset",
"(",
"$",
"models",
")",
")",
";",
"Yii",
"::",
"beginProfile",
"(",
"'Fi... | Deletes all properties binded to $models
@param \yii\db\ActiveRecord[] $models
@return \yii\db\ActiveRecord[] | [
"Deletes",
"all",
"properties",
"binded",
"to",
"$models"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L183-L198 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.fillPropertyGroups | public static function fillPropertyGroups(&$models)
{
if (count($models) === 0) {
return [];
}
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait|\DevGroup\TagDependencyHelper\TagDependencyTrait $firstModel */
$firstModel = reset($models);
... | php | public static function fillPropertyGroups(&$models)
{
if (count($models) === 0) {
return [];
}
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait|\DevGroup\TagDependencyHelper\TagDependencyTrait $firstModel */
$firstModel = reset($models);
... | [
"public",
"static",
"function",
"fillPropertyGroups",
"(",
"&",
"$",
"models",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"models",
")",
"===",
"0",
")",
"{",
"return",
"[",
"]",
";",
"}",
"/** @var \\yii\\db\\ActiveRecord|\\DevGroup\\DataStructure\\traits\\Propertie... | Fills all $models with corresponding binded property_group_ids
@param \yii\db\ActiveRecord[]|\DevGroup\DataStructure\traits\PropertiesTrait[] $models
@return \yii\db\ActiveRecord[]
@throws Exception | [
"Fills",
"all",
"$models",
"with",
"corresponding",
"binded",
"property_group_ids"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L208-L266 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.getInCondition | public static function getInCondition(&$models)
{
$inArray = array_filter(
ArrayHelper::getColumn($models, 'id', false),
function ($val) {
return $val !== null;
}
);
return $inArray === [] ? [] : ['model_id' => $inArray];
} | php | public static function getInCondition(&$models)
{
$inArray = array_filter(
ArrayHelper::getColumn($models, 'id', false),
function ($val) {
return $val !== null;
}
);
return $inArray === [] ? [] : ['model_id' => $inArray];
} | [
"public",
"static",
"function",
"getInCondition",
"(",
"&",
"$",
"models",
")",
"{",
"$",
"inArray",
"=",
"array_filter",
"(",
"ArrayHelper",
"::",
"getColumn",
"(",
"$",
"models",
",",
"'id'",
",",
"false",
")",
",",
"function",
"(",
"$",
"val",
")",
... | Returns fast IN condition for $models array without PDO param binding which is not necessary for integers
@param \yii\db\ActiveRecord[] $models
@return string | [
"Returns",
"fast",
"IN",
"condition",
"for",
"$models",
"array",
"without",
"PDO",
"param",
"binding",
"which",
"is",
"not",
"necessary",
"for",
"integers"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L275-L285 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.bindGroupToModels | public static function bindGroupToModels(&$models, PropertyGroup $propertyGroup)
{
foreach ($models as &$model) {
$model->ensurePropertyGroupIds();
if (in_array($propertyGroup->id, $model->propertyGroupIds) === true) {
// maybe it'll be better to throw special excepti... | php | public static function bindGroupToModels(&$models, PropertyGroup $propertyGroup)
{
foreach ($models as &$model) {
$model->ensurePropertyGroupIds();
if (in_array($propertyGroup->id, $model->propertyGroupIds) === true) {
// maybe it'll be better to throw special excepti... | [
"public",
"static",
"function",
"bindGroupToModels",
"(",
"&",
"$",
"models",
",",
"PropertyGroup",
"$",
"propertyGroup",
")",
"{",
"foreach",
"(",
"$",
"models",
"as",
"&",
"$",
"model",
")",
"{",
"$",
"model",
"->",
"ensurePropertyGroupIds",
"(",
")",
";... | @param \yii\db\ActiveRecord[]|\DevGroup\DataStructure\traits\PropertiesTrait[] $models
@param PropertyGroup $propertyGroup
@return bool | [
"@param",
"\\",
"yii",
"\\",
"db",
"\\",
"ActiveRecord",
"[]",
"|",
"\\",
"DevGroup",
"\\",
"DataStructure",
"\\",
"traits",
"\\",
"PropertiesTrait",
"[]",
"$models",
"@param",
"PropertyGroup",
"$propertyGroup"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L293-L320 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.unbindGroupFromModels | public static function unbindGroupFromModels(&$models, PropertyGroup $propertyGroup)
{
foreach ($models as $model) {
if (in_array($propertyGroup->id, $model->propertyGroupIds) === false) {
// maybe it'll be better to throw special exception in such case
return fal... | php | public static function unbindGroupFromModels(&$models, PropertyGroup $propertyGroup)
{
foreach ($models as $model) {
if (in_array($propertyGroup->id, $model->propertyGroupIds) === false) {
// maybe it'll be better to throw special exception in such case
return fal... | [
"public",
"static",
"function",
"unbindGroupFromModels",
"(",
"&",
"$",
"models",
",",
"PropertyGroup",
"$",
"propertyGroup",
")",
"{",
"foreach",
"(",
"$",
"models",
"as",
"$",
"model",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"propertyGroup",
"->",
"id... | @param \yii\db\ActiveRecord[]|\DevGroup\DataStructure\traits\PropertiesTrait[] $models
@param PropertyGroup $propertyGroup
@return bool | [
"@param",
"\\",
"yii",
"\\",
"db",
"\\",
"ActiveRecord",
"[]",
"|",
"\\",
"DevGroup",
"\\",
"DataStructure",
"\\",
"traits",
"\\",
"PropertiesTrait",
"[]",
"$models",
"@param",
"PropertyGroup",
"$propertyGroup"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L328-L365 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.storeValues | public static function storeValues(&$models)
{
// first filter out models that has no changed properties
$changedModels = array_filter(
$models,
function ($model) {
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $model */
... | php | public static function storeValues(&$models)
{
// first filter out models that has no changed properties
$changedModels = array_filter(
$models,
function ($model) {
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $model */
... | [
"public",
"static",
"function",
"storeValues",
"(",
"&",
"$",
"models",
")",
"{",
"// first filter out models that has no changed properties",
"$",
"changedModels",
"=",
"array_filter",
"(",
"$",
"models",
",",
"function",
"(",
"$",
"model",
")",
"{",
"/** @var \\yi... | @param \yii\db\ActiveRecord[]|\DevGroup\DataStructure\traits\PropertiesTrait[] $models
@return boolean | [
"@param",
"\\",
"yii",
"\\",
"db",
"\\",
"ActiveRecord",
"[]",
"|",
"\\",
"DevGroup",
"\\",
"DataStructure",
"\\",
"traits",
"\\",
"PropertiesTrait",
"[]",
"$models"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L372-L393 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.idToArrayIndex | public static function idToArrayIndex(&$models)
{
$result = [];
foreach ($models as $index => &$model) {
$result[$model->id] = $index;
}
return $result;
} | php | public static function idToArrayIndex(&$models)
{
$result = [];
foreach ($models as $index => &$model) {
$result[$model->id] = $index;
}
return $result;
} | [
"public",
"static",
"function",
"idToArrayIndex",
"(",
"&",
"$",
"models",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"models",
"as",
"$",
"index",
"=>",
"&",
"$",
"model",
")",
"{",
"$",
"result",
"[",
"$",
"model",
"->",
... | @param $models
@return array Array where key is model.id and value is model's index in array of $models | [
"@param",
"$models"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L400-L407 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.getPropertyModel | public static function getPropertyModel($model, $attribute)
{
$propertyId = array_search($attribute, $model->propertiesAttributes, true);
if ($propertyId === false) {
return null;
}
return Property::findById($propertyId, false);
} | php | public static function getPropertyModel($model, $attribute)
{
$propertyId = array_search($attribute, $model->propertiesAttributes, true);
if ($propertyId === false) {
return null;
}
return Property::findById($propertyId, false);
} | [
"public",
"static",
"function",
"getPropertyModel",
"(",
"$",
"model",
",",
"$",
"attribute",
")",
"{",
"$",
"propertyId",
"=",
"array_search",
"(",
"$",
"attribute",
",",
"$",
"model",
"->",
"propertiesAttributes",
",",
"true",
")",
";",
"if",
"(",
"$",
... | @param \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $model
@param string $attribute
@return Property | null | [
"@param",
"\\",
"yii",
"\\",
"db",
"\\",
"ActiveRecord|",
"\\",
"DevGroup",
"\\",
"DataStructure",
"\\",
"traits",
"\\",
"PropertiesTrait",
"$model",
"@param",
"string",
"$attribute"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L415-L422 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.getAvailablePropertyGroupsList | public static function getAvailablePropertyGroupsList($className)
{
$applicablePropertyModelId = PropertiesHelper::applicablePropertyModelId($className);
$availableGroups = Yii::$app->cache->lazy(
function () use ($applicablePropertyModelId) {
return ArrayHelper::map(
... | php | public static function getAvailablePropertyGroupsList($className)
{
$applicablePropertyModelId = PropertiesHelper::applicablePropertyModelId($className);
$availableGroups = Yii::$app->cache->lazy(
function () use ($applicablePropertyModelId) {
return ArrayHelper::map(
... | [
"public",
"static",
"function",
"getAvailablePropertyGroupsList",
"(",
"$",
"className",
")",
"{",
"$",
"applicablePropertyModelId",
"=",
"PropertiesHelper",
"::",
"applicablePropertyModelId",
"(",
"$",
"className",
")",
";",
"$",
"availableGroups",
"=",
"Yii",
"::",
... | Get available property groups by class name.
@param string $className
@return array
@throws Exception | [
"Get",
"available",
"property",
"groups",
"by",
"class",
"name",
"."
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L432-L453 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.getAttributeNamesByClassName | public static function getAttributeNamesByClassName($className = '', $throwException = false)
{
$except = false;
if (empty($className) === false) {
$model = new $className;
if ($model instanceof Model) {
/** @var $model Model */
return $model->... | php | public static function getAttributeNamesByClassName($className = '', $throwException = false)
{
$except = false;
if (empty($className) === false) {
$model = new $className;
if ($model instanceof Model) {
/** @var $model Model */
return $model->... | [
"public",
"static",
"function",
"getAttributeNamesByClassName",
"(",
"$",
"className",
"=",
"''",
",",
"$",
"throwException",
"=",
"false",
")",
"{",
"$",
"except",
"=",
"false",
";",
"if",
"(",
"empty",
"(",
"$",
"className",
")",
"===",
"false",
")",
"... | @param string $className
@param bool $throwException
@return array
@throws Exception | [
"@param",
"string",
"$className",
"@param",
"bool",
"$throwException"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L491-L508 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesHelper.php | PropertiesHelper.getRelatedEntitiesByProperty | public static function getRelatedEntitiesByProperty($property, $model)
{
if ($property->handler() instanceof RelatedEntity === false) {
throw new Exception(Yii::t('app', 'Set correct property handler'));
}
$handlerParam = ArrayHelper::getValue($property->params, Property::PACKED_... | php | public static function getRelatedEntitiesByProperty($property, $model)
{
if ($property->handler() instanceof RelatedEntity === false) {
throw new Exception(Yii::t('app', 'Set correct property handler'));
}
$handlerParam = ArrayHelper::getValue($property->params, Property::PACKED_... | [
"public",
"static",
"function",
"getRelatedEntitiesByProperty",
"(",
"$",
"property",
",",
"$",
"model",
")",
"{",
"if",
"(",
"$",
"property",
"->",
"handler",
"(",
")",
"instanceof",
"RelatedEntity",
"===",
"false",
")",
"{",
"throw",
"new",
"Exception",
"(... | @param Property $property
@param ActiveRecord $model
@throws Exception | [
"@param",
"Property",
"$property",
"@param",
"ActiveRecord",
"$model"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesHelper.php#L516-L530 |
mimmi20/Wurfl | src/Handlers/Chain/UserAgentHandlerChain.php | UserAgentHandlerChain.filter | public function filter($userAgent, $deviceID)
{
Utils::reset();
$genericNormalizer = UserAgentHandlerChainFactory::createGenericNormalizers();
$userAgent = $genericNormalizer->normalize($userAgent);
$handlers = $this->getHandlers();
foreach ($handlers as $handler) ... | php | public function filter($userAgent, $deviceID)
{
Utils::reset();
$genericNormalizer = UserAgentHandlerChainFactory::createGenericNormalizers();
$userAgent = $genericNormalizer->normalize($userAgent);
$handlers = $this->getHandlers();
foreach ($handlers as $handler) ... | [
"public",
"function",
"filter",
"(",
"$",
"userAgent",
",",
"$",
"deviceID",
")",
"{",
"Utils",
"::",
"reset",
"(",
")",
";",
"$",
"genericNormalizer",
"=",
"UserAgentHandlerChainFactory",
"::",
"createGenericNormalizers",
"(",
")",
";",
"$",
"userAgent",
"=",... | Adds the pair $userAgent, $deviceID to the clusters they belong to.
@param string $userAgent
@param string $deviceID
@see \Wurfl\Handlers\AbstractHandler::filter() | [
"Adds",
"the",
"pair",
"$userAgent",
"$deviceID",
"to",
"the",
"clusters",
"they",
"belong",
"to",
"."
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Chain/UserAgentHandlerChain.php#L82-L99 |
mimmi20/Wurfl | src/Handlers/Chain/UserAgentHandlerChain.php | UserAgentHandlerChain.match | public function match(GenericRequest $request)
{
Utils::reset();
$handlers = $this->getHandlers();
$matchResult = WurflConstants::NO_MATCH;
foreach ($handlers as $handler) {
/** @var $handler \Wurfl\Handlers\AbstractHandler */
$handler->setLogger($this->l... | php | public function match(GenericRequest $request)
{
Utils::reset();
$handlers = $this->getHandlers();
$matchResult = WurflConstants::NO_MATCH;
foreach ($handlers as $handler) {
/** @var $handler \Wurfl\Handlers\AbstractHandler */
$handler->setLogger($this->l... | [
"public",
"function",
"match",
"(",
"GenericRequest",
"$",
"request",
")",
"{",
"Utils",
"::",
"reset",
"(",
")",
";",
"$",
"handlers",
"=",
"$",
"this",
"->",
"getHandlers",
"(",
")",
";",
"$",
"matchResult",
"=",
"WurflConstants",
"::",
"NO_MATCH",
";"... | Return the the device id for the request
@param \Wurfl\Request\GenericRequest $request
@return string deviceID | [
"Return",
"the",
"the",
"device",
"id",
"for",
"the",
"request"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Chain/UserAgentHandlerChain.php#L108-L126 |
mimmi20/Wurfl | src/Handlers/Chain/UserAgentHandlerChain.php | UserAgentHandlerChain.persistData | public function persistData()
{
$handlers = $this->getHandlers();
foreach ($handlers as $handler) {
/** @var $handler \Wurfl\Handlers\AbstractHandler */
$handler->setLogger($this->logger);
$handler->persistData();
}
} | php | public function persistData()
{
$handlers = $this->getHandlers();
foreach ($handlers as $handler) {
/** @var $handler \Wurfl\Handlers\AbstractHandler */
$handler->setLogger($this->logger);
$handler->persistData();
}
} | [
"public",
"function",
"persistData",
"(",
")",
"{",
"$",
"handlers",
"=",
"$",
"this",
"->",
"getHandlers",
"(",
")",
";",
"foreach",
"(",
"$",
"handlers",
"as",
"$",
"handler",
")",
"{",
"/** @var $handler \\Wurfl\\Handlers\\AbstractHandler */",
"$",
"handler",... | Save the data from each \Wurfl\Handlers\AbstractHandler
@see \Wurfl\Handlers\AbstractHandler::persistData() | [
"Save",
"the",
"data",
"from",
"each",
"\\",
"Wurfl",
"\\",
"Handlers",
"\\",
"AbstractHandler"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Chain/UserAgentHandlerChain.php#L133-L143 |
mimmi20/Wurfl | src/Handlers/Chain/UserAgentHandlerChain.php | UserAgentHandlerChain.collectData | public function collectData()
{
$userAgents = array();
$handlers = $this->getHandlers();
foreach ($handlers as $handler) {
/* @var $handler \Wurfl\Handlers\AbstractHandler */
$handler->setLogger($this->logger);
$current = $handler->getUserAgentsWithDev... | php | public function collectData()
{
$userAgents = array();
$handlers = $this->getHandlers();
foreach ($handlers as $handler) {
/* @var $handler \Wurfl\Handlers\AbstractHandler */
$handler->setLogger($this->logger);
$current = $handler->getUserAgentsWithDev... | [
"public",
"function",
"collectData",
"(",
")",
"{",
"$",
"userAgents",
"=",
"array",
"(",
")",
";",
"$",
"handlers",
"=",
"$",
"this",
"->",
"getHandlers",
"(",
")",
";",
"foreach",
"(",
"$",
"handlers",
"as",
"$",
"handler",
")",
"{",
"/* @var $handle... | Collect data
@return array data | [
"Collect",
"data"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Chain/UserAgentHandlerChain.php#L150-L167 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Normalizer/XmlFile/Normalizer.php | Normalizer.normalize | public function normalize($data, Resource $resource)
{
$validator = new ExceptionValidator(new ArrayValidator([
'requiredKeys' => ['name'],
'optionalKeys' => ['property'],
'allowExtra' => false,
]));
$validator->validate($data['value']);
$de... | php | public function normalize($data, Resource $resource)
{
$validator = new ExceptionValidator(new ArrayValidator([
'requiredKeys' => ['name'],
'optionalKeys' => ['property'],
'allowExtra' => false,
]));
$validator->validate($data['value']);
$de... | [
"public",
"function",
"normalize",
"(",
"$",
"data",
",",
"Resource",
"$",
"resource",
")",
"{",
"$",
"validator",
"=",
"new",
"ExceptionValidator",
"(",
"new",
"ArrayValidator",
"(",
"[",
"'requiredKeys'",
"=>",
"[",
"'name'",
"]",
",",
"'optionalKeys'",
"=... | @param mixed $data
@param \Yosmanyga\Resource\Resource $resource
@return mixed | [
"@param",
"mixed",
"$data",
"@param",
"\\",
"Yosmanyga",
"\\",
"Resource",
"\\",
"Resource",
"$resource"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Normalizer/XmlFile/Normalizer.php#L47-L66 |
todstoychev/icr | src/Manipulator/ManipulatorFactory.php | ManipulatorFactory.create | public function create($operation)
{
if (!is_string($operation)) {
throw new \LogicException("Provided manipulation name {$operation} is not a string!");
}
$operation = str_replace('-', ' ', $operation);
$operation = strtolower($operation);
$operation = ucwords($... | php | public function create($operation)
{
if (!is_string($operation)) {
throw new \LogicException("Provided manipulation name {$operation} is not a string!");
}
$operation = str_replace('-', ' ', $operation);
$operation = strtolower($operation);
$operation = ucwords($... | [
"public",
"function",
"create",
"(",
"$",
"operation",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"operation",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"\"Provided manipulation name {$operation} is not a string!\"",
")",
";",
"}",
"$",
... | Creates manipulation instance
@param string $operation Operation name
@return mixed | [
"Creates",
"manipulation",
"instance"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Manipulator/ManipulatorFactory.php#L43-L61 |
pyaesone17/sms-poh | src/SmsPohChannel.php | SmsPohChannel.send | public function send($notifiable, Notification $notification)
{
$client = new SmsClient($this->endPoint, $this->token);
$payload = $notification->toMMSms($notifiable);
$client->send($payload);
} | php | public function send($notifiable, Notification $notification)
{
$client = new SmsClient($this->endPoint, $this->token);
$payload = $notification->toMMSms($notifiable);
$client->send($payload);
} | [
"public",
"function",
"send",
"(",
"$",
"notifiable",
",",
"Notification",
"$",
"notification",
")",
"{",
"$",
"client",
"=",
"new",
"SmsClient",
"(",
"$",
"this",
"->",
"endPoint",
",",
"$",
"this",
"->",
"token",
")",
";",
"$",
"payload",
"=",
"$",
... | Send the given notification.
@param mixed $notifiable
@param \Illuminate\Notifications\Notification $notification
@return void | [
"Send",
"the",
"given",
"notification",
"."
] | train | https://github.com/pyaesone17/sms-poh/blob/c5ee88c47da886f1209b08b48c28852a90e916f4/src/SmsPohChannel.php#L22-L28 |
rinvex/renamed-tenants | src/Models/Tenant.php | Tenant.scopeOfOwner | public function scopeOfOwner(Builder $builder, Model $owner): Builder
{
return $builder->where('owner_type', $owner->getMorphClass())->where('owner_id', $owner->getKey());
} | php | public function scopeOfOwner(Builder $builder, Model $owner): Builder
{
return $builder->where('owner_type', $owner->getMorphClass())->where('owner_id', $owner->getKey());
} | [
"public",
"function",
"scopeOfOwner",
"(",
"Builder",
"$",
"builder",
",",
"Model",
"$",
"owner",
")",
":",
"Builder",
"{",
"return",
"$",
"builder",
"->",
"where",
"(",
"'owner_type'",
",",
"$",
"owner",
"->",
"getMorphClass",
"(",
")",
")",
"->",
"wher... | Get tenants of the given owner.
@param \Illuminate\Database\Eloquent\Builder $builder
@param \Illuminate\Database\Eloquent\Model $owner
@return \Illuminate\Database\Eloquent\Builder | [
"Get",
"tenants",
"of",
"the",
"given",
"owner",
"."
] | train | https://github.com/rinvex/renamed-tenants/blob/2608656011a55547909251f3667699e1932cfc28/src/Models/Tenant.php#L255-L258 |
wshafer/assetmanager-core | src/Service/AssetFilterManager.php | AssetFilterManager.setFilters | public function setFilters($path, AssetInterface $asset)
{
$filters = $this->getFilters($path, $asset);
foreach ($filters as $filter) {
$this->setFilter($filter, $asset);
}
} | php | public function setFilters($path, AssetInterface $asset)
{
$filters = $this->getFilters($path, $asset);
foreach ($filters as $filter) {
$this->setFilter($filter, $asset);
}
} | [
"public",
"function",
"setFilters",
"(",
"$",
"path",
",",
"AssetInterface",
"$",
"asset",
")",
"{",
"$",
"filters",
"=",
"$",
"this",
"->",
"getFilters",
"(",
"$",
"path",
",",
"$",
"asset",
")",
";",
"foreach",
"(",
"$",
"filters",
"as",
"$",
"filt... | See if there are filters for the asset, and if so, set them.
@param string $path
@param AssetInterface $asset
@throws Exception\RuntimeException on invalid filters | [
"See",
"if",
"there",
"are",
"filters",
"for",
"the",
"asset",
"and",
"if",
"so",
"set",
"them",
"."
] | train | https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Service/AssetFilterManager.php#L66-L73 |
wshafer/assetmanager-core | src/Service/AssetFilterManager.php | AssetFilterManager.getFilters | protected function getFilters($path, AssetInterface $asset)
{
$config = $this->getConfig();
if (!empty($config[$path])) {
return $config[$path];
}
if (!empty($asset->mimetype) && !empty($config[$asset->mimetype])) {
return $config[$asset->mimetype];
... | php | protected function getFilters($path, AssetInterface $asset)
{
$config = $this->getConfig();
if (!empty($config[$path])) {
return $config[$path];
}
if (!empty($asset->mimetype) && !empty($config[$asset->mimetype])) {
return $config[$asset->mimetype];
... | [
"protected",
"function",
"getFilters",
"(",
"$",
"path",
",",
"AssetInterface",
"$",
"asset",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfig",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"config",
"[",
"$",
"path",
"]",
")",
")",... | Get the filters from config based on path, mimetype or extension.
@param string $path
@param AssetInterface $asset
@return array|mixed | [
"Get",
"the",
"filters",
"from",
"config",
"based",
"on",
"path",
"mimetype",
"or",
"extension",
"."
] | train | https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Service/AssetFilterManager.php#L83-L102 |
wshafer/assetmanager-core | src/Service/AssetFilterManager.php | AssetFilterManager.setFilter | protected function setFilter($filter, AssetInterface $asset)
{
if (is_null($filter)) {
return;
}
if (!empty($filter['filter'])) {
$this->ensureByFilter($asset, $filter['filter']);
return;
}
if (!empty($filter['service'])) {
$... | php | protected function setFilter($filter, AssetInterface $asset)
{
if (is_null($filter)) {
return;
}
if (!empty($filter['filter'])) {
$this->ensureByFilter($asset, $filter['filter']);
return;
}
if (!empty($filter['service'])) {
$... | [
"protected",
"function",
"setFilter",
"(",
"$",
"filter",
",",
"AssetInterface",
"$",
"asset",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"filter",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"empty",
"(",
"$",
"filter",
"[",
"'filter'",
"]",
... | Set the filter by filter or service
@param string $filter
@param AssetInterface $asset | [
"Set",
"the",
"filter",
"by",
"filter",
"or",
"service"
] | train | https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Service/AssetFilterManager.php#L110-L131 |
GrupaZero/vanilla-integration | src/Gzero/Vanilla/VanillaController.php | VanillaController.index | public function index(Request $request)
{
$referrerDomain = parse_url($request->server('HTTP_REFERER'), PHP_URL_HOST);
if ($referrerDomain !== $this->config->get('vanilla-integration.forum_domain')) {
return app()->abort(404);
}
if (class_exists('Debugbar')) {
... | php | public function index(Request $request)
{
$referrerDomain = parse_url($request->server('HTTP_REFERER'), PHP_URL_HOST);
if ($referrerDomain !== $this->config->get('vanilla-integration.forum_domain')) {
return app()->abort(404);
}
if (class_exists('Debugbar')) {
... | [
"public",
"function",
"index",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"referrerDomain",
"=",
"parse_url",
"(",
"$",
"request",
"->",
"server",
"(",
"'HTTP_REFERER'",
")",
",",
"PHP_URL_HOST",
")",
";",
"if",
"(",
"$",
"referrerDomain",
"!==",
"$",
... | Connect method. It's returning JSONP response
@param Request $request
@return string | [
"Connect",
"method",
".",
"It",
"s",
"returning",
"JSONP",
"response"
] | train | https://github.com/GrupaZero/vanilla-integration/blob/b65f67e2db8021d59f568e918c6da7fc52655a01/src/Gzero/Vanilla/VanillaController.php#L47-L74 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Encoder.php | HTMLPurifier_Encoder.cleanUTF8 | public static function cleanUTF8($str, $force_php = false) {
// UTF-8 validity is checked since PHP 4.3.5
// This is an optimization: if the string is already valid UTF-8, no
// need to do PHP stuff. 99% of the time, this will be the case.
// The regexp matches the XML char production, ... | php | public static function cleanUTF8($str, $force_php = false) {
// UTF-8 validity is checked since PHP 4.3.5
// This is an optimization: if the string is already valid UTF-8, no
// need to do PHP stuff. 99% of the time, this will be the case.
// The regexp matches the XML char production, ... | [
"public",
"static",
"function",
"cleanUTF8",
"(",
"$",
"str",
",",
"$",
"force_php",
"=",
"false",
")",
"{",
"// UTF-8 validity is checked since PHP 4.3.5",
"// This is an optimization: if the string is already valid UTF-8, no",
"// need to do PHP stuff. 99% of the time, this will be... | Cleans a UTF-8 string for well-formedness and SGML validity
It will parse according to UTF-8 and return a valid UTF8 string, with
non-SGML codepoints excluded.
@note Just for reference, the non-SGML code points are 0 to 31 and
127 to 159, inclusive. However, we allow code points 9, 10
and 13, which are the tab, line... | [
"Cleans",
"a",
"UTF",
"-",
"8",
"string",
"for",
"well",
"-",
"formedness",
"and",
"SGML",
"validity"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Encoder.php#L47-L198 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Encoder.php | HTMLPurifier_Encoder.unichr | public static function unichr($code) {
if($code > 1114111 or $code < 0 or
($code >= 55296 and $code <= 57343) ) {
// bits are set outside the "valid" range as defined
// by UNICODE 4.1.0
return '';
}
$x = $y = $z = $w = 0;
if ($code < 128) {... | php | public static function unichr($code) {
if($code > 1114111 or $code < 0 or
($code >= 55296 and $code <= 57343) ) {
// bits are set outside the "valid" range as defined
// by UNICODE 4.1.0
return '';
}
$x = $y = $z = $w = 0;
if ($code < 128) {... | [
"public",
"static",
"function",
"unichr",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"$",
"code",
">",
"1114111",
"or",
"$",
"code",
"<",
"0",
"or",
"(",
"$",
"code",
">=",
"55296",
"and",
"$",
"code",
"<=",
"57343",
")",
")",
"{",
"// bits are set out... | +----------+----------+----------+----------+ | [
"+",
"----------",
"+",
"----------",
"+",
"----------",
"+",
"----------",
"+"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Encoder.php#L226-L261 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Encoder.php | HTMLPurifier_Encoder.convertToUTF8 | public static function convertToUTF8($str, $config, $context) {
$encoding = $config->get('Core.Encoding');
if ($encoding === 'utf-8') return $str;
static $iconv = null;
if ($iconv === null) $iconv = function_exists('iconv');
set_error_handler(array('HTMLPurifier_Encoder', 'muteEr... | php | public static function convertToUTF8($str, $config, $context) {
$encoding = $config->get('Core.Encoding');
if ($encoding === 'utf-8') return $str;
static $iconv = null;
if ($iconv === null) $iconv = function_exists('iconv');
set_error_handler(array('HTMLPurifier_Encoder', 'muteEr... | [
"public",
"static",
"function",
"convertToUTF8",
"(",
"$",
"str",
",",
"$",
"config",
",",
"$",
"context",
")",
"{",
"$",
"encoding",
"=",
"$",
"config",
"->",
"get",
"(",
"'Core.Encoding'",
")",
";",
"if",
"(",
"$",
"encoding",
"===",
"'utf-8'",
")",
... | Converts a string to UTF-8 based on configuration. | [
"Converts",
"a",
"string",
"to",
"UTF",
"-",
"8",
"based",
"on",
"configuration",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Encoder.php#L266-L292 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Encoder.php | HTMLPurifier_Encoder.convertFromUTF8 | public static function convertFromUTF8($str, $config, $context) {
$encoding = $config->get('Core.Encoding');
if ($encoding === 'utf-8') return $str;
static $iconv = null;
if ($iconv === null) $iconv = function_exists('iconv');
if ($escape = $config->get('Core.EscapeNonASCIICharac... | php | public static function convertFromUTF8($str, $config, $context) {
$encoding = $config->get('Core.Encoding');
if ($encoding === 'utf-8') return $str;
static $iconv = null;
if ($iconv === null) $iconv = function_exists('iconv');
if ($escape = $config->get('Core.EscapeNonASCIICharac... | [
"public",
"static",
"function",
"convertFromUTF8",
"(",
"$",
"str",
",",
"$",
"config",
",",
"$",
"context",
")",
"{",
"$",
"encoding",
"=",
"$",
"config",
"->",
"get",
"(",
"'Core.Encoding'",
")",
";",
"if",
"(",
"$",
"encoding",
"===",
"'utf-8'",
")"... | Converts a string from UTF-8 based on configuration.
@note Currently, this is a lossy conversion, with unexpressable
characters being omitted. | [
"Converts",
"a",
"string",
"from",
"UTF",
"-",
"8",
"based",
"on",
"configuration",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Encoder.php#L299-L327 |
Webklex/translator | src/Translator/Translator.php | Translator.get | public function get($key, $locale = null)
{
if(!$locale){
$locale = $this->getLocale();
}
if($locale == config('translator.default')){
return $key;
}
$this->load($locale);
if (!isset($this->languages[$locale][$key])){
$this->setM... | php | public function get($key, $locale = null)
{
if(!$locale){
$locale = $this->getLocale();
}
if($locale == config('translator.default')){
return $key;
}
$this->load($locale);
if (!isset($this->languages[$locale][$key])){
$this->setM... | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"locale",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
")",
";",
"}",
"if",
"(",
"$",
"locale",
"==",
"config",
... | Get the translation for the given key.
@param string $key
@param string $locale
@return string | [
"Get",
"the",
"translation",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/Webklex/translator/blob/6bef2c68da1c05df7d759da8458037eee5203986/src/Translator/Translator.php#L124-L142 |
Webklex/translator | src/Translator/Translator.php | Translator.all | public function all($locale = null){
if(!$locale){
$locale = $this->getLocale();
}
$this->load($locale);
$translations = collect([]);
foreach($this->languages[$locale] as $key => $arg){
$translations->put($key, $arg['value']);
}
return ... | php | public function all($locale = null){
if(!$locale){
$locale = $this->getLocale();
}
$this->load($locale);
$translations = collect([]);
foreach($this->languages[$locale] as $key => $arg){
$translations->put($key, $arg['value']);
}
return ... | [
"public",
"function",
"all",
"(",
"$",
"locale",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"locale",
")",
"{",
"$",
"locale",
"=",
"$",
"this",
"->",
"getLocale",
"(",
")",
";",
"}",
"$",
"this",
"->",
"load",
"(",
"$",
"locale",
")",
";",
... | Get all available translations
@param null $locale
@return mixed | [
"Get",
"all",
"available",
"translations"
] | train | https://github.com/Webklex/translator/blob/6bef2c68da1c05df7d759da8458037eee5203986/src/Translator/Translator.php#L151-L165 |
Webklex/translator | src/Translator/Translator.php | Translator.set | public function set($key, $value, $locale, $missing = false)
{
$this->languagesChanges[$locale][$key]["value"] = $value;
if($missing){
$this->languagesChanges[$locale][$key]["missing"] = 'x';
}
return true;
} | php | public function set($key, $value, $locale, $missing = false)
{
$this->languagesChanges[$locale][$key]["value"] = $value;
if($missing){
$this->languagesChanges[$locale][$key]["missing"] = 'x';
}
return true;
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"$",
"locale",
",",
"$",
"missing",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"languagesChanges",
"[",
"$",
"locale",
"]",
"[",
"$",
"key",
"]",
"[",
"\"value\"",
"]",
"=",
"$... | Get the translation for the given key.
@param string $key
@param string $value
@param string $locale
@param boolean $missing
@return string | [
"Get",
"the",
"translation",
"for",
"the",
"given",
"key",
"."
] | train | https://github.com/Webklex/translator/blob/6bef2c68da1c05df7d759da8458037eee5203986/src/Translator/Translator.php#L188-L195 |
Webklex/translator | src/Translator/Translator.php | Translator.load | public function load($locale)
{
if ($this->isLoaded($locale)) {
return;
}
$this->languages[$locale] = $this->handler->load($locale);
} | php | public function load($locale)
{
if ($this->isLoaded($locale)) {
return;
}
$this->languages[$locale] = $this->handler->load($locale);
} | [
"public",
"function",
"load",
"(",
"$",
"locale",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isLoaded",
"(",
"$",
"locale",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"languages",
"[",
"$",
"locale",
"]",
"=",
"$",
"this",
"->",
"handler... | Load the specified language .
@param string $locale
@return void | [
"Load",
"the",
"specified",
"language",
"."
] | train | https://github.com/Webklex/translator/blob/6bef2c68da1c05df7d759da8458037eee5203986/src/Translator/Translator.php#L203-L209 |
ronan-gloo/jade-php | src/Jade/Compiler.php | Compiler.apply | protected function apply($method, $arguments)
{
if (! method_exists($this, $method))
{
throw new \BadMethodCallException(sprintf('Method %s do not exists', $method));
}
switch (count($arguments))
{
case 0:
return $this->{$method}();
... | php | protected function apply($method, $arguments)
{
if (! method_exists($this, $method))
{
throw new \BadMethodCallException(sprintf('Method %s do not exists', $method));
}
switch (count($arguments))
{
case 0:
return $this->{$method}();
... | [
"protected",
"function",
"apply",
"(",
"$",
"method",
",",
"$",
"arguments",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"$",
"this",
",",
"$",
"method",
")",
")",
"{",
"throw",
"new",
"\\",
"BadMethodCallException",
"(",
"sprintf",
"(",
"'Method %s ... | @param $method
@param $arguments
@throws \BadMethodCallException If the 'apply' rely on non existing method
@return mixed | [
"@param",
"$method",
"@param",
"$arguments"
] | train | https://github.com/ronan-gloo/jade-php/blob/77230d2eef2f0d4f045292a5906162f0c0499421/src/Jade/Compiler.php#L123-L147 |
DanSmith83/laravel5-foundation | src/Pagination/SimpleFoundationFivePresenter.php | SimpleFoundationFivePresenter.getPageLinkWrapper | protected function getPageLinkWrapper($url, $page, $rel = null)
{
if ($page == '«') {
return $this->getPreviousPageWrapper($url, $page, $rel);
}
return $this->getNextPageWrapper($url, $page, $rel);
} | php | protected function getPageLinkWrapper($url, $page, $rel = null)
{
if ($page == '«') {
return $this->getPreviousPageWrapper($url, $page, $rel);
}
return $this->getNextPageWrapper($url, $page, $rel);
} | [
"protected",
"function",
"getPageLinkWrapper",
"(",
"$",
"url",
",",
"$",
"page",
",",
"$",
"rel",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"page",
"==",
"'«'",
")",
"{",
"return",
"$",
"this",
"->",
"getPreviousPageWrapper",
"(",
"$",
"url",
",",
... | Get HTML wrapper for a page link.
@param string $url
@param int $page
@param string|null $rel
@return string | [
"Get",
"HTML",
"wrapper",
"for",
"a",
"page",
"link",
"."
] | train | https://github.com/DanSmith83/laravel5-foundation/blob/69d37d885accec6d6186ce0be4e4e0b784ae7505/src/Pagination/SimpleFoundationFivePresenter.php#L58-L65 |
DanSmith83/laravel5-foundation | src/Pagination/SimpleFoundationFivePresenter.php | SimpleFoundationFivePresenter.getPreviousPageWrapper | protected function getPreviousPageWrapper($url, $page, $rel = null)
{
$rel = is_null($rel)
? ''
: ' rel="' . $rel . '"';
return '<li class="left"><a href="' . $url . '"' . $rel . '>' . $page . '</a></li>';
} | php | protected function getPreviousPageWrapper($url, $page, $rel = null)
{
$rel = is_null($rel)
? ''
: ' rel="' . $rel . '"';
return '<li class="left"><a href="' . $url . '"' . $rel . '>' . $page . '</a></li>';
} | [
"protected",
"function",
"getPreviousPageWrapper",
"(",
"$",
"url",
",",
"$",
"page",
",",
"$",
"rel",
"=",
"null",
")",
"{",
"$",
"rel",
"=",
"is_null",
"(",
"$",
"rel",
")",
"?",
"''",
":",
"' rel=\"'",
".",
"$",
"rel",
".",
"'\"'",
";",
"return"... | Get HTML wrapper for an available page link.
@param string $url
@param int $page
@param string|null $rel
@return string | [
"Get",
"HTML",
"wrapper",
"for",
"an",
"available",
"page",
"link",
"."
] | train | https://github.com/DanSmith83/laravel5-foundation/blob/69d37d885accec6d6186ce0be4e4e0b784ae7505/src/Pagination/SimpleFoundationFivePresenter.php#L75-L82 |
DanSmith83/laravel5-foundation | src/Pagination/SimpleFoundationFivePresenter.php | SimpleFoundationFivePresenter.getNextPageWrapper | protected function getNextPageWrapper($url, $page, $rel = null)
{
$rel = is_null($rel)
? ''
: ' rel="' . $rel . '"';
return '<li class="right"><a href="' . $url . '"' . $rel . '>' . $page . '</a></li>';
} | php | protected function getNextPageWrapper($url, $page, $rel = null)
{
$rel = is_null($rel)
? ''
: ' rel="' . $rel . '"';
return '<li class="right"><a href="' . $url . '"' . $rel . '>' . $page . '</a></li>';
} | [
"protected",
"function",
"getNextPageWrapper",
"(",
"$",
"url",
",",
"$",
"page",
",",
"$",
"rel",
"=",
"null",
")",
"{",
"$",
"rel",
"=",
"is_null",
"(",
"$",
"rel",
")",
"?",
"''",
":",
"' rel=\"'",
".",
"$",
"rel",
".",
"'\"'",
";",
"return",
... | Get HTML wrapper for an available page link.
@param string $url
@param int $page
@param string|null $rel
@return string | [
"Get",
"HTML",
"wrapper",
"for",
"an",
"available",
"page",
"link",
"."
] | train | https://github.com/DanSmith83/laravel5-foundation/blob/69d37d885accec6d6186ce0be4e4e0b784ae7505/src/Pagination/SimpleFoundationFivePresenter.php#L92-L99 |
hannesvdvreken/msgpack | src/Encoder.php | Encoder.encode | public static function encode($data)
{
switch (gettype($data)) {
case 'array':
return self::encodeArray($data);
case 'object':
return self::encodeObject($data);
case 'string':
return self::encodeString($data);
ca... | php | public static function encode($data)
{
switch (gettype($data)) {
case 'array':
return self::encodeArray($data);
case 'object':
return self::encodeObject($data);
case 'string':
return self::encodeString($data);
ca... | [
"public",
"static",
"function",
"encode",
"(",
"$",
"data",
")",
"{",
"switch",
"(",
"gettype",
"(",
"$",
"data",
")",
")",
"{",
"case",
"'array'",
":",
"return",
"self",
"::",
"encodeArray",
"(",
"$",
"data",
")",
";",
"case",
"'object'",
":",
"retu... | @param mixed $data
@return string
@throws Exception
@throws UnencodeableException | [
"@param",
"mixed",
"$data"
] | train | https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Encoder.php#L30-L53 |
hannesvdvreken/msgpack | src/Encoder.php | Encoder.encodeArray | private static function encodeArray(array $array)
{
// If it is an associative array, treat it as an object.
if (!empty($array) && array_keys($array) !== range(0, count($array) - 1)) {
return self::encodeMap($array);
}
// Differentiate on the array length.
if (co... | php | private static function encodeArray(array $array)
{
// If it is an associative array, treat it as an object.
if (!empty($array) && array_keys($array) !== range(0, count($array) - 1)) {
return self::encodeMap($array);
}
// Differentiate on the array length.
if (co... | [
"private",
"static",
"function",
"encodeArray",
"(",
"array",
"$",
"array",
")",
"{",
"// If it is an associative array, treat it as an object.",
"if",
"(",
"!",
"empty",
"(",
"$",
"array",
")",
"&&",
"array_keys",
"(",
"$",
"array",
")",
"!==",
"range",
"(",
... | @param array $array
@return string
@throws UnencodeableException | [
"@param",
"array",
"$array"
] | train | https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Encoder.php#L61-L95 |
hannesvdvreken/msgpack | src/Encoder.php | Encoder.encodeMap | private static function encodeMap(array $array)
{
// Differentiate on the map length.
if (count($array) < 16) {
// fixmap
$prefix = bindec(1000) * 16 + count($array);
} elseif (count($array) < pow(2, 16)) {
// map 16
$prefix = 0xde * 256 * 256;... | php | private static function encodeMap(array $array)
{
// Differentiate on the map length.
if (count($array) < 16) {
// fixmap
$prefix = bindec(1000) * 16 + count($array);
} elseif (count($array) < pow(2, 16)) {
// map 16
$prefix = 0xde * 256 * 256;... | [
"private",
"static",
"function",
"encodeMap",
"(",
"array",
"$",
"array",
")",
"{",
"// Differentiate on the map length.",
"if",
"(",
"count",
"(",
"$",
"array",
")",
"<",
"16",
")",
"{",
"// fixmap",
"$",
"prefix",
"=",
"bindec",
"(",
"1000",
")",
"*",
... | @param array $array
@return string
@throws UnencodeableException | [
"@param",
"array",
"$array"
] | train | https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Encoder.php#L114-L145 |
hannesvdvreken/msgpack | src/Encoder.php | Encoder.encodeString | private static function encodeString($string)
{
// Note:
// strlen() returns the number of bytes rather than the number of characters in a string.
// Differentiate on the string length.
if (strlen($string) < 32) {
// fixstr
$prefix = bindec(101) * 32 + strlen... | php | private static function encodeString($string)
{
// Note:
// strlen() returns the number of bytes rather than the number of characters in a string.
// Differentiate on the string length.
if (strlen($string) < 32) {
// fixstr
$prefix = bindec(101) * 32 + strlen... | [
"private",
"static",
"function",
"encodeString",
"(",
"$",
"string",
")",
"{",
"// Note:",
"// strlen() returns the number of bytes rather than the number of characters in a string.",
"// Differentiate on the string length.",
"if",
"(",
"strlen",
"(",
"$",
"string",
")",
"<",
... | @param string $string
@return string
@throws UnencodeableException | [
"@param",
"string",
"$string"
] | train | https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Encoder.php#L153-L177 |
hannesvdvreken/msgpack | src/Encoder.php | Encoder.encodeInteger | private static function encodeInteger($integer)
{
if ($integer >= 0 && $integer < pow(2, 7)) {
// positive fixnum: 7-bit positive integer
// 0XXXXXXX
return pack('H*', str_pad(dechex($integer), 2, 0, STR_PAD_LEFT));
} elseif ($integer < 0 && abs($integer) < pow(2,... | php | private static function encodeInteger($integer)
{
if ($integer >= 0 && $integer < pow(2, 7)) {
// positive fixnum: 7-bit positive integer
// 0XXXXXXX
return pack('H*', str_pad(dechex($integer), 2, 0, STR_PAD_LEFT));
} elseif ($integer < 0 && abs($integer) < pow(2,... | [
"private",
"static",
"function",
"encodeInteger",
"(",
"$",
"integer",
")",
"{",
"if",
"(",
"$",
"integer",
">=",
"0",
"&&",
"$",
"integer",
"<",
"pow",
"(",
"2",
",",
"7",
")",
")",
"{",
"// positive fixnum: 7-bit positive integer",
"// 0XXXXXXX",
"return",... | @param int $integer
@return string | [
"@param",
"int",
"$integer"
] | train | https://github.com/hannesvdvreken/msgpack/blob/8ff24533419b96acfcccacd2ab7f1d7d2e1668dc/src/Encoder.php#L184-L211 |
pantera-digital/yii2-seo | behaviors/SlugBehavior.php | SlugBehavior.eventSaveCallback | public function eventSaveCallback()
{
if ($this->generateBeforeSave) {
$this->owner->refresh();
$this->assign();
}
$this->save();
} | php | public function eventSaveCallback()
{
if ($this->generateBeforeSave) {
$this->owner->refresh();
$this->assign();
}
$this->save();
} | [
"public",
"function",
"eventSaveCallback",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"generateBeforeSave",
")",
"{",
"$",
"this",
"->",
"owner",
"->",
"refresh",
"(",
")",
";",
"$",
"this",
"->",
"assign",
"(",
")",
";",
"}",
"$",
"this",
"->",
... | Колбек для собитий сохранения | [
"Колбек",
"для",
"собитий",
"сохранения"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/behaviors/SlugBehavior.php#L127-L134 |
pantera-digital/yii2-seo | behaviors/SlugBehavior.php | SlugBehavior.find | public function find()
{
if ($this->owner->isNewRecord === false && SeoSlug::getDb()->getSchema()->getTableSchema(SeoSlug::tableName(), true) !== null) {
//Сначала попробуем найти запись в кеше
$this->_slugModel = $this->_cache->get($this->owner);
if (is_null($this->_slug... | php | public function find()
{
if ($this->owner->isNewRecord === false && SeoSlug::getDb()->getSchema()->getTableSchema(SeoSlug::tableName(), true) !== null) {
//Сначала попробуем найти запись в кеше
$this->_slugModel = $this->_cache->get($this->owner);
if (is_null($this->_slug... | [
"public",
"function",
"find",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"owner",
"->",
"isNewRecord",
"===",
"false",
"&&",
"SeoSlug",
"::",
"getDb",
"(",
")",
"->",
"getSchema",
"(",
")",
"->",
"getTableSchema",
"(",
"SeoSlug",
"::",
"tableName",
"... | Поиск записи о slug для текушей модели | [
"Поиск",
"записи",
"о",
"slug",
"для",
"текушей",
"модели"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/behaviors/SlugBehavior.php#L139-L163 |
pantera-digital/yii2-seo | behaviors/SlugBehavior.php | SlugBehavior.assign | public function assign()
{
if ($this->slugAttributeOnlyLoad === false && $this->slugAttribute && $this->owner->{$this->slugAttribute}) {
$this->_slug = $this->owner->{$this->slugAttribute};
//Если есть префикс добави его
$this->applyPrefix();
} elseif ($this->attr... | php | public function assign()
{
if ($this->slugAttributeOnlyLoad === false && $this->slugAttribute && $this->owner->{$this->slugAttribute}) {
$this->_slug = $this->owner->{$this->slugAttribute};
//Если есть префикс добави его
$this->applyPrefix();
} elseif ($this->attr... | [
"public",
"function",
"assign",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"slugAttributeOnlyLoad",
"===",
"false",
"&&",
"$",
"this",
"->",
"slugAttribute",
"&&",
"$",
"this",
"->",
"owner",
"->",
"{",
"$",
"this",
"->",
"slugAttribute",
"}",
")",
"... | Получение slug | [
"Получение",
"slug"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/behaviors/SlugBehavior.php#L168-L187 |
pantera-digital/yii2-seo | behaviors/SlugBehavior.php | SlugBehavior.generate | protected function generate($iteration = 0)
{
if (is_null($this->generator)) {
$this->_slug = Inflector::slug($this->owner->{$this->attribute});
} else {
$this->_slug = call_user_func($this->generator);
}
$this->_slug .= $iteration > 0 ? '-' . $iteration : '';... | php | protected function generate($iteration = 0)
{
if (is_null($this->generator)) {
$this->_slug = Inflector::slug($this->owner->{$this->attribute});
} else {
$this->_slug = call_user_func($this->generator);
}
$this->_slug .= $iteration > 0 ? '-' . $iteration : '';... | [
"protected",
"function",
"generate",
"(",
"$",
"iteration",
"=",
"0",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"generator",
")",
")",
"{",
"$",
"this",
"->",
"_slug",
"=",
"Inflector",
"::",
"slug",
"(",
"$",
"this",
"->",
"owner",
"... | Создаём slug
@param integer $iteration Номер итерации если алиас уже используется будет в цикле добовлять номер итерации пока не достигнет уникального slug | [
"Создаём",
"slug"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/behaviors/SlugBehavior.php#L193-L206 |
pantera-digital/yii2-seo | behaviors/SlugBehavior.php | SlugBehavior.applyPrefix | protected function applyPrefix()
{
if (is_callable($this->prefix)) {
$prefix = call_user_func($this->prefix, $this);
} else {
$prefix = $this->prefix;
}
if ($prefix && strpos($this->_slug, $prefix) === false) {
$this->_slug = $prefix . $this->_slug... | php | protected function applyPrefix()
{
if (is_callable($this->prefix)) {
$prefix = call_user_func($this->prefix, $this);
} else {
$prefix = $this->prefix;
}
if ($prefix && strpos($this->_slug, $prefix) === false) {
$this->_slug = $prefix . $this->_slug... | [
"protected",
"function",
"applyPrefix",
"(",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"this",
"->",
"prefix",
")",
")",
"{",
"$",
"prefix",
"=",
"call_user_func",
"(",
"$",
"this",
"->",
"prefix",
",",
"$",
"this",
")",
";",
"}",
"else",
"{",
... | Применение префикса | [
"Применение",
"префикса"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/behaviors/SlugBehavior.php#L211-L221 |
pantera-digital/yii2-seo | behaviors/SlugBehavior.php | SlugBehavior.save | public function save()
{
$this->_slug = trim(trim($this->_slug), '/');
if (is_null($this->_slugModel) || $this->_slugModel->slug !== $this->_slug) {
//Если уже есть запись с таким slug то обновим её присвоев её максимальный id + 1
$model = SeoSlug::find()
->wh... | php | public function save()
{
$this->_slug = trim(trim($this->_slug), '/');
if (is_null($this->_slugModel) || $this->_slugModel->slug !== $this->_slug) {
//Если уже есть запись с таким slug то обновим её присвоев её максимальный id + 1
$model = SeoSlug::find()
->wh... | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"this",
"->",
"_slug",
"=",
"trim",
"(",
"trim",
"(",
"$",
"this",
"->",
"_slug",
")",
",",
"'/'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_slugModel",
")",
"||",
"$",
"this",
"... | Сохранение slug
сохранение происходит только если текуший slug отсутствует или новый slug отличается от имеюшегося | [
"Сохранение",
"slug",
"сохранение",
"происходит",
"только",
"если",
"текуший",
"slug",
"отсутствует",
"или",
"новый",
"slug",
"отличается",
"от",
"имеюшегося"
] | train | https://github.com/pantera-digital/yii2-seo/blob/7673224ef601bfbccc57c96e7413ceb43d8332b2/behaviors/SlugBehavior.php#L237-L271 |
spryker/category-data-import | src/Spryker/Zed/CategoryDataImport/Business/CategoryDataImportFacade.php | CategoryDataImportFacade.import | public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
{
return $this->getFactory()->createCategoryImporter()->import($dataImporterConfigurationTransfer);
} | php | public function import(?DataImporterConfigurationTransfer $dataImporterConfigurationTransfer = null): DataImporterReportTransfer
{
return $this->getFactory()->createCategoryImporter()->import($dataImporterConfigurationTransfer);
} | [
"public",
"function",
"import",
"(",
"?",
"DataImporterConfigurationTransfer",
"$",
"dataImporterConfigurationTransfer",
"=",
"null",
")",
":",
"DataImporterReportTransfer",
"{",
"return",
"$",
"this",
"->",
"getFactory",
"(",
")",
"->",
"createCategoryImporter",
"(",
... | {@inheritdoc}
@api
@param \Generated\Shared\Transfer\DataImporterConfigurationTransfer|null $dataImporterConfigurationTransfer
@return \Generated\Shared\Transfer\DataImporterReportTransfer | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/CategoryDataImportFacade.php#L30-L33 |
repertory/laravel-module | src/Commands/Publish.php | Publish.handle | public function handle()
{
$publishes = ServiceProvider::pathsToPublish('LaravelModule\ServiceProvider', null);
foreach ($publishes as $from => $to) {
$this->publishItem($from, $to);
}
$this->info('Publishing complete.');
} | php | public function handle()
{
$publishes = ServiceProvider::pathsToPublish('LaravelModule\ServiceProvider', null);
foreach ($publishes as $from => $to) {
$this->publishItem($from, $to);
}
$this->info('Publishing complete.');
} | [
"public",
"function",
"handle",
"(",
")",
"{",
"$",
"publishes",
"=",
"ServiceProvider",
"::",
"pathsToPublish",
"(",
"'LaravelModule\\ServiceProvider'",
",",
"null",
")",
";",
"foreach",
"(",
"$",
"publishes",
"as",
"$",
"from",
"=>",
"$",
"to",
")",
"{",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/repertory/laravel-module/blob/364fa359277eb303f3c7780845f7b59625c4558f/src/Commands/Publish.php#L130-L137 |
joomla-projects/jorobo | src/Tasks/Build.php | Build.run | public function run()
{
$this->say('Building ' . $this->getJConfig()->extension . " " . $this->getJConfig()->version);
if (!$this->checkFolders())
{
return false;
}
// Create directory
$this->prepareDistDirectory();
// Build extension
$this->buildExtension($this->params)->run();
// Create syml... | php | public function run()
{
$this->say('Building ' . $this->getJConfig()->extension . " " . $this->getJConfig()->version);
if (!$this->checkFolders())
{
return false;
}
// Create directory
$this->prepareDistDirectory();
// Build extension
$this->buildExtension($this->params)->run();
// Create syml... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"'Building '",
".",
"$",
"this",
"->",
"getJConfig",
"(",
")",
"->",
"extension",
".",
"\" \"",
".",
"$",
"this",
"->",
"getJConfig",
"(",
")",
"->",
"version",
")",
";",
"i... | Build the package
@return bool
@since 1.0 | [
"Build",
"the",
"package"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build.php#L58-L97 |
joomla-projects/jorobo | src/Tasks/Build.php | Build.prepareDistDirectory | private function prepareDistDirectory()
{
$build = $this->getBuildFolder();
if (!file_exists($build))
{
$this->_mkdir($build);
}
$this->cleanup($build);
} | php | private function prepareDistDirectory()
{
$build = $this->getBuildFolder();
if (!file_exists($build))
{
$this->_mkdir($build);
}
$this->cleanup($build);
} | [
"private",
"function",
"prepareDistDirectory",
"(",
")",
"{",
"$",
"build",
"=",
"$",
"this",
"->",
"getBuildFolder",
"(",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"build",
")",
")",
"{",
"$",
"this",
"->",
"_mkdir",
"(",
"$",
"build",
")",... | Prepare the directories
@return void
@since 1.0 | [
"Prepare",
"the",
"directories"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build.php#L121-L131 |
sifophp/sifo-common-instance | controllers/debug/commandLineDebug.php | DebugCommandLineDebugController.finalRender | protected function finalRender( $debug_data )
{
parent::finalRender( $debug_data );
$url = \Sifo\Urls::getInstance()->getUrlConfig();
echo '[INFO] Script debug properly saved. You can check it out at: ' . $url['sifo_debug_analyzer'] . '?execution_key=' . \Sifo\Debug::getExecutionKey() . PHP_EOL;
} | php | protected function finalRender( $debug_data )
{
parent::finalRender( $debug_data );
$url = \Sifo\Urls::getInstance()->getUrlConfig();
echo '[INFO] Script debug properly saved. You can check it out at: ' . $url['sifo_debug_analyzer'] . '?execution_key=' . \Sifo\Debug::getExecutionKey() . PHP_EOL;
} | [
"protected",
"function",
"finalRender",
"(",
"$",
"debug_data",
")",
"{",
"parent",
"::",
"finalRender",
"(",
"$",
"debug_data",
")",
";",
"$",
"url",
"=",
"\\",
"Sifo",
"\\",
"Urls",
"::",
"getInstance",
"(",
")",
"->",
"getUrlConfig",
"(",
")",
";",
... | Override method in order to show a message with a link to the Sifo Debug Analyzer.
@param array $debug_data Structure containing all debug related data. | [
"Override",
"method",
"in",
"order",
"to",
"show",
"a",
"message",
"with",
"a",
"link",
"to",
"the",
"Sifo",
"Debug",
"Analyzer",
"."
] | train | https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/debug/commandLineDebug.php#L22-L28 |
scottrobertson/premailer | src/ScottRobertson/Premailer/Response.php | Response.download | private function download($type)
{
try {
$response = $this->client->get($this->data['documents'][$type]);
} catch (\Exception $e) {
throw new \ScottRobertson\Premailer\Exception\Request($e->getMessage());
}
return (string) $response->getBody();
} | php | private function download($type)
{
try {
$response = $this->client->get($this->data['documents'][$type]);
} catch (\Exception $e) {
throw new \ScottRobertson\Premailer\Exception\Request($e->getMessage());
}
return (string) $response->getBody();
} | [
"private",
"function",
"download",
"(",
"$",
"type",
")",
"{",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"$",
"this",
"->",
"data",
"[",
"'documents'",
"]",
"[",
"$",
"type",
"]",
")",
";",
"}",
"catch",
"("... | Download the Html/Text version of this email
@param string $type
@return string | [
"Download",
"the",
"Html",
"/",
"Text",
"version",
"of",
"this",
"email"
] | train | https://github.com/scottrobertson/premailer/blob/c7869561473c496766ddd5ed10506508aa24dd8f/src/ScottRobertson/Premailer/Response.php#L54-L63 |
jimmyoak/utilities | src/Utility/ObjectUtils.php | ObjectUtils.toXml | public function toXml($objectToParse, $deep = self::SHALLOW)
{
return simplexml_load_string($this->toXmlString($objectToParse, $deep));
} | php | public function toXml($objectToParse, $deep = self::SHALLOW)
{
return simplexml_load_string($this->toXmlString($objectToParse, $deep));
} | [
"public",
"function",
"toXml",
"(",
"$",
"objectToParse",
",",
"$",
"deep",
"=",
"self",
"::",
"SHALLOW",
")",
"{",
"return",
"simplexml_load_string",
"(",
"$",
"this",
"->",
"toXmlString",
"(",
"$",
"objectToParse",
",",
"$",
"deep",
")",
")",
";",
"}"
... | @param object $objectToParse
@param bool $deep
@return \SimpleXMLElement | [
"@param",
"object",
"$objectToParse",
"@param",
"bool",
"$deep"
] | train | https://github.com/jimmyoak/utilities/blob/ab2b4a574bd67c04784695a3c206daf5800979a4/src/Utility/ObjectUtils.php#L24-L27 |
jimmyoak/utilities | src/Utility/ObjectUtils.php | ObjectUtils.toXmlString | public function toXmlString($object, $deep = self::SHALLOW)
{
return $this->arrayUtils->toXmlString($this->toArray($object, $deep));
} | php | public function toXmlString($object, $deep = self::SHALLOW)
{
return $this->arrayUtils->toXmlString($this->toArray($object, $deep));
} | [
"public",
"function",
"toXmlString",
"(",
"$",
"object",
",",
"$",
"deep",
"=",
"self",
"::",
"SHALLOW",
")",
"{",
"return",
"$",
"this",
"->",
"arrayUtils",
"->",
"toXmlString",
"(",
"$",
"this",
"->",
"toArray",
"(",
"$",
"object",
",",
"$",
"deep",
... | @param object $object
@param bool $deep
@return string | [
"@param",
"object",
"$object",
"@param",
"bool",
"$deep"
] | train | https://github.com/jimmyoak/utilities/blob/ab2b4a574bd67c04784695a3c206daf5800979a4/src/Utility/ObjectUtils.php#L35-L38 |
jimmyoak/utilities | src/Utility/ObjectUtils.php | ObjectUtils.toArray | public function toArray($object, $deep = self::SHALLOW)
{
return $deep ? $this->toDeepArray($object) : $this->toShallowArray($object);
} | php | public function toArray($object, $deep = self::SHALLOW)
{
return $deep ? $this->toDeepArray($object) : $this->toShallowArray($object);
} | [
"public",
"function",
"toArray",
"(",
"$",
"object",
",",
"$",
"deep",
"=",
"self",
"::",
"SHALLOW",
")",
"{",
"return",
"$",
"deep",
"?",
"$",
"this",
"->",
"toDeepArray",
"(",
"$",
"object",
")",
":",
"$",
"this",
"->",
"toShallowArray",
"(",
"$",
... | @param object $object
@param bool $deep
@return array | [
"@param",
"object",
"$object",
"@param",
"bool",
"$deep"
] | train | https://github.com/jimmyoak/utilities/blob/ab2b4a574bd67c04784695a3c206daf5800979a4/src/Utility/ObjectUtils.php#L46-L49 |
GrupaZero/vanilla-integration | src/Gzero/Vanilla/ServiceProvider.php | ServiceProvider.boot | public function boot()
{
$this->publishes(
[
$this->getConfigPath() => config_path('vanilla-integration.php'),
],
'config'
);
$this->loadRoutesFrom(__DIR__ . '/../../../routes/routes.php');
$this->registerHelpers();
} | php | public function boot()
{
$this->publishes(
[
$this->getConfigPath() => config_path('vanilla-integration.php'),
],
'config'
);
$this->loadRoutesFrom(__DIR__ . '/../../../routes/routes.php');
$this->registerHelpers();
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"publishes",
"(",
"[",
"$",
"this",
"->",
"getConfigPath",
"(",
")",
"=>",
"config_path",
"(",
"'vanilla-integration.php'",
")",
",",
"]",
",",
"'config'",
")",
";",
"$",
"this",
"->",
"lo... | Bootstrap the application events.
@return void | [
"Bootstrap",
"the",
"application",
"events",
"."
] | train | https://github.com/GrupaZero/vanilla-integration/blob/b65f67e2db8021d59f568e918c6da7fc52655a01/src/Gzero/Vanilla/ServiceProvider.php#L34-L44 |
incraigulous/contentful-sdk | src/ManagementResources/IsPublishable.php | IsPublishable.publish | function publish($id, $previous)
{
$this->requestDecorator->setId($id . '/published');
$this->requestDecorator->addHeader('X-Contentful-Version', $previous['sys']['version']);
$result = $this->client->put($this->requestDecorator->makeResource(), $this->requestDecorator->makePayload(), $this... | php | function publish($id, $previous)
{
$this->requestDecorator->setId($id . '/published');
$this->requestDecorator->addHeader('X-Contentful-Version', $previous['sys']['version']);
$result = $this->client->put($this->requestDecorator->makeResource(), $this->requestDecorator->makePayload(), $this... | [
"function",
"publish",
"(",
"$",
"id",
",",
"$",
"previous",
")",
"{",
"$",
"this",
"->",
"requestDecorator",
"->",
"setId",
"(",
"$",
"id",
".",
"'/published'",
")",
";",
"$",
"this",
"->",
"requestDecorator",
"->",
"addHeader",
"(",
"'X-Contentful-Versio... | Publish a record.
@param $id
@param $previous
@return mixed | [
"Publish",
"a",
"record",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementResources/IsPublishable.php#L14-L21 |
incraigulous/contentful-sdk | src/ManagementResources/IsPublishable.php | IsPublishable.unpublish | function unpublish($id, $previous)
{
$this->requestDecorator->setId($id . '/published');
$this->requestDecorator->addHeader('X-Contentful-Version', $previous['sys']['version']);
$result = $this->client->delete($this->requestDecorator->makeResource(), $this->requestDecorator->makeHeaders());... | php | function unpublish($id, $previous)
{
$this->requestDecorator->setId($id . '/published');
$this->requestDecorator->addHeader('X-Contentful-Version', $previous['sys']['version']);
$result = $this->client->delete($this->requestDecorator->makeResource(), $this->requestDecorator->makeHeaders());... | [
"function",
"unpublish",
"(",
"$",
"id",
",",
"$",
"previous",
")",
"{",
"$",
"this",
"->",
"requestDecorator",
"->",
"setId",
"(",
"$",
"id",
".",
"'/published'",
")",
";",
"$",
"this",
"->",
"requestDecorator",
"->",
"addHeader",
"(",
"'X-Contentful-Vers... | Unublish a record.
@param $id
@param $previous
@return mixed | [
"Unublish",
"a",
"record",
"."
] | train | https://github.com/incraigulous/contentful-sdk/blob/29399b11b0e085a06ea5976661378c379fe5a731/src/ManagementResources/IsPublishable.php#L29-L36 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Definition/ArrayDefinition.php | ArrayDefinition.createValidator | public function createValidator()
{
return new ObjectValidator([
'requiredKeys' => new ArrayValidator([
'map' => new ScalarValidator(['type' => 'string']),
'messages' => [
'map' => 'requiredKeys values must be strings',
],
... | php | public function createValidator()
{
return new ObjectValidator([
'requiredKeys' => new ArrayValidator([
'map' => new ScalarValidator(['type' => 'string']),
'messages' => [
'map' => 'requiredKeys values must be strings',
],
... | [
"public",
"function",
"createValidator",
"(",
")",
"{",
"return",
"new",
"ObjectValidator",
"(",
"[",
"'requiredKeys'",
"=>",
"new",
"ArrayValidator",
"(",
"[",
"'map'",
"=>",
"new",
"ScalarValidator",
"(",
"[",
"'type'",
"=>",
"'string'",
"]",
")",
",",
"'m... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Definition/ArrayDefinition.php#L70-L103 |
fetus-hina/docomo-dialogue | src/validators/Number.php | Number.validate | public static function validate($value, $min, $max, $errorMessage)
{
if (is_string($value) && !preg_match('/^\d+$/', $value)) {
throw new DomainError($errorMessage);
}
$value = (int)$value;
if ($min !== null && $value < $min) {
throw new DomainError($errorMess... | php | public static function validate($value, $min, $max, $errorMessage)
{
if (is_string($value) && !preg_match('/^\d+$/', $value)) {
throw new DomainError($errorMessage);
}
$value = (int)$value;
if ($min !== null && $value < $min) {
throw new DomainError($errorMess... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"value",
",",
"$",
"min",
",",
"$",
"max",
",",
"$",
"errorMessage",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"&&",
"!",
"preg_match",
"(",
"'/^\\d+$/'",
",",
"$",
"value",
")",
... | 数値型を検査する
@param int $value 対象にする数値
@param int $min 許容する最小値
@param int $max 許容する最大値
@param string $errorMessage 異常時に発生する例外のメッセージ
@return bool
@throws \jp3cki\docomoDialogue\DomainError | [
"数値型を検査する"
] | train | https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/validators/Number.php#L29-L42 |
psecio/propauth | src/PolicySet.php | PolicySet.add | public function add($policyName, \Psecio\PropAuth\Policy $policy)
{
$this->policies[$policyName] = $policy;
return $this;
} | php | public function add($policyName, \Psecio\PropAuth\Policy $policy)
{
$this->policies[$policyName] = $policy;
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"policyName",
",",
"\\",
"Psecio",
"\\",
"PropAuth",
"\\",
"Policy",
"$",
"policy",
")",
"{",
"$",
"this",
"->",
"policies",
"[",
"$",
"policyName",
"]",
"=",
"$",
"policy",
";",
"return",
"$",
"this",
";",
"}"
... | Add a new policy to the current set with the given key name
@param string $policyName Policy name (key)
@param \Psecio\PropAuth\Policy $policy Policy object instance | [
"Add",
"a",
"new",
"policy",
"to",
"the",
"current",
"set",
"with",
"the",
"given",
"key",
"name"
] | train | https://github.com/psecio/propauth/blob/cb24fcc0a3fa459f2ef40a867c334951aabf7b83/src/PolicySet.php#L71-L75 |
markwatkinson/luminous | src/Luminous/Utils/SassParser.php | SassParser.nextIs | public function nextIs($tokenName, $ignoreWhitespace = false)
{
$i = $this->index+1;
$len = count($this->tokens);
while ($i < $len) {
$tok = $this->tokens[$i][0];
if ($ignoreWhitespace && $tok === 'WHITESPACE') {
$i++;
} else {
... | php | public function nextIs($tokenName, $ignoreWhitespace = false)
{
$i = $this->index+1;
$len = count($this->tokens);
while ($i < $len) {
$tok = $this->tokens[$i][0];
if ($ignoreWhitespace && $tok === 'WHITESPACE') {
$i++;
} else {
... | [
"public",
"function",
"nextIs",
"(",
"$",
"tokenName",
",",
"$",
"ignoreWhitespace",
"=",
"false",
")",
"{",
"$",
"i",
"=",
"$",
"this",
"->",
"index",
"+",
"1",
";",
"$",
"len",
"=",
"count",
"(",
"$",
"this",
"->",
"tokens",
")",
";",
"while",
... | Returns true if the next token is the given token name
optionally skipping whitespace | [
"Returns",
"true",
"if",
"the",
"next",
"token",
"is",
"the",
"given",
"token",
"name",
"optionally",
"skipping",
"whitespace"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/SassParser.php#L19-L32 |
markwatkinson/luminous | src/Luminous/Utils/SassParser.php | SassParser.nextSequence | public function nextSequence($sequence, $ignore = array())
{
$i = $this->index+1;
$len = count($this->tokens);
$seqLen = count($sequence);
$seq = 0;
$seqStart = 0;
while ($i < $len) {
$tok = $this->tokens[$i][0];
if ($tok === $sequence[$seq]) {... | php | public function nextSequence($sequence, $ignore = array())
{
$i = $this->index+1;
$len = count($this->tokens);
$seqLen = count($sequence);
$seq = 0;
$seqStart = 0;
while ($i < $len) {
$tok = $this->tokens[$i][0];
if ($tok === $sequence[$seq]) {... | [
"public",
"function",
"nextSequence",
"(",
"$",
"sequence",
",",
"$",
"ignore",
"=",
"array",
"(",
")",
")",
"{",
"$",
"i",
"=",
"$",
"this",
"->",
"index",
"+",
"1",
";",
"$",
"len",
"=",
"count",
"(",
"$",
"this",
"->",
"tokens",
")",
";",
"$... | Returns the index of the next match of the sequence of tokens
given, optionally ignoring ertain tokens | [
"Returns",
"the",
"index",
"of",
"the",
"next",
"match",
"of",
"the",
"sequence",
"of",
"tokens",
"given",
"optionally",
"ignoring",
"ertain",
"tokens"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/SassParser.php#L38-L65 |
markwatkinson/luminous | src/Luminous/Utils/SassParser.php | SassParser.nextOf | public function nextOf($tokenNames)
{
$i = $this->index+1;
$len = count($this->tokens);
while ($i < $len) {
$tok = $this->tokens[$i][0];
if (in_array($tok, $tokenNames)) {
return $tok;
}
$i++;
}
return null;
... | php | public function nextOf($tokenNames)
{
$i = $this->index+1;
$len = count($this->tokens);
while ($i < $len) {
$tok = $this->tokens[$i][0];
if (in_array($tok, $tokenNames)) {
return $tok;
}
$i++;
}
return null;
... | [
"public",
"function",
"nextOf",
"(",
"$",
"tokenNames",
")",
"{",
"$",
"i",
"=",
"$",
"this",
"->",
"index",
"+",
"1",
";",
"$",
"len",
"=",
"count",
"(",
"$",
"this",
"->",
"tokens",
")",
";",
"while",
"(",
"$",
"i",
"<",
"$",
"len",
")",
"{... | Returns the first token which occurs out of the set of given tokens | [
"Returns",
"the",
"first",
"token",
"which",
"occurs",
"out",
"of",
"the",
"set",
"of",
"given",
"tokens"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/SassParser.php#L70-L82 |
markwatkinson/luminous | src/Luminous/Utils/SassParser.php | SassParser.nextOfType | public function nextOfType($tokenName)
{
$i = $this->index+1;
$len = count($this->tokens);
while ($i < $len) {
$tok = $this->tokens[$i][0];
if ($tok === $tokenName) {
return $i;
}
$i++;
}
return $len;
} | php | public function nextOfType($tokenName)
{
$i = $this->index+1;
$len = count($this->tokens);
while ($i < $len) {
$tok = $this->tokens[$i][0];
if ($tok === $tokenName) {
return $i;
}
$i++;
}
return $len;
} | [
"public",
"function",
"nextOfType",
"(",
"$",
"tokenName",
")",
"{",
"$",
"i",
"=",
"$",
"this",
"->",
"index",
"+",
"1",
";",
"$",
"len",
"=",
"count",
"(",
"$",
"this",
"->",
"tokens",
")",
";",
"while",
"(",
"$",
"i",
"<",
"$",
"len",
")",
... | Returns the index of the next token with the given token name | [
"Returns",
"the",
"index",
"of",
"the",
"next",
"token",
"with",
"the",
"given",
"token",
"name"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/SassParser.php#L87-L99 |
markwatkinson/luminous | src/Luminous/Utils/SassParser.php | SassParser.parseRule | private function parseRule()
{
$newToken = $this->tokens[$this->index];
$set = false;
if ($this->index > 0) {
$prevToken = &$this->tokens[$this->index-1];
$prevTokenType = &$prevToken[0];
$prevTokenText = &$prevToken[1];
$concat = false;
... | php | private function parseRule()
{
$newToken = $this->tokens[$this->index];
$set = false;
if ($this->index > 0) {
$prevToken = &$this->tokens[$this->index-1];
$prevTokenType = &$prevToken[0];
$prevTokenText = &$prevToken[1];
$concat = false;
... | [
"private",
"function",
"parseRule",
"(",
")",
"{",
"$",
"newToken",
"=",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"index",
"]",
";",
"$",
"set",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"index",
">",
"0",
")",
"{",
"$",
"pre... | Parses a selector rule | [
"Parses",
"a",
"selector",
"rule"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/SassParser.php#L113-L142 |
markwatkinson/luminous | src/Luminous/Utils/SassParser.php | SassParser.cleanup | private function cleanup()
{
foreach ($this->tokens as $i => $t) {
if ($t[0] === self::$deleteToken) {
unset($this->tokens[$i]);
}
}
$this->tokens = array_values($this->tokens);
} | php | private function cleanup()
{
foreach ($this->tokens as $i => $t) {
if ($t[0] === self::$deleteToken) {
unset($this->tokens[$i]);
}
}
$this->tokens = array_values($this->tokens);
} | [
"private",
"function",
"cleanup",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"tokens",
"as",
"$",
"i",
"=>",
"$",
"t",
")",
"{",
"if",
"(",
"$",
"t",
"[",
"0",
"]",
"===",
"self",
"::",
"$",
"deleteToken",
")",
"{",
"unset",
"(",
"$",
... | Cleans up the token stream by deleting any tokens marked for
deletion, and makes sure the array is continuous afterwards. | [
"Cleans",
"up",
"the",
"token",
"stream",
"by",
"deleting",
"any",
"tokens",
"marked",
"for",
"deletion",
"and",
"makes",
"sure",
"the",
"array",
"is",
"continuous",
"afterwards",
"."
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/SassParser.php#L148-L156 |
markwatkinson/luminous | src/Luminous/Utils/SassParser.php | SassParser.parse | public function parse()
{
$newTokens = array();
$len = count($this->tokens);
$this->stack = array();
$propValue = 'PROPERTY';
$pushes = array(
'L_BRACKET' => 'bracket',
'L_BRACE' => 'brace',
'AT_IDENTIFIER' => 'at',
'L_SQ_BRACKE... | php | public function parse()
{
$newTokens = array();
$len = count($this->tokens);
$this->stack = array();
$propValue = 'PROPERTY';
$pushes = array(
'L_BRACKET' => 'bracket',
'L_BRACE' => 'brace',
'AT_IDENTIFIER' => 'at',
'L_SQ_BRACKE... | [
"public",
"function",
"parse",
"(",
")",
"{",
"$",
"newTokens",
"=",
"array",
"(",
")",
";",
"$",
"len",
"=",
"count",
"(",
"$",
"this",
"->",
"tokens",
")",
";",
"$",
"this",
"->",
"stack",
"=",
"array",
"(",
")",
";",
"$",
"propValue",
"=",
"... | Main parsing function | [
"Main",
"parsing",
"function"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Utils/SassParser.php#L161-L242 |
crysalead/net | src/Http/Psr7/MessageTrait.php | MessageTrait.getHeaders | public function getHeaders()
{
$headers = [];
foreach ($this->headers() as $name => $value) {
$headers[$name] = $value->data();
}
return $headers;
} | php | public function getHeaders()
{
$headers = [];
foreach ($this->headers() as $name => $value) {
$headers[$name] = $value->data();
}
return $headers;
} | [
"public",
"function",
"getHeaders",
"(",
")",
"{",
"$",
"headers",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"headers",
"(",
")",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"$",
"headers",
"[",
"$",
"name",
"]",
"=",
"$",
"va... | Retrieves all message header values.
The keys represent the header name as it will be sent over the wire, and
each value is an array of strings associated with the header.
// Represent the headers as a string
foreach ($message->getHeaders() as $name => $values) {
echo $name . ": " . implode(", ", $values);
}
// Emit... | [
"Retrieves",
"all",
"message",
"header",
"values",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/MessageTrait.php#L66-L73 |
crysalead/net | src/Http/Psr7/MessageTrait.php | MessageTrait.withAddedHeader | public function withAddedHeader($name, $value)
{
$message = clone $this;
$headers = $message->headers();
$headers[$name][] = $value;
return $message;
} | php | public function withAddedHeader($name, $value)
{
$message = clone $this;
$headers = $message->headers();
$headers[$name][] = $value;
return $message;
} | [
"public",
"function",
"withAddedHeader",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"message",
"=",
"clone",
"$",
"this",
";",
"$",
"headers",
"=",
"$",
"message",
"->",
"headers",
"(",
")",
";",
"$",
"headers",
"[",
"$",
"name",
"]",
"[",... | Return an instance with the specified header appended with the given value.
Existing values for the specified header will be maintained. The new
value(s) will be appended to the existing list. If the header did not
exist previously, it will be added.
@param string $name Case-insensitive header field name to a... | [
"Return",
"an",
"instance",
"with",
"the",
"specified",
"header",
"appended",
"with",
"the",
"given",
"value",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/MessageTrait.php#L167-L173 |
crysalead/net | src/Http/Psr7/MessageTrait.php | MessageTrait.withoutHeader | public function withoutHeader($name)
{
$message = clone $this;
$headers = $message->headers();
unset($headers[$name]);
return $message;
} | php | public function withoutHeader($name)
{
$message = clone $this;
$headers = $message->headers();
unset($headers[$name]);
return $message;
} | [
"public",
"function",
"withoutHeader",
"(",
"$",
"name",
")",
"{",
"$",
"message",
"=",
"clone",
"$",
"this",
";",
"$",
"headers",
"=",
"$",
"message",
"->",
"headers",
"(",
")",
";",
"unset",
"(",
"$",
"headers",
"[",
"$",
"name",
"]",
")",
";",
... | Return an instance without the specified header.
Header resolution MUST be done without case-sensitivity.
@param string $name Case-insensitive header field name to remove.
@return self | [
"Return",
"an",
"instance",
"without",
"the",
"specified",
"header",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/MessageTrait.php#L183-L189 |
crysalead/net | src/Http/Psr7/MessageTrait.php | MessageTrait.withBody | public function withBody(StreamInterface $body)
{
$message = clone $this;
$stream = $message->stream();
$stream->close();
$stream->add($body);
return $message;
} | php | public function withBody(StreamInterface $body)
{
$message = clone $this;
$stream = $message->stream();
$stream->close();
$stream->add($body);
return $message;
} | [
"public",
"function",
"withBody",
"(",
"StreamInterface",
"$",
"body",
")",
"{",
"$",
"message",
"=",
"clone",
"$",
"this",
";",
"$",
"stream",
"=",
"$",
"message",
"->",
"stream",
"(",
")",
";",
"$",
"stream",
"->",
"close",
"(",
")",
";",
"$",
"s... | Return an instance with the specified message body.
The body MUST be a StreamInterface object.
@param StreamInterface $body Body.
@return self
@throws InvalidArgumentException When the body is not valid. | [
"Return",
"an",
"instance",
"with",
"the",
"specified",
"message",
"body",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/MessageTrait.php#L211-L218 |
markwatkinson/luminous | src/Luminous/Scanners/GroovyScanner.php | GroovyScanner.interpString | public function interpString($m)
{
// this should only be called for doubly quoted strings
// and triple-double quotes
//
// interpolation is betwee ${ ... }
$patterns = array('interp' => '/(?<!\\$)\\$\\{/');
$start = $this->pos();
if (preg_match('/^"""/', $m[... | php | public function interpString($m)
{
// this should only be called for doubly quoted strings
// and triple-double quotes
//
// interpolation is betwee ${ ... }
$patterns = array('interp' => '/(?<!\\$)\\$\\{/');
$start = $this->pos();
if (preg_match('/^"""/', $m[... | [
"public",
"function",
"interpString",
"(",
"$",
"m",
")",
"{",
"// this should only be called for doubly quoted strings",
"// and triple-double quotes",
"//",
"// interpolation is betwee ${ ... }",
"$",
"patterns",
"=",
"array",
"(",
"'interp'",
"=>",
"'/(?<!\\\\$)\\\\$\\\\{/'"... | string interpolation is complex and it nests, so we do that in here | [
"string",
"interpolation",
"is",
"complex",
"and",
"it",
"nests",
"so",
"we",
"do",
"that",
"in",
"here"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/GroovyScanner.php#L55-L105 |
markwatkinson/luminous | src/Luminous/Scanners/GroovyScanner.php | GroovyScanner.brace | public function brace($m)
{
if ($m[0] === '{') {
$this->braceStack++;
} elseif ($m[0] === '}') {
if ($this->braceStack <= 0) {
return true;
}
$this->braceStack--;
} else {
assert(0);
}
$this->record($... | php | public function brace($m)
{
if ($m[0] === '{') {
$this->braceStack++;
} elseif ($m[0] === '}') {
if ($this->braceStack <= 0) {
return true;
}
$this->braceStack--;
} else {
assert(0);
}
$this->record($... | [
"public",
"function",
"brace",
"(",
"$",
"m",
")",
"{",
"if",
"(",
"$",
"m",
"[",
"0",
"]",
"===",
"'{'",
")",
"{",
"$",
"this",
"->",
"braceStack",
"++",
";",
"}",
"elseif",
"(",
"$",
"m",
"[",
"0",
"]",
"===",
"'}'",
")",
"{",
"if",
"(",
... | this is for interpolated code, the top-level scanner doesn't bind to this | [
"this",
"is",
"for",
"interpolated",
"code",
"the",
"top",
"-",
"level",
"scanner",
"doesn",
"t",
"bind",
"to",
"this"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/GroovyScanner.php#L109-L123 |
assely/fielder | src/Fielder.php | Fielder.get | public function get($name)
{
if (isset($this->fields[$name])) {
return $this->fields[$name];
}
throw new FieldException("Fielder doesn't have [$name] field registered.");
} | php | public function get($name)
{
if (isset($this->fields[$name])) {
return $this->fields[$name];
}
throw new FieldException("Fielder doesn't have [$name] field registered.");
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"fields",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"fields",
"[",
"$",
"name",
"]",
";",
"}",
"throw",
"new",
"FieldE... | Get registered field.
@param string $name
@return string | [
"Get",
"registered",
"field",
"."
] | train | https://github.com/assely/fielder/blob/c702ef2426522d1a0a9ca9945547513a7788fcdc/src/Fielder.php#L36-L43 |
assely/fielder | src/Fielder.php | Fielder.make | public function make($class, $type, $slug, $arguments = [])
{
$field = $this->container->make($class);
$field
->setType($type)
->setSlug($slug)
->setArguments($arguments)
->boot();
return $field;
} | php | public function make($class, $type, $slug, $arguments = [])
{
$field = $this->container->make($class);
$field
->setType($type)
->setSlug($slug)
->setArguments($arguments)
->boot();
return $field;
} | [
"public",
"function",
"make",
"(",
"$",
"class",
",",
"$",
"type",
",",
"$",
"slug",
",",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"$",
"field",
"=",
"$",
"this",
"->",
"container",
"->",
"make",
"(",
"$",
"class",
")",
";",
"$",
"field",
"->... | Creates field instance.
@param string $class
@param string $type
@param string $slug
@param array $arguments
@return \Assely\Contracts\Field\FieldInterface | [
"Creates",
"field",
"instance",
"."
] | train | https://github.com/assely/fielder/blob/c702ef2426522d1a0a9ca9945547513a7788fcdc/src/Fielder.php#L55-L66 |
dphn/ScContent | src/ScContent/Listener/Back/ContentListMove.php | ContentListMove.process | public function process(EventInterface $event)
{
$events = $this->getEventManager();
$mapper = $this->getMapper();
$optionsProvider = $this->getOptionsProvider();
$translator = $this->getTranslator();
$pane = $event->getParam('pane');
if (! $optionsProvider->hasIdenti... | php | public function process(EventInterface $event)
{
$events = $this->getEventManager();
$mapper = $this->getMapper();
$optionsProvider = $this->getOptionsProvider();
$translator = $this->getTranslator();
$pane = $event->getParam('pane');
if (! $optionsProvider->hasIdenti... | [
"public",
"function",
"process",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"events",
"=",
"$",
"this",
"->",
"getEventManager",
"(",
")",
";",
"$",
"mapper",
"=",
"$",
"this",
"->",
"getMapper",
"(",
")",
";",
"$",
"optionsProvider",
"=",
"$"... | Moving subtrees
@param \Zend\EventManager\EventInterface $event
@return null|\Zend\Http\Response | [
"Moving",
"subtrees"
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Listener/Back/ContentListMove.php#L84-L163 |
IftekherSunny/PDF | src/PDF.php | PDF.output | public function output($view, $data = [])
{
$path = $this->processOutput($view, $data);
$content = file_get_contents($path);
@unlink($path);
return $content;
} | php | public function output($view, $data = [])
{
$path = $this->processOutput($view, $data);
$content = file_get_contents($path);
@unlink($path);
return $content;
} | [
"public",
"function",
"output",
"(",
"$",
"view",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"processOutput",
"(",
"$",
"view",
",",
"$",
"data",
")",
";",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"... | Get pdf output for the view.
@param string $view
@param array $data
@return string | [
"Get",
"pdf",
"output",
"for",
"the",
"view",
"."
] | train | https://github.com/IftekherSunny/PDF/blob/798bad6b140a78d0c1a1823e12da3ed0e4f012ec/src/PDF.php#L49-L58 |
IftekherSunny/PDF | src/PDF.php | PDF.processOutput | protected function processOutput($view, $data = [])
{
$name = $this->generateFileName();
$path = __DIR__ . DIRECTORY_SEPARATOR . "{$name}";
file_put_contents($path, $this->generateView($view, $data));
$this->getPhantomProcess($path)->setTimeout(0)->mustRun();
re... | php | protected function processOutput($view, $data = [])
{
$name = $this->generateFileName();
$path = __DIR__ . DIRECTORY_SEPARATOR . "{$name}";
file_put_contents($path, $this->generateView($view, $data));
$this->getPhantomProcess($path)->setTimeout(0)->mustRun();
re... | [
"protected",
"function",
"processOutput",
"(",
"$",
"view",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"generateFileName",
"(",
")",
";",
"$",
"path",
"=",
"__DIR__",
".",
"DIRECTORY_SEPARATOR",
".",
"\"{$name}\"",
... | Process pdf output for the view.
@param string $view
@param array $data
@return string | [
"Process",
"pdf",
"output",
"for",
"the",
"view",
"."
] | train | https://github.com/IftekherSunny/PDF/blob/798bad6b140a78d0c1a1823e12da3ed0e4f012ec/src/PDF.php#L68-L79 |
IftekherSunny/PDF | src/PDF.php | PDF.download | public function download($view, $data = [], $name = 'download')
{
$path = $this->processOutput($view, $data);
return $this->responseDownload($path, $name);
} | php | public function download($view, $data = [], $name = 'download')
{
$path = $this->processOutput($view, $data);
return $this->responseDownload($path, $name);
} | [
"public",
"function",
"download",
"(",
"$",
"view",
",",
"$",
"data",
"=",
"[",
"]",
",",
"$",
"name",
"=",
"'download'",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"processOutput",
"(",
"$",
"view",
",",
"$",
"data",
")",
";",
"return",
"$",... | Download generated pdf file.
@param string $view
@param array $data
@param string $name
@return \Symfony\Component\HttpFoundation\Response | [
"Download",
"generated",
"pdf",
"file",
"."
] | train | https://github.com/IftekherSunny/PDF/blob/798bad6b140a78d0c1a1823e12da3ed0e4f012ec/src/PDF.php#L90-L95 |
IftekherSunny/PDF | src/PDF.php | PDF.responseDownload | protected function responseDownload($path, $name)
{
$response = new Response(file_get_contents($path), 200, [
'Content-Type' => 'application/pdf',
'Content-Description' => 'File Transfer',
'Content-Disposition' => 'attachment; filename="' . $name . '.pdf"',
... | php | protected function responseDownload($path, $name)
{
$response = new Response(file_get_contents($path), 200, [
'Content-Type' => 'application/pdf',
'Content-Description' => 'File Transfer',
'Content-Disposition' => 'attachment; filename="' . $name . '.pdf"',
... | [
"protected",
"function",
"responseDownload",
"(",
"$",
"path",
",",
"$",
"name",
")",
"{",
"$",
"response",
"=",
"new",
"Response",
"(",
"file_get_contents",
"(",
"$",
"path",
")",
",",
"200",
",",
"[",
"'Content-Type'",
"=>",
"'application/pdf'",
",",
"'C... | Http response to download the pdf.
@param string $path
@param string $name
@return \Symfony\Component\HttpFoundation\Response | [
"Http",
"response",
"to",
"download",
"the",
"pdf",
"."
] | train | https://github.com/IftekherSunny/PDF/blob/798bad6b140a78d0c1a1823e12da3ed0e4f012ec/src/PDF.php#L105-L117 |
IftekherSunny/PDF | src/PDF.php | PDF.stream | public function stream($view, $data = [])
{
$path = $this->processOutput($view, $data);
return $this->responseStream($path);
} | php | public function stream($view, $data = [])
{
$path = $this->processOutput($view, $data);
return $this->responseStream($path);
} | [
"public",
"function",
"stream",
"(",
"$",
"view",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"processOutput",
"(",
"$",
"view",
",",
"$",
"data",
")",
";",
"return",
"$",
"this",
"->",
"responseStream",
"(",
"... | View pdf in the browser.
@param string $view
@param array $data
@return \Symfony\Component\HttpFoundation\Response | [
"View",
"pdf",
"in",
"the",
"browser",
"."
] | train | https://github.com/IftekherSunny/PDF/blob/798bad6b140a78d0c1a1823e12da3ed0e4f012ec/src/PDF.php#L128-L133 |
IftekherSunny/PDF | src/PDF.php | PDF.responseStream | protected function responseStream($path)
{
$response = new Response(file_get_contents($path), 200, [
'Content-type' => 'application/pdf',
'Content-Transfer-Encoding' => 'binary'
]);
@unlink($path);
return $response->send();
} | php | protected function responseStream($path)
{
$response = new Response(file_get_contents($path), 200, [
'Content-type' => 'application/pdf',
'Content-Transfer-Encoding' => 'binary'
]);
@unlink($path);
return $response->send();
} | [
"protected",
"function",
"responseStream",
"(",
"$",
"path",
")",
"{",
"$",
"response",
"=",
"new",
"Response",
"(",
"file_get_contents",
"(",
"$",
"path",
")",
",",
"200",
",",
"[",
"'Content-type'",
"=>",
"'application/pdf'",
",",
"'Content-Transfer-Encoding'"... | Http response to stream pdf in the browser.
@param string $path
@return \Symfony\Component\HttpFoundation\Response | [
"Http",
"response",
"to",
"stream",
"pdf",
"in",
"the",
"browser",
"."
] | train | https://github.com/IftekherSunny/PDF/blob/798bad6b140a78d0c1a1823e12da3ed0e4f012ec/src/PDF.php#L142-L152 |
IftekherSunny/PDF | src/PDF.php | PDF.getSystem | protected function getSystem()
{
$osName = strtolower(php_uname());
if ($this->contains($osName, 'darwin')) {
return 'macosx';
} elseif ($this->contains($osName, 'win')) {
return 'windows';
} elseif ($this->contains($osName, 'linux')) {
r... | php | protected function getSystem()
{
$osName = strtolower(php_uname());
if ($this->contains($osName, 'darwin')) {
return 'macosx';
} elseif ($this->contains($osName, 'win')) {
return 'windows';
} elseif ($this->contains($osName, 'linux')) {
r... | [
"protected",
"function",
"getSystem",
"(",
")",
"{",
"$",
"osName",
"=",
"strtolower",
"(",
"php_uname",
"(",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"contains",
"(",
"$",
"osName",
",",
"'darwin'",
")",
")",
"{",
"return",
"'macosx'",
";",
"}",... | Get the operating system name for the current platform.
@return string | [
"Get",
"the",
"operating",
"system",
"name",
"for",
"the",
"current",
"platform",
"."
] | train | https://github.com/IftekherSunny/PDF/blob/798bad6b140a78d0c1a1823e12da3ed0e4f012ec/src/PDF.php#L175-L188 |
IftekherSunny/PDF | src/PDF.php | PDF.generateView | protected function generateView($view, $data = [])
{
if(is_null($this->viewPath)) {
return $view;
}
$twig = new Twig_Environment(
new Twig_Loader_Filesystem(realpath($this->viewPath))
);
return $twig->render($view, $data);
} | php | protected function generateView($view, $data = [])
{
if(is_null($this->viewPath)) {
return $view;
}
$twig = new Twig_Environment(
new Twig_Loader_Filesystem(realpath($this->viewPath))
);
return $twig->render($view, $data);
} | [
"protected",
"function",
"generateView",
"(",
"$",
"view",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"viewPath",
")",
")",
"{",
"return",
"$",
"view",
";",
"}",
"$",
"twig",
"=",
"new",
"Twig_Environme... | Generate view for the pdf file.
@param string $view
@param array $data
@return string | [
"Generate",
"view",
"for",
"the",
"pdf",
"file",
"."
] | train | https://github.com/IftekherSunny/PDF/blob/798bad6b140a78d0c1a1823e12da3ed0e4f012ec/src/PDF.php#L222-L233 |
IftekherSunny/PDF | src/PDF.php | PDF.getConfigurationFile | protected function getConfigurationFile()
{
if(!is_null($this->configPath)) {
return realpath($this->configPath);
} elseif(function_exists('base_path') and file_exists($phantomConfiguration = base_path() . DIRECTORY_SEPARATOR . 'SunPdf.js')) {
return realpath($phantomCon... | php | protected function getConfigurationFile()
{
if(!is_null($this->configPath)) {
return realpath($this->configPath);
} elseif(function_exists('base_path') and file_exists($phantomConfiguration = base_path() . DIRECTORY_SEPARATOR . 'SunPdf.js')) {
return realpath($phantomCon... | [
"protected",
"function",
"getConfigurationFile",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"configPath",
")",
")",
"{",
"return",
"realpath",
"(",
"$",
"this",
"->",
"configPath",
")",
";",
"}",
"elseif",
"(",
"function_exists",
"... | Get PhantomJS configuration file.
@return string | [
"Get",
"PhantomJS",
"configuration",
"file",
"."
] | train | https://github.com/IftekherSunny/PDF/blob/798bad6b140a78d0c1a1823e12da3ed0e4f012ec/src/PDF.php#L257-L266 |
fuelphp/filesystem | src/Filter.php | Filter.isCorrectType | public function isCorrectType($type, $path)
{
if ( ! $type)
{
return true;
}
if ( ! isset($this->typeCache[$path]))
{
$this->typeCache[$path] = is_file($path) ? 'file' : 'dir';
}
return $this->typeCache[$path] === $type;
} | php | public function isCorrectType($type, $path)
{
if ( ! $type)
{
return true;
}
if ( ! isset($this->typeCache[$path]))
{
$this->typeCache[$path] = is_file($path) ? 'file' : 'dir';
}
return $this->typeCache[$path] === $type;
} | [
"public",
"function",
"isCorrectType",
"(",
"$",
"type",
",",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"$",
"type",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"typeCache",
"[",
"$",
"path",
"]",
")",
")... | Checks wether an path is of the correct type, dir or file
@param string $type
@param string $path
@return boolean | [
"Checks",
"wether",
"an",
"path",
"is",
"of",
"the",
"correct",
"type",
"dir",
"or",
"file"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Filter.php#L33-L46 |
fuelphp/filesystem | src/Filter.php | Filter.filter | public function filter(array $contents)
{
$filtered = array();
$this->typeCache = array();
foreach ($contents as $item)
{
$passed = true;
foreach ($this->filters as $filter)
{
$correctType = $this->isCorrectType($filter['type'], $item);
if ($correctType and preg_match($filter['pattern'], $i... | php | public function filter(array $contents)
{
$filtered = array();
$this->typeCache = array();
foreach ($contents as $item)
{
$passed = true;
foreach ($this->filters as $filter)
{
$correctType = $this->isCorrectType($filter['type'], $item);
if ($correctType and preg_match($filter['pattern'], $i... | [
"public",
"function",
"filter",
"(",
"array",
"$",
"contents",
")",
"{",
"$",
"filtered",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"typeCache",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"contents",
"as",
"$",
"item",
")",
"{",
"$",
... | Filters a batch of filesystem entries
@param array $contents
@return array | [
"Filters",
"a",
"batch",
"of",
"filesystem",
"entries"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Filter.php#L55-L81 |
fuelphp/filesystem | src/Filter.php | Filter.addFilter | public function addFilter($filter, $expected = true, $type = null)
{
$filter = '#'.$filter.'#';
$this->filters[] = array(
'pattern' => $filter,
'expected' => $expected,
'type' => $type,
);
} | php | public function addFilter($filter, $expected = true, $type = null)
{
$filter = '#'.$filter.'#';
$this->filters[] = array(
'pattern' => $filter,
'expected' => $expected,
'type' => $type,
);
} | [
"public",
"function",
"addFilter",
"(",
"$",
"filter",
",",
"$",
"expected",
"=",
"true",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"filter",
"=",
"'#'",
".",
"$",
"filter",
".",
"'#'",
";",
"$",
"this",
"->",
"filters",
"[",
"]",
"=",
"array... | Adds a filter
@param string $filter
@param boolean $expected
@param string $type | [
"Adds",
"a",
"filter"
] | train | https://github.com/fuelphp/filesystem/blob/770a8cb04caca920af8029d7aad7208bc0592743/src/Filter.php#L90-L99 |
geniv/nette-thumbnail | src/Thumbnail.php | Thumbnail.cleanThumbnail | public static function cleanThumbnail(): array
{
$result = [];
$files = Finder::findFiles('*')->in(self::$parameters['thumbPath']);
foreach ($files as $file) {
if (unlink($file->getPathname())) {
$result[] = $file->getPathname();
}
}
re... | php | public static function cleanThumbnail(): array
{
$result = [];
$files = Finder::findFiles('*')->in(self::$parameters['thumbPath']);
foreach ($files as $file) {
if (unlink($file->getPathname())) {
$result[] = $file->getPathname();
}
}
re... | [
"public",
"static",
"function",
"cleanThumbnail",
"(",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"files",
"=",
"Finder",
"::",
"findFiles",
"(",
"'*'",
")",
"->",
"in",
"(",
"self",
"::",
"$",
"parameters",
"[",
"'thumbPath'",
"... | Clean thumbnail.
@return array | [
"Clean",
"thumbnail",
"."
] | train | https://github.com/geniv/nette-thumbnail/blob/408fc61e0df99113a873ca1ec463e4fc85016eed/src/Thumbnail.php#L47-L57 |
geniv/nette-thumbnail | src/Thumbnail.php | Thumbnail.getThumbFiles | private static function getThumbFiles(): array
{
$result = [];
$thumbFinder = Finder::findFiles('*')->in(self::$parameters['thumbPath']);
foreach ($thumbFinder as $file) {
$basename = $file->getBaseName();
$specialDelimiter = strrpos($basename, '_');
// $pa... | php | private static function getThumbFiles(): array
{
$result = [];
$thumbFinder = Finder::findFiles('*')->in(self::$parameters['thumbPath']);
foreach ($thumbFinder as $file) {
$basename = $file->getBaseName();
$specialDelimiter = strrpos($basename, '_');
// $pa... | [
"private",
"static",
"function",
"getThumbFiles",
"(",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"thumbFinder",
"=",
"Finder",
"::",
"findFiles",
"(",
"'*'",
")",
"->",
"in",
"(",
"self",
"::",
"$",
"parameters",
"[",
"'thumbPath'... | Get thumb files.
@return array | [
"Get",
"thumb",
"files",
"."
] | train | https://github.com/geniv/nette-thumbnail/blob/408fc61e0df99113a873ca1ec463e4fc85016eed/src/Thumbnail.php#L65-L82 |
geniv/nette-thumbnail | src/Thumbnail.php | Thumbnail.getPathFiles | private static function getPathFiles(array $path): array
{
// load external files
$result = [];
$pathFinder = Finder::findFiles('*')->in($path);
foreach ($pathFinder as $file) {
$result[$file->getRealPath()] = $file->getBaseName();
}
return $result;
} | php | private static function getPathFiles(array $path): array
{
// load external files
$result = [];
$pathFinder = Finder::findFiles('*')->in($path);
foreach ($pathFinder as $file) {
$result[$file->getRealPath()] = $file->getBaseName();
}
return $result;
} | [
"private",
"static",
"function",
"getPathFiles",
"(",
"array",
"$",
"path",
")",
":",
"array",
"{",
"// load external files",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"pathFinder",
"=",
"Finder",
"::",
"findFiles",
"(",
"'*'",
")",
"->",
"in",
"(",
"$",
... | Get path files.
@param array $path
@return array | [
"Get",
"path",
"files",
"."
] | train | https://github.com/geniv/nette-thumbnail/blob/408fc61e0df99113a873ca1ec463e4fc85016eed/src/Thumbnail.php#L91-L100 |
geniv/nette-thumbnail | src/Thumbnail.php | Thumbnail.synchronizeThumbnail | public static function synchronizeThumbnail(array $path): array
{
$result = [];
//TODO rebuild or removed - it was be lite check
// // remove duplicate files
// $counts = array_count_values($thumbFiles);
// $duplicate = array_filter($counts, function ($row) { return $row > 1; }... | php | public static function synchronizeThumbnail(array $path): array
{
$result = [];
//TODO rebuild or removed - it was be lite check
// // remove duplicate files
// $counts = array_count_values($thumbFiles);
// $duplicate = array_filter($counts, function ($row) { return $row > 1; }... | [
"public",
"static",
"function",
"synchronizeThumbnail",
"(",
"array",
"$",
"path",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"//TODO rebuild or removed - it was be lite check",
"// // remove duplicate files",
"// $counts = array_count_values($th... | Synchronize thumbnail.
@param array $path
@return array | [
"Synchronize",
"thumbnail",
"."
] | train | https://github.com/geniv/nette-thumbnail/blob/408fc61e0df99113a873ca1ec463e4fc85016eed/src/Thumbnail.php#L109-L141 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.