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/models/Property.php | Property.validationCastFunction | public static function validationCastFunction($type)
{
switch ($type) {
case Property::DATA_TYPE_FLOAT:
return 'floatval';
break;
case Property::DATA_TYPE_BOOLEAN:
return 'boolval';
break;
case Property::DA... | php | public static function validationCastFunction($type)
{
switch ($type) {
case Property::DATA_TYPE_FLOAT:
return 'floatval';
break;
case Property::DATA_TYPE_BOOLEAN:
return 'boolval';
break;
case Property::DA... | [
"public",
"static",
"function",
"validationCastFunction",
"(",
"$",
"type",
")",
"{",
"switch",
"(",
"$",
"type",
")",
"{",
"case",
"Property",
"::",
"DATA_TYPE_FLOAT",
":",
"return",
"'floatval'",
";",
"break",
";",
"case",
"Property",
"::",
"DATA_TYPE_BOOLEA... | Returns name of function for filtering, data casting
@param $type
@return null|string | [
"Returns",
"name",
"of",
"function",
"for",
"filtering",
"data",
"casting"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L433-L457 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.findById | public static function findById($id, $throwException = true)
{
$e = $throwException ? new ServerErrorHttpException("Property with id $id not found") : false;
return static::loadModel(
$id,
false,
true,
86400,
$e,
true
)... | php | public static function findById($id, $throwException = true)
{
$e = $throwException ? new ServerErrorHttpException("Property with id $id not found") : false;
return static::loadModel(
$id,
false,
true,
86400,
$e,
true
)... | [
"public",
"static",
"function",
"findById",
"(",
"$",
"id",
",",
"$",
"throwException",
"=",
"true",
")",
"{",
"$",
"e",
"=",
"$",
"throwException",
"?",
"new",
"ServerErrorHttpException",
"(",
"\"Property with id $id not found\"",
")",
":",
"false",
";",
"ret... | A proxy method for LoadModel
@param integer $id
@param boolean $throwException
@return Property
@throws \Exception | [
"A",
"proxy",
"method",
"for",
"LoadModel"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L496-L508 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.findByIds | public static function findByIds($ids, $throwException = true)
{
$ids = array_unique($ids);
$ids = array_map('intval', $ids);
$ids2find = array_diff($ids, array_keys(static::$identityMap));
if (count($ids2find) > 0) {
Property::find()->where(['in', 'id', $ids2find])->all(... | php | public static function findByIds($ids, $throwException = true)
{
$ids = array_unique($ids);
$ids = array_map('intval', $ids);
$ids2find = array_diff($ids, array_keys(static::$identityMap));
if (count($ids2find) > 0) {
Property::find()->where(['in', 'id', $ids2find])->all(... | [
"public",
"static",
"function",
"findByIds",
"(",
"$",
"ids",
",",
"$",
"throwException",
"=",
"true",
")",
"{",
"$",
"ids",
"=",
"array_unique",
"(",
"$",
"ids",
")",
";",
"$",
"ids",
"=",
"array_map",
"(",
"'intval'",
",",
"$",
"ids",
")",
";",
"... | Returns properties by ids
@param int[] $ids
@param bool $throwException
@todo Add SMART cache here
@return mixed | [
"Returns",
"properties",
"by",
"ids",
"@param",
"int",
"[]",
"$ids",
"@param",
"bool",
"$throwException",
"@todo",
"Add",
"SMART",
"cache",
"here"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L518-L539 |
DevGroup-ru/yii2-data-structure-tools | src/models/Property.php | Property.isRequired | public function isRequired()
{
$params = $this->params;
$required = boolval(ArrayHelper::getValue($params, Property::PACKED_ADDITIONAL_RULES . '.required', false));
return $required;
} | php | public function isRequired()
{
$params = $this->params;
$required = boolval(ArrayHelper::getValue($params, Property::PACKED_ADDITIONAL_RULES . '.required', false));
return $required;
} | [
"public",
"function",
"isRequired",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"params",
";",
"$",
"required",
"=",
"boolval",
"(",
"ArrayHelper",
"::",
"getValue",
"(",
"$",
"params",
",",
"Property",
"::",
"PACKED_ADDITIONAL_RULES",
".",
"'.re... | check if property required
@return bool | [
"check",
"if",
"property",
"required"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/models/Property.php#L629-L634 |
PandaPlatform/framework | src/Panda/Localization/GeoIp.php | GeoIp.getTimezoneByIP | public function getTimezoneByIP($ipAddress = '')
{
// Get remote ip address if empty
$ipAddress = (empty($ipAddress) ? $this->request->server->get('REMOTE_ADDR') : $ipAddress);
// Get country code
// In the future should be replaced with full region info
// to support countr... | php | public function getTimezoneByIP($ipAddress = '')
{
// Get remote ip address if empty
$ipAddress = (empty($ipAddress) ? $this->request->server->get('REMOTE_ADDR') : $ipAddress);
// Get country code
// In the future should be replaced with full region info
// to support countr... | [
"public",
"function",
"getTimezoneByIP",
"(",
"$",
"ipAddress",
"=",
"''",
")",
"{",
"// Get remote ip address if empty",
"$",
"ipAddress",
"=",
"(",
"empty",
"(",
"$",
"ipAddress",
")",
"?",
"$",
"this",
"->",
"request",
"->",
"server",
"->",
"get",
"(",
... | Get the corresponding timezone according to ip address.
@param string $ipAddress The ip address to get the timezone for.
@return string
@throws Exception | [
"Get",
"the",
"corresponding",
"timezone",
"according",
"to",
"ip",
"address",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Localization/GeoIp.php#L47-L64 |
PandaPlatform/framework | src/Panda/Localization/GeoIp.php | GeoIp.getCountryCode2ByIP | public function getCountryCode2ByIP($ipAddress = '')
{
// Get remote ip address if empty
$ipAddress = (empty($ipAddress) ? $this->request->server->get('REMOTE_ADDR') : $ipAddress);
// Check implementation
if (!function_exists('geoip_country_code_by_name')) {
throw new Ex... | php | public function getCountryCode2ByIP($ipAddress = '')
{
// Get remote ip address if empty
$ipAddress = (empty($ipAddress) ? $this->request->server->get('REMOTE_ADDR') : $ipAddress);
// Check implementation
if (!function_exists('geoip_country_code_by_name')) {
throw new Ex... | [
"public",
"function",
"getCountryCode2ByIP",
"(",
"$",
"ipAddress",
"=",
"''",
")",
"{",
"// Get remote ip address if empty",
"$",
"ipAddress",
"=",
"(",
"empty",
"(",
"$",
"ipAddress",
")",
"?",
"$",
"this",
"->",
"request",
"->",
"server",
"->",
"get",
"("... | Get the country ISO2A code by ip.
@param string $ipAddress The ip address to get the country code for.
@return string
@throws Exception | [
"Get",
"the",
"country",
"ISO2A",
"code",
"by",
"ip",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Localization/GeoIp.php#L75-L87 |
PandaPlatform/framework | src/Panda/Localization/GeoIp.php | GeoIp.getCountryCode3ByIP | public function getCountryCode3ByIP($ipAddress = '')
{
// Get remote ip address if empty
$ipAddress = (empty($ipAddress) ? $this->request->server->get('REMOTE_ADDR') : $ipAddress);
// Check implementation
if (!function_exists('geoip_country_code3_by_name')) {
throw new E... | php | public function getCountryCode3ByIP($ipAddress = '')
{
// Get remote ip address if empty
$ipAddress = (empty($ipAddress) ? $this->request->server->get('REMOTE_ADDR') : $ipAddress);
// Check implementation
if (!function_exists('geoip_country_code3_by_name')) {
throw new E... | [
"public",
"function",
"getCountryCode3ByIP",
"(",
"$",
"ipAddress",
"=",
"''",
")",
"{",
"// Get remote ip address if empty",
"$",
"ipAddress",
"=",
"(",
"empty",
"(",
"$",
"ipAddress",
")",
"?",
"$",
"this",
"->",
"request",
"->",
"server",
"->",
"get",
"("... | Get the country ISO3A code by ip.
@param string $ipAddress The ip address to get the country code for.
@return string
@throws Exception | [
"Get",
"the",
"country",
"ISO3A",
"code",
"by",
"ip",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Localization/GeoIp.php#L98-L110 |
christophe-brachet/aspi-framework | src/Framework/Form/Element/Input/Password.php | Password.render | public function render($depth = 0, $indent = null, $inner = false)
{
if (!$this->renderValue) {
$this->setAttribute('value', '');
}
return parent::render($depth, $indent, $inner);
} | php | public function render($depth = 0, $indent = null, $inner = false)
{
if (!$this->renderValue) {
$this->setAttribute('value', '');
}
return parent::render($depth, $indent, $inner);
} | [
"public",
"function",
"render",
"(",
"$",
"depth",
"=",
"0",
",",
"$",
"indent",
"=",
"null",
",",
"$",
"inner",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"renderValue",
")",
"{",
"$",
"this",
"->",
"setAttribute",
"(",
"'value'",
... | Render the password element
@param int $depth
@param string $indent
@param boolean $inner
@return mixed | [
"Render",
"the",
"password",
"element"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Input/Password.php#L67-L73 |
sebastiansulinski/laravel-pagination | src/Pagination/Pagination.php | Pagination.render | public function render()
{
if ( ! $this->hasPages()) {
return null;
}
return sprintf(
$this->wrapper,
$this->getPreviousButton(),
$this->getLinks(),
$this->getNextButton()
);
} | php | public function render()
{
if ( ! $this->hasPages()) {
return null;
}
return sprintf(
$this->wrapper,
$this->getPreviousButton(),
$this->getLinks(),
$this->getNextButton()
);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasPages",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"wrapper",
",",
"$",
"this",
"->",
"getPreviousButton",
"(",
... | Render the given paginator.
@return string|null | [
"Render",
"the",
"given",
"paginator",
"."
] | train | https://github.com/sebastiansulinski/laravel-pagination/blob/fdd1e6e437c908ce360e72c1f99eb0142a35e8f2/src/Pagination/Pagination.php#L114-L126 |
sebastiansulinski/laravel-pagination | src/Pagination/Pagination.php | Pagination.getAvailablePageWrapper | protected function getAvailablePageWrapper($url, $page, $rel = null)
{
return sprintf($this->availablePageWrapper, $url, $page);
} | php | protected function getAvailablePageWrapper($url, $page, $rel = null)
{
return sprintf($this->availablePageWrapper, $url, $page);
} | [
"protected",
"function",
"getAvailablePageWrapper",
"(",
"$",
"url",
",",
"$",
"page",
",",
"$",
"rel",
"=",
"null",
")",
"{",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"availablePageWrapper",
",",
"$",
"url",
",",
"$",
"page",
")",
";",
"}"
] | Get html tag for an available link.
@param string $url
@param int $page
@param null|string $rel
@return string | [
"Get",
"html",
"tag",
"for",
"an",
"available",
"link",
"."
] | train | https://github.com/sebastiansulinski/laravel-pagination/blob/fdd1e6e437c908ce360e72c1f99eb0142a35e8f2/src/Pagination/Pagination.php#L136-L139 |
sebastiansulinski/laravel-pagination | src/Pagination/Pagination.php | Pagination.getAvailablePrevNextPageWrapper | protected function getAvailablePrevNextPageWrapper($url, $page, $rel = null)
{
return sprintf($this->availablePrevNextPageWrapper, $url, $rel, $page);
} | php | protected function getAvailablePrevNextPageWrapper($url, $page, $rel = null)
{
return sprintf($this->availablePrevNextPageWrapper, $url, $rel, $page);
} | [
"protected",
"function",
"getAvailablePrevNextPageWrapper",
"(",
"$",
"url",
",",
"$",
"page",
",",
"$",
"rel",
"=",
"null",
")",
"{",
"return",
"sprintf",
"(",
"$",
"this",
"->",
"availablePrevNextPageWrapper",
",",
"$",
"url",
",",
"$",
"rel",
",",
"$",
... | Get html tag for an available prev/next link.
@param string $url
@param int $page
@param null|string $rel
@return string | [
"Get",
"html",
"tag",
"for",
"an",
"available",
"prev",
"/",
"next",
"link",
"."
] | train | https://github.com/sebastiansulinski/laravel-pagination/blob/fdd1e6e437c908ce360e72c1f99eb0142a35e8f2/src/Pagination/Pagination.php#L149-L152 |
sebastiansulinski/laravel-pagination | src/Pagination/Pagination.php | Pagination.getPreviousButton | protected function getPreviousButton()
{
if ($this->paginator->currentPage() <= 1) {
return $this->getDisabledLink($this->previousButtonText);
}
$url = $this->paginator->url(
$this->paginator->currentPage() - 1
);
return $this->getPrevNextPageLinkWra... | php | protected function getPreviousButton()
{
if ($this->paginator->currentPage() <= 1) {
return $this->getDisabledLink($this->previousButtonText);
}
$url = $this->paginator->url(
$this->paginator->currentPage() - 1
);
return $this->getPrevNextPageLinkWra... | [
"protected",
"function",
"getPreviousButton",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"paginator",
"->",
"currentPage",
"(",
")",
"<=",
"1",
")",
"{",
"return",
"$",
"this",
"->",
"getDisabledLink",
"(",
"$",
"this",
"->",
"previousButtonText",
")",
... | Get html tag the previous page link.
@return string | [
"Get",
"html",
"tag",
"the",
"previous",
"page",
"link",
"."
] | train | https://github.com/sebastiansulinski/laravel-pagination/blob/fdd1e6e437c908ce360e72c1f99eb0142a35e8f2/src/Pagination/Pagination.php#L211-L222 |
sebastiansulinski/laravel-pagination | src/Pagination/Pagination.php | Pagination.getNextButton | protected function getNextButton()
{
if ( ! $this->paginator->hasMorePages()) {
return $this->getDisabledLink($this->nextButtonText);
}
$url = $this->paginator->url($this->paginator->currentPage() + 1);
return $this->getPrevNextPageLinkWrapper($url, $this->nextButtonTex... | php | protected function getNextButton()
{
if ( ! $this->paginator->hasMorePages()) {
return $this->getDisabledLink($this->nextButtonText);
}
$url = $this->paginator->url($this->paginator->currentPage() + 1);
return $this->getPrevNextPageLinkWrapper($url, $this->nextButtonTex... | [
"protected",
"function",
"getNextButton",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"paginator",
"->",
"hasMorePages",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getDisabledLink",
"(",
"$",
"this",
"->",
"nextButtonText",
")",
";",
"}",
... | Get html tag for the next page link.
@return string | [
"Get",
"html",
"tag",
"for",
"the",
"next",
"page",
"link",
"."
] | train | https://github.com/sebastiansulinski/laravel-pagination/blob/fdd1e6e437c908ce360e72c1f99eb0142a35e8f2/src/Pagination/Pagination.php#L229-L238 |
sebastiansulinski/laravel-pagination | src/Pagination/Pagination.php | Pagination.getPrevNextPageLinkWrapper | protected function getPrevNextPageLinkWrapper($url, $page, $rel = null)
{
if ($page == $this->paginator->currentPage()) {
return $this->getActivePageWrapper($page);
}
return $this->getAvailablePrevNextPageWrapper($url, $page, $rel);
} | php | protected function getPrevNextPageLinkWrapper($url, $page, $rel = null)
{
if ($page == $this->paginator->currentPage()) {
return $this->getActivePageWrapper($page);
}
return $this->getAvailablePrevNextPageWrapper($url, $page, $rel);
} | [
"protected",
"function",
"getPrevNextPageLinkWrapper",
"(",
"$",
"url",
",",
"$",
"page",
",",
"$",
"rel",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"page",
"==",
"$",
"this",
"->",
"paginator",
"->",
"currentPage",
"(",
")",
")",
"{",
"return",
"$",
"t... | Get HTML wrapper for a prev/next page link.
@param string $url
@param int $page
@param string|null $rel
@return string | [
"Get",
"HTML",
"wrapper",
"for",
"a",
"prev",
"/",
"next",
"page",
"link",
"."
] | train | https://github.com/sebastiansulinski/laravel-pagination/blob/fdd1e6e437c908ce360e72c1f99eb0142a35e8f2/src/Pagination/Pagination.php#L248-L255 |
yosmanyga/validation | src/Yosmanyga/Validation/Validator/ExpressionPropertyValidator.php | ExpressionPropertyValidator.validate | public function validate($object, $property)
{
$this->expressionScalarValidator->addVariable('this', $object);
$value = $this->propertyAccessor->getValue($object, $property);
return $this->expressionScalarValidator->validate($value);
} | php | public function validate($object, $property)
{
$this->expressionScalarValidator->addVariable('this', $object);
$value = $this->propertyAccessor->getValue($object, $property);
return $this->expressionScalarValidator->validate($value);
} | [
"public",
"function",
"validate",
"(",
"$",
"object",
",",
"$",
"property",
")",
"{",
"$",
"this",
"->",
"expressionScalarValidator",
"->",
"addVariable",
"(",
"'this'",
",",
"$",
"object",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"propertyAccessor"... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Validator/ExpressionPropertyValidator.php#L35-L42 |
skeeks-semenov/yii2-dadata-suggest-api | DadataSuggestApiBase.php | DadataSuggestApiBase._createHttpRequest | public function _createHttpRequest($apiMethod, array $params = [], $requestMethod = "POST")
{
$apiUrl = $this->baseUrl . $apiMethod;
$client = new Client();
if ($requestMethod == "POST")
{
$client->requestConfig = ['format' => Client::FORMAT_JSON];
}
... | php | public function _createHttpRequest($apiMethod, array $params = [], $requestMethod = "POST")
{
$apiUrl = $this->baseUrl . $apiMethod;
$client = new Client();
if ($requestMethod == "POST")
{
$client->requestConfig = ['format' => Client::FORMAT_JSON];
}
... | [
"public",
"function",
"_createHttpRequest",
"(",
"$",
"apiMethod",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"requestMethod",
"=",
"\"POST\"",
")",
"{",
"$",
"apiUrl",
"=",
"$",
"this",
"->",
"baseUrl",
".",
"$",
"apiMethod",
";",
"$",
"cli... | @param $apiMethod
@param array $params
@param string $requestMethod
@return Request | [
"@param",
"$apiMethod",
"@param",
"array",
"$params",
"@param",
"string",
"$requestMethod"
] | train | https://github.com/skeeks-semenov/yii2-dadata-suggest-api/blob/9ff6e7af54344d059dce0ed08797880142d0ff6b/DadataSuggestApiBase.php#L73-L105 |
skeeks-semenov/yii2-dadata-suggest-api | DadataSuggestApiBase.php | DadataSuggestApiBase.send | public function send($apiMethod, array $params = [], $requestMethod = "POST")
{
$requestMethod = strtoupper($requestMethod);
$httpRequest = $this->_createHttpRequest($apiMethod, $params, $requestMethod);
$httpResponse = $httpRequest->send();
$apiResponse = new ApiRespo... | php | public function send($apiMethod, array $params = [], $requestMethod = "POST")
{
$requestMethod = strtoupper($requestMethod);
$httpRequest = $this->_createHttpRequest($apiMethod, $params, $requestMethod);
$httpResponse = $httpRequest->send();
$apiResponse = new ApiRespo... | [
"public",
"function",
"send",
"(",
"$",
"apiMethod",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"requestMethod",
"=",
"\"POST\"",
")",
"{",
"$",
"requestMethod",
"=",
"strtoupper",
"(",
"$",
"requestMethod",
")",
";",
"$",
"httpRequest",
"=",
... | @param $apiMethod вызываемый метод, список приведен далее, пример /rs/suggest/address
@param array $params параметры соответствующие методу запроса пример ['query' => 'Хабар', 'count' => 10]
@return ApiResponse | [
"@param",
"$apiMethod",
"вызываемый",
"метод",
"список",
"приведен",
"далее",
"пример",
"/",
"rs",
"/",
"suggest",
"/",
"address",
"@param",
"array",
"$params",
"параметры",
"соответствующие",
"методу",
"запроса",
"пример",
"[",
"query",
"=",
">",
"Хабар",
"coun... | train | https://github.com/skeeks-semenov/yii2-dadata-suggest-api/blob/9ff6e7af54344d059dce0ed08797880142d0ff6b/DadataSuggestApiBase.php#L113-L128 |
javihgil/doctrine-pagination | ORM/PaginatedRepository.php | PaginatedRepository.findBy | public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
{
if ($offset !== null && $limit) {
$page = ceil($offset/$limit) + 1;
} else {
$page = 1;
}
if (!$limit) {
$limit = 100000000;
}
return ... | php | public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
{
if ($offset !== null && $limit) {
$page = ceil($offset/$limit) + 1;
} else {
$page = 1;
}
if (!$limit) {
$limit = 100000000;
}
return ... | [
"public",
"function",
"findBy",
"(",
"array",
"$",
"criteria",
",",
"array",
"$",
"orderBy",
"=",
"null",
",",
"$",
"limit",
"=",
"null",
",",
"$",
"offset",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"offset",
"!==",
"null",
"&&",
"$",
"limit",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/javihgil/doctrine-pagination/blob/7c6412992ba6df6e5ce5ff8e80479f60014358bf/ORM/PaginatedRepository.php#L17-L30 |
javihgil/doctrine-pagination | ORM/PaginatedRepository.php | PaginatedRepository.findPageBy | public function findPageBy($page, $rpp, array $criteria = [], array $orderBy = null, $hydrateMode = AbstractQuery::HYDRATE_OBJECT)
{
$qb = $this->createPaginatedQueryBuilder($criteria, null, $orderBy);
$qb->addSelect($this->getEntityAlias());
$this->processOrderBy($qb, $orderBy);
$qb... | php | public function findPageBy($page, $rpp, array $criteria = [], array $orderBy = null, $hydrateMode = AbstractQuery::HYDRATE_OBJECT)
{
$qb = $this->createPaginatedQueryBuilder($criteria, null, $orderBy);
$qb->addSelect($this->getEntityAlias());
$this->processOrderBy($qb, $orderBy);
$qb... | [
"public",
"function",
"findPageBy",
"(",
"$",
"page",
",",
"$",
"rpp",
",",
"array",
"$",
"criteria",
"=",
"[",
"]",
",",
"array",
"$",
"orderBy",
"=",
"null",
",",
"$",
"hydrateMode",
"=",
"AbstractQuery",
"::",
"HYDRATE_OBJECT",
")",
"{",
"$",
"qb",
... | @param int $page
@param int $rpp
@param array $criteria
@param array $orderBy
@param int $hydrateMode
@return PaginatedArrayCollection | [
"@param",
"int",
"$page",
"@param",
"int",
"$rpp",
"@param",
"array",
"$criteria",
"@param",
"array",
"$orderBy",
"@param",
"int",
"$hydrateMode"
] | train | https://github.com/javihgil/doctrine-pagination/blob/7c6412992ba6df6e5ce5ff8e80479f60014358bf/ORM/PaginatedRepository.php#L41-L52 |
javihgil/doctrine-pagination | ORM/PaginatedRepository.php | PaginatedRepository.createPaginatedQueryBuilder | protected function createPaginatedQueryBuilder(array $criteria = [], $indexBy = null, array $orderBy = null)
{
$qb = new PaginatedQueryBuilder($this->_em);
$qb->from($this->_entityName, $this->getEntityAlias(), $indexBy);
$this->processCriteria($qb, $criteria);
return $qb;
} | php | protected function createPaginatedQueryBuilder(array $criteria = [], $indexBy = null, array $orderBy = null)
{
$qb = new PaginatedQueryBuilder($this->_em);
$qb->from($this->_entityName, $this->getEntityAlias(), $indexBy);
$this->processCriteria($qb, $criteria);
return $qb;
} | [
"protected",
"function",
"createPaginatedQueryBuilder",
"(",
"array",
"$",
"criteria",
"=",
"[",
"]",
",",
"$",
"indexBy",
"=",
"null",
",",
"array",
"$",
"orderBy",
"=",
"null",
")",
"{",
"$",
"qb",
"=",
"new",
"PaginatedQueryBuilder",
"(",
"$",
"this",
... | Creates a query builder for pagination
@param array $criteria
@param string $indexBy
@param array|null $orderBy
@return PaginatedQueryBuilder | [
"Creates",
"a",
"query",
"builder",
"for",
"pagination"
] | train | https://github.com/javihgil/doctrine-pagination/blob/7c6412992ba6df6e5ce5ff8e80479f60014358bf/ORM/PaginatedRepository.php#L75-L83 |
chippyash/Strong-Type | src/Chippyash/Type/Number/Rational/RationalType.php | RationalType.reduce | protected function reduce()
{
/** @noinspection PhpUndefinedMethodInspection */
$gcd = $this->gcd($this->value['num']->get(), $this->value['den']->get());
if ($gcd > 1) {
$this->value['num']->set($this->value['num']->get() / $gcd) ;
$this->value['den']->set($this->val... | php | protected function reduce()
{
/** @noinspection PhpUndefinedMethodInspection */
$gcd = $this->gcd($this->value['num']->get(), $this->value['den']->get());
if ($gcd > 1) {
$this->value['num']->set($this->value['num']->get() / $gcd) ;
$this->value['den']->set($this->val... | [
"protected",
"function",
"reduce",
"(",
")",
"{",
"/** @noinspection PhpUndefinedMethodInspection */",
"$",
"gcd",
"=",
"$",
"this",
"->",
"gcd",
"(",
"$",
"this",
"->",
"value",
"[",
"'num'",
"]",
"->",
"get",
"(",
")",
",",
"$",
"this",
"->",
"value",
... | Reduce this number to it's lowest form
@return void | [
"Reduce",
"this",
"number",
"to",
"it",
"s",
"lowest",
"form"
] | train | https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/Number/Rational/RationalType.php#L56-L64 |
nyeholt/silverstripe-simplewiki | thirdparty/wikiparser-1.0/class_XMLParser.php | XMLParser.xmlize | function xmlize($data) {
$vals = $index = $array = array();
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
// XML_OPTION_SKIP_WHITE is disabled as it clobbers valid
// newlines in instant messages
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
x... | php | function xmlize($data) {
$vals = $index = $array = array();
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
// XML_OPTION_SKIP_WHITE is disabled as it clobbers valid
// newlines in instant messages
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0);
x... | [
"function",
"xmlize",
"(",
"$",
"data",
")",
"{",
"$",
"vals",
"=",
"$",
"index",
"=",
"$",
"array",
"=",
"array",
"(",
")",
";",
"$",
"parser",
"=",
"xml_parser_create",
"(",
")",
";",
"xml_parser_set_option",
"(",
"$",
"parser",
",",
"XML_OPTION_CASE... | (c) Hans Anderson / http://www.hansanderson.com/php/xml/ | [
"(",
"c",
")",
"Hans",
"Anderson",
"/",
"http",
":",
"//",
"www",
".",
"hansanderson",
".",
"com",
"/",
"php",
"/",
"xml",
"/"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/wikiparser-1.0/class_XMLParser.php#L41-L59 |
nyeholt/silverstripe-simplewiki | thirdparty/wikiparser-1.0/class_XMLParser.php | XMLParser._xml_depth | function _xml_depth($vals, &$i) {
$children = array();
if ($vals[$i]['value']) {
array_push($children, trim($vals[$i]['value']));
}
while (++$i < count($vals)) {
switch ($vals[$i]['type']) {
case 'cdata':
array_push($children, trim($vals[$i]['value']));
break;
case 'complete':
$... | php | function _xml_depth($vals, &$i) {
$children = array();
if ($vals[$i]['value']) {
array_push($children, trim($vals[$i]['value']));
}
while (++$i < count($vals)) {
switch ($vals[$i]['type']) {
case 'cdata':
array_push($children, trim($vals[$i]['value']));
break;
case 'complete':
$... | [
"function",
"_xml_depth",
"(",
"$",
"vals",
",",
"&",
"$",
"i",
")",
"{",
"$",
"children",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"vals",
"[",
"$",
"i",
"]",
"[",
"'value'",
"]",
")",
"{",
"array_push",
"(",
"$",
"children",
",",
"trim",
... | (c) Hans Anderson / http://www.hansanderson.com/php/xml/ | [
"(",
"c",
")",
"Hans",
"Anderson",
"/",
"http",
":",
"//",
"www",
".",
"hansanderson",
".",
"com",
"/",
"php",
"/",
"xml",
"/"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/wikiparser-1.0/class_XMLParser.php#L66-L106 |
nyeholt/silverstripe-simplewiki | thirdparty/wikiparser-1.0/class_XMLParser.php | XMLParser.TraverseXMLize | function TraverseXMLize($array, $arrName = "array", $level = 0) {
if ($level == 0) {
echo "<pre>";
}
while (list($key, $val) = @each($array)) {
if (is_array($val)) {
$this->TraverseXMLize($val, $arrName . "[" . $key . "]", $level + 1);
} else {
echo '$' . $arrName . '[' . $key . '] = "' . $val .... | php | function TraverseXMLize($array, $arrName = "array", $level = 0) {
if ($level == 0) {
echo "<pre>";
}
while (list($key, $val) = @each($array)) {
if (is_array($val)) {
$this->TraverseXMLize($val, $arrName . "[" . $key . "]", $level + 1);
} else {
echo '$' . $arrName . '[' . $key . '] = "' . $val .... | [
"function",
"TraverseXMLize",
"(",
"$",
"array",
",",
"$",
"arrName",
"=",
"\"array\"",
",",
"$",
"level",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"level",
"==",
"0",
")",
"{",
"echo",
"\"<pre>\"",
";",
"}",
"while",
"(",
"list",
"(",
"$",
"key",
","... | (c) acebone@f2s.com, a HUGE help! | [
"(",
"c",
")",
"acebone"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/wikiparser-1.0/class_XMLParser.php#L113-L129 |
ionutmilica/laravel-settings | src/SettingsImpl.php | SettingsImpl.get | public function get($key, $default = null, $save = false)
{
$this->load();
if ($this->has($key)) {
return Arr::get($this->settings, $key, $default);
}
if ($save) {
$this->set($key, $default);
}
if ($this->config->has($key)) {
ret... | php | public function get($key, $default = null, $save = false)
{
$this->load();
if ($this->has($key)) {
return Arr::get($this->settings, $key, $default);
}
if ($save) {
$this->set($key, $default);
}
if ($this->config->has($key)) {
ret... | [
"public",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
",",
"$",
"save",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"load",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"return",... | Get setting by key
@param $key
@param null $default
@param bool $save
@return mixed | [
"Get",
"setting",
"by",
"key"
] | train | https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/SettingsImpl.php#L65-L82 |
ionutmilica/laravel-settings | src/SettingsImpl.php | SettingsImpl.set | public function set($key, $value)
{
$this->load();
if ( ! $this->has($key)) {
$this->dirt[$key] = [
'type' => 'created',
'value' => $value,
];
}
if ($this->has($key) && $this->get($key) != $value) {
$this->dirt[$ke... | php | public function set($key, $value)
{
$this->load();
if ( ! $this->has($key)) {
$this->dirt[$key] = [
'type' => 'created',
'value' => $value,
];
}
if ($this->has($key) && $this->get($key) != $value) {
$this->dirt[$ke... | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"load",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"dirt",
"[",
"$",
"key",
"]",
... | Update setting
@param $key
@param $value
@return mixed | [
"Update",
"setting"
] | train | https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/SettingsImpl.php#L91-L112 |
ionutmilica/laravel-settings | src/SettingsImpl.php | SettingsImpl.forget | public function forget($key)
{
$this->load();
if ($this->has($key)) {
$this->dirt[$key] = ['type' => 'deleted'];
Arr::forget($this->settings, $key);
}
} | php | public function forget($key)
{
$this->load();
if ($this->has($key)) {
$this->dirt[$key] = ['type' => 'deleted'];
Arr::forget($this->settings, $key);
}
} | [
"public",
"function",
"forget",
"(",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"load",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"dirt",
"[",
"$",
"key",
"]",
"=",
"[",
"'type'",
"... | Forget setting
@param $key string | [
"Forget",
"setting"
] | train | https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/SettingsImpl.php#L119-L127 |
ionutmilica/laravel-settings | src/SettingsImpl.php | SettingsImpl.save | public function save()
{
if ($this->dirt) {
return $this->driver->save($this->settings, $this->dirt);
}
return false;
} | php | public function save()
{
if ($this->dirt) {
return $this->driver->save($this->settings, $this->dirt);
}
return false;
} | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"dirt",
")",
"{",
"return",
"$",
"this",
"->",
"driver",
"->",
"save",
"(",
"$",
"this",
"->",
"settings",
",",
"$",
"this",
"->",
"dirt",
")",
";",
"}",
"return",
"false"... | Save dirty data into the data source
@return bool | [
"Save",
"dirty",
"data",
"into",
"the",
"data",
"source"
] | train | https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/SettingsImpl.php#L159-L166 |
ionutmilica/laravel-settings | src/SettingsImpl.php | SettingsImpl.offsetSet | public function offsetSet($offset, $value)
{
if (is_null($offset)) {
throw new InvalidArrayAssignment();
} else {
$this->set($offset, $value);
}
} | php | public function offsetSet($offset, $value)
{
if (is_null($offset)) {
throw new InvalidArrayAssignment();
} else {
$this->set($offset, $value);
}
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"offset",
")",
")",
"{",
"throw",
"new",
"InvalidArrayAssignment",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"set",
"(",
"... | Add/Edit a setting
@param mixed $offset
@param mixed $value
@throws InvalidArrayAssignment | [
"Add",
"/",
"Edit",
"a",
"setting"
] | train | https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/SettingsImpl.php#L197-L204 |
jolicode/JoliTypoBundle | DependencyInjection/JoliTypoExtension.php | JoliTypoExtension.load | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$presets = $this->createPresetDefinition($container, $config);
// Twig extension
$twig_extension = new D... | php | public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$presets = $this->createPresetDefinition($container, $config);
// Twig extension
$twig_extension = new D... | [
"public",
"function",
"load",
"(",
"array",
"$",
"configs",
",",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"configuration",
"=",
"new",
"Configuration",
"(",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"processConfiguration",
"(",
"$",
"con... | {@inheritDoc} | [
"{"
] | train | https://github.com/jolicode/JoliTypoBundle/blob/d2760870ad497ce503eba096f3a0735b050f5c2b/DependencyInjection/JoliTypoExtension.php#L20-L39 |
phlib/beanstalk | src/Connection/Socket.php | Socket.connect | public function connect()
{
if (!$this->connection) {
$errNum = $errStr = null;
$this->connection = @fsockopen($this->host, $this->port, $errNum, $errStr, $this->options['timeout']);
if (!$this->connection or $errNum > 0) {
$message = sprintf(
... | php | public function connect()
{
if (!$this->connection) {
$errNum = $errStr = null;
$this->connection = @fsockopen($this->host, $this->port, $errNum, $errStr, $this->options['timeout']);
if (!$this->connection or $errNum > 0) {
$message = sprintf(
... | [
"public",
"function",
"connect",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"connection",
")",
"{",
"$",
"errNum",
"=",
"$",
"errStr",
"=",
"null",
";",
"$",
"this",
"->",
"connection",
"=",
"@",
"fsockopen",
"(",
"$",
"this",
"->",
"host",
... | Connect the socket to the beanstalk server.
@return $this
@throws Exception\SocketException | [
"Connect",
"the",
"socket",
"to",
"the",
"beanstalk",
"server",
"."
] | train | https://github.com/phlib/beanstalk/blob/cc37083f506b65a5f005ca7a8920072d292a1d83/src/Connection/Socket.php#L74-L96 |
phlib/beanstalk | src/Connection/Socket.php | Socket.write | public function write($data)
{
$this->connect();
$data .= self::EOL;
$bytesWritten = strlen($data);
$bytesSent = fwrite($this->connection, $data, $bytesWritten);
if ($bytesSent !== $bytesWritten) {
$this->disconnect();
throw new Exception\SocketEx... | php | public function write($data)
{
$this->connect();
$data .= self::EOL;
$bytesWritten = strlen($data);
$bytesSent = fwrite($this->connection, $data, $bytesWritten);
if ($bytesSent !== $bytesWritten) {
$this->disconnect();
throw new Exception\SocketEx... | [
"public",
"function",
"write",
"(",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"data",
".=",
"self",
"::",
"EOL",
";",
"$",
"bytesWritten",
"=",
"strlen",
"(",
"$",
"data",
")",
";",
"$",
"bytesSent",
"=",
"fwrite",
... | Write to the socket.
@param string $data
@return $this
@throws Exception\SocketException | [
"Write",
"to",
"the",
"socket",
"."
] | train | https://github.com/phlib/beanstalk/blob/cc37083f506b65a5f005ca7a8920072d292a1d83/src/Connection/Socket.php#L105-L119 |
dphn/ScContent | src/ScContent/Service/FileTypesCatalog.php | FileTypesCatalog.isAllowed | public function isAllowed($spec, $pattern)
{
if (! array_key_exists($spec, $this->catalogue)) {
return false;
}
$features = $this->catalogue[$spec];
if (! is_array($pattern)) {
$pattern = [$pattern];
}
$needle = 0;
foreach ($pattern as ... | php | public function isAllowed($spec, $pattern)
{
if (! array_key_exists($spec, $this->catalogue)) {
return false;
}
$features = $this->catalogue[$spec];
if (! is_array($pattern)) {
$pattern = [$pattern];
}
$needle = 0;
foreach ($pattern as ... | [
"public",
"function",
"isAllowed",
"(",
"$",
"spec",
",",
"$",
"pattern",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"spec",
",",
"$",
"this",
"->",
"catalogue",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"features",
"=",
"$",
"t... | Returns true if and only if the file specification
is allowed for a given pattern.
Usage:
<code>
// for example, you have file extension and mime
$extension = 'jpeg';
$mime = 'image/jpeg';
$spec = $extension . ':' . $mime;
// you want to allow only editable images
$pattern = Catalog::Image | Catalog::GdEditable;
$i... | [
"Returns",
"true",
"if",
"and",
"only",
"if",
"the",
"file",
"specification",
"is",
"allowed",
"for",
"a",
"given",
"pattern",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Service/FileTypesCatalog.php#L466-L480 |
dphn/ScContent | src/ScContent/Service/FileTypesCatalog.php | FileTypesCatalog.findByType | protected function findByType($pattern, $part)
{
if (! is_array($pattern)) {
$pattern = [$pattern];
}
$needle = 0;
foreach ($pattern as $term) {
$needle |= $term;
}
$matches = [];
foreach ($this->catalogue as $spec => $features) {
... | php | protected function findByType($pattern, $part)
{
if (! is_array($pattern)) {
$pattern = [$pattern];
}
$needle = 0;
foreach ($pattern as $term) {
$needle |= $term;
}
$matches = [];
foreach ($this->catalogue as $spec => $features) {
... | [
"protected",
"function",
"findByType",
"(",
"$",
"pattern",
",",
"$",
"part",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"pattern",
")",
")",
"{",
"$",
"pattern",
"=",
"[",
"$",
"pattern",
"]",
";",
"}",
"$",
"needle",
"=",
"0",
";",
"foreac... | Each new term does not extend the search results,
but makes them more specific.
@param integer|array $pattern
@param integer $part <code>0</code> for extension, <code>1</code> for mime
@return array | [
"Each",
"new",
"term",
"does",
"not",
"extend",
"the",
"search",
"results",
"but",
"makes",
"them",
"more",
"specific",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Service/FileTypesCatalog.php#L549-L566 |
webbuilders-group/silverstripe-gridfield-deleted-items | src/Forms/GridFieldDeletedRestoreButton.php | GridFieldDeletedRestoreButton.handleAction | public function handleAction(GridField $gridField, $actionName, $arguments, $data) {
if($actionName=='restore-draft-item') {
if(!DataObject::has_extension($gridField->getModelClass(), Versioned::class)) {
user_error($gridField->getModelClass().' does not have the Versioned extension'... | php | public function handleAction(GridField $gridField, $actionName, $arguments, $data) {
if($actionName=='restore-draft-item') {
if(!DataObject::has_extension($gridField->getModelClass(), Versioned::class)) {
user_error($gridField->getModelClass().' does not have the Versioned extension'... | [
"public",
"function",
"handleAction",
"(",
"GridField",
"$",
"gridField",
",",
"$",
"actionName",
",",
"$",
"arguments",
",",
"$",
"data",
")",
"{",
"if",
"(",
"$",
"actionName",
"==",
"'restore-draft-item'",
")",
"{",
"if",
"(",
"!",
"DataObject",
"::",
... | Handle an action on the given {@link GridField}.
@param GridField $gridField Grid Field Reference
@param string $actionName Action identifier, see {@link getActions()}.
@param array $arguments Arguments relevant for this
@param array $data All form data | [
"Handle",
"an",
"action",
"on",
"the",
"given",
"{"
] | train | https://github.com/webbuilders-group/silverstripe-gridfield-deleted-items/blob/fd4e90701357de00acf06f4b820b745817f4ce9c/src/Forms/GridFieldDeletedRestoreButton.php#L50-L85 |
webbuilders-group/silverstripe-gridfield-deleted-items | src/Forms/GridFieldDeletedRestoreButton.php | GridFieldDeletedRestoreButton.getColumnContent | public function getColumnContent($gridField, $record, $columnName) {
$isDeletedFromDraft=(!$record->hasMethod('isOnDraft') ? $record->isOnLiveOnly():!$record->isOnDraft());
if($gridField->State->ListDisplayMode->ShowDeletedItems=='Y' && $isDeletedFromDraft) {
Requirements::css('webbuilders-g... | php | public function getColumnContent($gridField, $record, $columnName) {
$isDeletedFromDraft=(!$record->hasMethod('isOnDraft') ? $record->isOnLiveOnly():!$record->isOnDraft());
if($gridField->State->ListDisplayMode->ShowDeletedItems=='Y' && $isDeletedFromDraft) {
Requirements::css('webbuilders-g... | [
"public",
"function",
"getColumnContent",
"(",
"$",
"gridField",
",",
"$",
"record",
",",
"$",
"columnName",
")",
"{",
"$",
"isDeletedFromDraft",
"=",
"(",
"!",
"$",
"record",
"->",
"hasMethod",
"(",
"'isOnDraft'",
")",
"?",
"$",
"record",
"->",
"isOnLiveO... | HTML for the column, content of the <td> element.
@param GridField $gridField Grid Field Reference
@param DataObject $record Record displayed in this row
@param string $columnName Name of the current column
@return string HTML for the column. Return NULL to skip. | [
"HTML",
"for",
"the",
"column",
"content",
"of",
"the",
"<td",
">",
"element",
"."
] | train | https://github.com/webbuilders-group/silverstripe-gridfield-deleted-items/blob/fd4e90701357de00acf06f4b820b745817f4ce9c/src/Forms/GridFieldDeletedRestoreButton.php#L117-L127 |
mimmi20/Wurfl | src/Handlers/SkyfireHandler.php | SkyfireHandler.applyConclusiveMatch | public function applyConclusiveMatch($userAgent)
{
$skyfireIndex = strpos($userAgent, 'Skyfire');
// Matches the first decimal point after the Skyfire keyword: Skyfire/2.0
return $this->getDeviceIDFromRIS($userAgent, Utils::indexOfOrLength($userAgent, '.', $skyfireIndex));
} | php | public function applyConclusiveMatch($userAgent)
{
$skyfireIndex = strpos($userAgent, 'Skyfire');
// Matches the first decimal point after the Skyfire keyword: Skyfire/2.0
return $this->getDeviceIDFromRIS($userAgent, Utils::indexOfOrLength($userAgent, '.', $skyfireIndex));
} | [
"public",
"function",
"applyConclusiveMatch",
"(",
"$",
"userAgent",
")",
"{",
"$",
"skyfireIndex",
"=",
"strpos",
"(",
"$",
"userAgent",
",",
"'Skyfire'",
")",
";",
"// Matches the first decimal point after the Skyfire keyword: Skyfire/2.0",
"return",
"$",
"this",
"->"... | @param string $userAgent
@return null|string | [
"@param",
"string",
"$userAgent"
] | train | https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/SkyfireHandler.php#L54-L60 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Compiler/ValueCompiler.php | ValueCompiler.compile | public function compile($definition)
{
$validator = $this->createValidator($definition);
$validator->validate($definition);
return new ScalarValidator($definition->export());
} | php | public function compile($definition)
{
$validator = $this->createValidator($definition);
$validator->validate($definition);
return new ScalarValidator($definition->export());
} | [
"public",
"function",
"compile",
"(",
"$",
"definition",
")",
"{",
"$",
"validator",
"=",
"$",
"this",
"->",
"createValidator",
"(",
"$",
"definition",
")",
";",
"$",
"validator",
"->",
"validate",
"(",
"$",
"definition",
")",
";",
"return",
"new",
"Scal... | @param \Yosmanyga\Validation\Resource\Definition\ValueDefinition $definition
@return \Yosmanyga\Validation\Validator\ScalarValidator | [
"@param",
"\\",
"Yosmanyga",
"\\",
"Validation",
"\\",
"Resource",
"\\",
"Definition",
"\\",
"ValueDefinition",
"$definition"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Resource/Compiler/ValueCompiler.php#L29-L35 |
yosmanyga/validation | src/Yosmanyga/Validation/Resource/Normalizer/SuddenAnnotationFile/Normalizer.php | Normalizer.normalize | public function normalize($data, Resource $resource)
{
$class = '';
$definitions = [];
foreach ($data['value'] as $validator) {
$class = $validator['metadata']['class'];
if (isset($validator['property'])) {
$definitions['properties'][$validator['proper... | php | public function normalize($data, Resource $resource)
{
$class = '';
$definitions = [];
foreach ($data['value'] as $validator) {
$class = $validator['metadata']['class'];
if (isset($validator['property'])) {
$definitions['properties'][$validator['proper... | [
"public",
"function",
"normalize",
"(",
"$",
"data",
",",
"Resource",
"$",
"resource",
")",
"{",
"$",
"class",
"=",
"''",
";",
"$",
"definitions",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"data",
"[",
"'value'",
"]",
"as",
"$",
"validator",
")",
"{... | @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/SuddenAnnotationFile/Normalizer.php#L48-L60 |
danhunsaker/laravel-flysystem-service | src/FlysystemManager.php | FlysystemManager.createLocalDriver | public function createLocalDriver(array $config)
{
if ($this->skipOverride()) {
$adapter = parent::createLocalDriver($config);
} else {
$adapter = $this->adapt($this->createFlysystem(parent::createLocalDriver($config)->getAdapter(), $config));
}
return $adapt... | php | public function createLocalDriver(array $config)
{
if ($this->skipOverride()) {
$adapter = parent::createLocalDriver($config);
} else {
$adapter = $this->adapt($this->createFlysystem(parent::createLocalDriver($config)->getAdapter(), $config));
}
return $adapt... | [
"public",
"function",
"createLocalDriver",
"(",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"skipOverride",
"(",
")",
")",
"{",
"$",
"adapter",
"=",
"parent",
"::",
"createLocalDriver",
"(",
"$",
"config",
")",
";",
"}",
"else",
"{"... | {@inheritdoc} | [
"{"
] | train | https://github.com/danhunsaker/laravel-flysystem-service/blob/557cfb62d747e8f091177ee0ceedf92952b9e8ce/src/FlysystemManager.php#L168-L177 |
danhunsaker/laravel-flysystem-service | src/FlysystemManager.php | FlysystemManager.createNullDriver | public function createNullDriver(array $config)
{
return $this->adapt($this->createFlysystem(new \League\Flysystem\Adapter\NullAdapter, $config));
} | php | public function createNullDriver(array $config)
{
return $this->adapt($this->createFlysystem(new \League\Flysystem\Adapter\NullAdapter, $config));
} | [
"public",
"function",
"createNullDriver",
"(",
"array",
"$",
"config",
")",
"{",
"return",
"$",
"this",
"->",
"adapt",
"(",
"$",
"this",
"->",
"createFlysystem",
"(",
"new",
"\\",
"League",
"\\",
"Flysystem",
"\\",
"Adapter",
"\\",
"NullAdapter",
",",
"$",... | Create an instance of the null driver.
@param array $config
@return \Illuminate\Contracts\Filesystem\Filesystem | [
"Create",
"an",
"instance",
"of",
"the",
"null",
"driver",
"."
] | train | https://github.com/danhunsaker/laravel-flysystem-service/blob/557cfb62d747e8f091177ee0ceedf92952b9e8ce/src/FlysystemManager.php#L227-L230 |
danhunsaker/laravel-flysystem-service | src/FlysystemManager.php | FlysystemManager.decorateWithCachedAdapter | protected function decorateWithCachedAdapter(AdapterInterface $adapter, array $config)
{
if (
($cacheDriver = Arr::get($config, 'driver', false)) !== false &&
(is_a($cacheDriver, 'League\Flysystem\Cached\CacheInterface') ||
class_exists($driverName = Arr::get($this->c... | php | protected function decorateWithCachedAdapter(AdapterInterface $adapter, array $config)
{
if (
($cacheDriver = Arr::get($config, 'driver', false)) !== false &&
(is_a($cacheDriver, 'League\Flysystem\Cached\CacheInterface') ||
class_exists($driverName = Arr::get($this->c... | [
"protected",
"function",
"decorateWithCachedAdapter",
"(",
"AdapterInterface",
"$",
"adapter",
",",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"(",
"$",
"cacheDriver",
"=",
"Arr",
"::",
"get",
"(",
"$",
"config",
",",
"'driver'",
",",
"false",
")",
")",
... | Decorate a Flysystem adapter with a metadata cache.
@param \League\Flysystem\AdapterInterface $adapter
@param array $config
@return \League\Flysystem\AdapterInterface | [
"Decorate",
"a",
"Flysystem",
"adapter",
"with",
"a",
"metadata",
"cache",
"."
] | train | https://github.com/danhunsaker/laravel-flysystem-service/blob/557cfb62d747e8f091177ee0ceedf92952b9e8ce/src/FlysystemManager.php#L239-L304 |
danhunsaker/laravel-flysystem-service | src/FlysystemManager.php | FlysystemManager.createFlysystem | protected function createFlysystem(AdapterInterface $adapter, array $config)
{
if (class_exists('League\Flysystem\EventableFilesystem\EventableFilesystem')) {
$fsClass = \League\Flysystem\EventableFilesystem\EventableFilesystem::class;
} else {
$fsClass = \League\Flysystem\Fi... | php | protected function createFlysystem(AdapterInterface $adapter, array $config)
{
if (class_exists('League\Flysystem\EventableFilesystem\EventableFilesystem')) {
$fsClass = \League\Flysystem\EventableFilesystem\EventableFilesystem::class;
} else {
$fsClass = \League\Flysystem\Fi... | [
"protected",
"function",
"createFlysystem",
"(",
"AdapterInterface",
"$",
"adapter",
",",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'League\\Flysystem\\EventableFilesystem\\EventableFilesystem'",
")",
")",
"{",
"$",
"fsClass",
"=",
"\\",
"Le... | Create a Flysystem instance with the given adapter.
@param \League\Flysystem\AdapterInterface $adapter
@param array $config
@return \League\Flysystem\FlysystemInterface | [
"Create",
"a",
"Flysystem",
"instance",
"with",
"the",
"given",
"adapter",
"."
] | train | https://github.com/danhunsaker/laravel-flysystem-service/blob/557cfb62d747e8f091177ee0ceedf92952b9e8ce/src/FlysystemManager.php#L313-L328 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesTableGenerator.php | PropertiesTableGenerator.generate | public function generate($className, $db = null)
{
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $className */
$this->setDb($db);
$tableOptions = $this->db->driverName === 'mysql'
? 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'
... | php | public function generate($className, $db = null)
{
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $className */
$this->setDb($db);
$tableOptions = $this->db->driverName === 'mysql'
? 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'
... | [
"public",
"function",
"generate",
"(",
"$",
"className",
",",
"$",
"db",
"=",
"null",
")",
"{",
"/** @var \\yii\\db\\ActiveRecord|\\DevGroup\\DataStructure\\traits\\PropertiesTrait $className */",
"$",
"this",
"->",
"setDb",
"(",
"$",
"db",
")",
";",
"$",
"tableOption... | Generates all properties tables for specified $className model
@param string $className
@param \yii\db\Connection|string|null $db | [
"Generates",
"all",
"properties",
"tables",
"for",
"specified",
"$className",
"model"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesTableGenerator.php#L71-L216 |
DevGroup-ru/yii2-data-structure-tools | src/helpers/PropertiesTableGenerator.php | PropertiesTableGenerator.drop | public function drop($className, $db = null)
{
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $className */
$this->setDb($db);
$tables = [
$className::staticValuesBindingsTable(),
$className::eavTable(),
$className::tableInhe... | php | public function drop($className, $db = null)
{
/** @var \yii\db\ActiveRecord|\DevGroup\DataStructure\traits\PropertiesTrait $className */
$this->setDb($db);
$tables = [
$className::staticValuesBindingsTable(),
$className::eavTable(),
$className::tableInhe... | [
"public",
"function",
"drop",
"(",
"$",
"className",
",",
"$",
"db",
"=",
"null",
")",
"{",
"/** @var \\yii\\db\\ActiveRecord|\\DevGroup\\DataStructure\\traits\\PropertiesTrait $className */",
"$",
"this",
"->",
"setDb",
"(",
"$",
"db",
")",
";",
"$",
"tables",
"=",... | @param string $className
@param \yii\db\Connection|string|null $db
@throws \yii\base\InvalidConfigException | [
"@param",
"string",
"$className",
"@param",
"\\",
"yii",
"\\",
"db",
"\\",
"Connection|string|null",
"$db"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/helpers/PropertiesTableGenerator.php#L224-L245 |
markwatkinson/luminous | src/Luminous/Formatters/LatexFormatter.php | LatexFormatter.defineStyleCommands | public function defineStyleCommands()
{
if ($this->css === null) {
throw new Exception('LaTeX formatter has not been set a theme');
}
$cmds = array();
$round = function ($n) {
return round($n, 2);
};
foreach ($this->css->rules() as $name => $pr... | php | public function defineStyleCommands()
{
if ($this->css === null) {
throw new Exception('LaTeX formatter has not been set a theme');
}
$cmds = array();
$round = function ($n) {
return round($n, 2);
};
foreach ($this->css->rules() as $name => $pr... | [
"public",
"function",
"defineStyleCommands",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"css",
"===",
"null",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'LaTeX formatter has not been set a theme'",
")",
";",
"}",
"$",
"cmds",
"=",
"array",
"(",
")",
";... | Defines all the styling commands, these are obtained from the css parser | [
"Defines",
"all",
"the",
"styling",
"commands",
"these",
"are",
"obtained",
"from",
"the",
"css",
"parser"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Formatters/LatexFormatter.php#L32-L75 |
kriskbx/mikado | src/Formatters/FilterFormatter.php | FilterFormatter.format | public function format($data)
{
$data->loopThrough(function ($key, $value) use ($data) {
if (!in_array($key, $this->fields)) {
$data->setProperty($key, null);
}
});
$data->unsetNull();
return $data;
} | php | public function format($data)
{
$data->loopThrough(function ($key, $value) use ($data) {
if (!in_array($key, $this->fields)) {
$data->setProperty($key, null);
}
});
$data->unsetNull();
return $data;
} | [
"public",
"function",
"format",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"->",
"loopThrough",
"(",
"function",
"(",
"$",
"key",
",",
"$",
"value",
")",
"use",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"key",
",",
"$",
"t... | Format the given object or array of objects.
@param FormatAble $data
@return FormatAble | [
"Format",
"the",
"given",
"object",
"or",
"array",
"of",
"objects",
"."
] | train | https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Formatters/FilterFormatter.php#L34-L45 |
activecollab/user | src/UserInterface/ImplementationUsingFullName.php | ImplementationUsingFullName.getFullNameBit | private function getFullNameBit($bit)
{
if (empty($this->full_name_bits)) {
$full_name = $this->getFullName();
if (empty($full_name)) {
list($first_name, $last_name) = $this->getFirstAndLastNameFromEmail();
if ($first_name && $last_name) {
... | php | private function getFullNameBit($bit)
{
if (empty($this->full_name_bits)) {
$full_name = $this->getFullName();
if (empty($full_name)) {
list($first_name, $last_name) = $this->getFirstAndLastNameFromEmail();
if ($first_name && $last_name) {
... | [
"private",
"function",
"getFullNameBit",
"(",
"$",
"bit",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"full_name_bits",
")",
")",
"{",
"$",
"full_name",
"=",
"$",
"this",
"->",
"getFullName",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"... | Return first name bit.
@param string $bit
@return string | [
"Return",
"first",
"name",
"bit",
"."
] | train | https://github.com/activecollab/user/blob/f54b858eb9016fbca32090e624eccb0354e93d8f/src/UserInterface/ImplementationUsingFullName.php#L41-L60 |
todstoychev/icr | src/Manipulator/Point.php | Point.in | public function in(BoxInterface $box)
{
$this->checkBoxInstance();
return $this->getX() < $box->getWidth() && $this->getY() < $box->getHeight();
} | php | public function in(BoxInterface $box)
{
$this->checkBoxInstance();
return $this->getX() < $box->getWidth() && $this->getY() < $box->getHeight();
} | [
"public",
"function",
"in",
"(",
"BoxInterface",
"$",
"box",
")",
"{",
"$",
"this",
"->",
"checkBoxInstance",
"(",
")",
";",
"return",
"$",
"this",
"->",
"getX",
"(",
")",
"<",
"$",
"box",
"->",
"getWidth",
"(",
")",
"&&",
"$",
"this",
"->",
"getY"... | {@inheritdoc} | [
"{"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Manipulator/Point.php#L67-L72 |
todstoychev/icr | src/Manipulator/Point.php | Point.move | public function move($amount)
{
$x = $this->getX() + $amount;
$y = $this->getY() + $amount;
if ($x < 0 || $y < 0) {
throw new \LogicException('Can not move with negative result!');
}
return new Point(new Box($x, $y));
} | php | public function move($amount)
{
$x = $this->getX() + $amount;
$y = $this->getY() + $amount;
if ($x < 0 || $y < 0) {
throw new \LogicException('Can not move with negative result!');
}
return new Point(new Box($x, $y));
} | [
"public",
"function",
"move",
"(",
"$",
"amount",
")",
"{",
"$",
"x",
"=",
"$",
"this",
"->",
"getX",
"(",
")",
"+",
"$",
"amount",
";",
"$",
"y",
"=",
"$",
"this",
"->",
"getY",
"(",
")",
"+",
"$",
"amount",
";",
"if",
"(",
"$",
"x",
"<",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/todstoychev/icr/blob/0214c7bc76e44488e98758d55deb707b72e24000/src/Manipulator/Point.php#L77-L87 |
dphn/ScContent | src/ScContent/Listener/Back/Layout.php | Layout.onMoveContent | public function onMoveContent(EventInterface $event)
{
$translator = $this->getTranslator();
$mapper = $this->getLayoutMapper();
if (is_null($event->getParam('tid'))) {
throw new InvalidArgumentException(
$translator->translate(
"Unknown transa... | php | public function onMoveContent(EventInterface $event)
{
$translator = $this->getTranslator();
$mapper = $this->getLayoutMapper();
if (is_null($event->getParam('tid'))) {
throw new InvalidArgumentException(
$translator->translate(
"Unknown transa... | [
"public",
"function",
"onMoveContent",
"(",
"EventInterface",
"$",
"event",
")",
"{",
"$",
"translator",
"=",
"$",
"this",
"->",
"getTranslator",
"(",
")",
";",
"$",
"mapper",
"=",
"$",
"this",
"->",
"getLayoutMapper",
"(",
")",
";",
"if",
"(",
"is_null"... | If the content has been moved all the rules of widget visibility
are cleared.
@param \Zend\EventManager\EventInterface $event
@throws \ScContent\Exception\InvalidArgumentException
@return void | [
"If",
"the",
"content",
"has",
"been",
"moved",
"all",
"the",
"rules",
"of",
"widget",
"visibility",
"are",
"cleared",
"."
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Listener/Back/Layout.php#L61-L85 |
joomla-projects/jorobo | src/Tasks/CopyrightHeader.php | CopyrightHeader.run | public function run()
{
$this->say("Updating / adding copyright headers");
$text = $this->replaceInText(trim($this->getJConfig()->header->text));
$exclude = explode(",", trim($this->getJConfig()->header->exclude));
$path = realpath($this->getJConfig()->source);
$fileTypes = explode(",", trim($this->... | php | public function run()
{
$this->say("Updating / adding copyright headers");
$text = $this->replaceInText(trim($this->getJConfig()->header->text));
$exclude = explode(",", trim($this->getJConfig()->header->exclude));
$path = realpath($this->getJConfig()->source);
$fileTypes = explode(",", trim($this->... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"\"Updating / adding copyright headers\"",
")",
";",
"$",
"text",
"=",
"$",
"this",
"->",
"replaceInText",
"(",
"trim",
"(",
"$",
"this",
"->",
"getJConfig",
"(",
")",
"->",
"head... | Generate / Update copyright headers
@return bool
@since 1.0 | [
"Generate",
"/",
"Update",
"copyright",
"headers"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/CopyrightHeader.php#L41-L88 |
joomla-projects/jorobo | src/Tasks/CopyrightHeader.php | CopyrightHeader.replaceInText | protected function replaceInText($text)
{
$text = str_replace("##YEAR##", date('Y'), $text);
$text = str_replace("##DATE##", date('Y-m-d'), $text);
return $text;
} | php | protected function replaceInText($text)
{
$text = str_replace("##YEAR##", date('Y'), $text);
$text = str_replace("##DATE##", date('Y-m-d'), $text);
return $text;
} | [
"protected",
"function",
"replaceInText",
"(",
"$",
"text",
")",
"{",
"$",
"text",
"=",
"str_replace",
"(",
"\"##YEAR##\"",
",",
"date",
"(",
"'Y'",
")",
",",
"$",
"text",
")",
";",
"$",
"text",
"=",
"str_replace",
"(",
"\"##DATE##\"",
",",
"date",
"("... | Replaces placeholders in the copyright header
Todo separate and make configurable and extensible
@param $text The header text with placeholders
@return mixed
@since 1.0 | [
"Replaces",
"placeholders",
"in",
"the",
"copyright",
"header",
"Todo",
"separate",
"and",
"make",
"configurable",
"and",
"extensible"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/CopyrightHeader.php#L100-L106 |
joomla-projects/jorobo | src/Tasks/CopyrightHeader.php | CopyrightHeader.removeHeader | protected function removeHeader(\SplFileInfo $file)
{
$content = file_get_contents($file->getRealPath());
$lines = explode(PHP_EOL, $content);
foreach ($lines as $i => $l)
{
$l = trim($l);
if (strpos($l, "<?php") === 0 || $l == "")
{
continue;
}
if (strpos($l, "/**") !== false || strpos(... | php | protected function removeHeader(\SplFileInfo $file)
{
$content = file_get_contents($file->getRealPath());
$lines = explode(PHP_EOL, $content);
foreach ($lines as $i => $l)
{
$l = trim($l);
if (strpos($l, "<?php") === 0 || $l == "")
{
continue;
}
if (strpos($l, "/**") !== false || strpos(... | [
"protected",
"function",
"removeHeader",
"(",
"\\",
"SplFileInfo",
"$",
"file",
")",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"file",
"->",
"getRealPath",
"(",
")",
")",
";",
"$",
"lines",
"=",
"explode",
"(",
"PHP_EOL",
",",
"$",
"conten... | Remove copyright headers in file (If any)
@param \SplFileInfo $file - Target
@return void
@since 1.0 | [
"Remove",
"copyright",
"headers",
"in",
"file",
"(",
"If",
"any",
")"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/CopyrightHeader.php#L117-L143 |
joomla-projects/jorobo | src/Tasks/CopyrightHeader.php | CopyrightHeader.addHeader | protected function addHeader(\SplFileInfo $file, $text)
{
$content = file_get_contents($file->getRealPath());
$lines = explode(PHP_EOL, $content);
$text = explode("\n", $text);
foreach ($lines as $i => $l)
{
$l = trim($l);
if (strpos($l, "<?php") === 0)
{
continue;
}
array_splice($lin... | php | protected function addHeader(\SplFileInfo $file, $text)
{
$content = file_get_contents($file->getRealPath());
$lines = explode(PHP_EOL, $content);
$text = explode("\n", $text);
foreach ($lines as $i => $l)
{
$l = trim($l);
if (strpos($l, "<?php") === 0)
{
continue;
}
array_splice($lin... | [
"protected",
"function",
"addHeader",
"(",
"\\",
"SplFileInfo",
"$",
"file",
",",
"$",
"text",
")",
"{",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",
"file",
"->",
"getRealPath",
"(",
")",
")",
";",
"$",
"lines",
"=",
"explode",
"(",
"PHP_EOL",
... | Adds copyright headers in file
@param \SplFileInfo $file - Target
@return void
@since 1.0 | [
"Adds",
"copyright",
"headers",
"in",
"file"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/CopyrightHeader.php#L154-L176 |
terdia/legato-framework | src/Profiler/Profiler.php | Profiler.whenStarted | public function whenStarted()
{
$milliseconds = $this->event->getOrigin();
$seconds = $milliseconds / 1000;
return is_float($seconds) ? date('Y-m-d H:i:s', $seconds) : null;
} | php | public function whenStarted()
{
$milliseconds = $this->event->getOrigin();
$seconds = $milliseconds / 1000;
return is_float($seconds) ? date('Y-m-d H:i:s', $seconds) : null;
} | [
"public",
"function",
"whenStarted",
"(",
")",
"{",
"$",
"milliseconds",
"=",
"$",
"this",
"->",
"event",
"->",
"getOrigin",
"(",
")",
";",
"$",
"seconds",
"=",
"$",
"milliseconds",
"/",
"1000",
";",
"return",
"is_float",
"(",
"$",
"seconds",
")",
"?",... | Convert start time to datetime from milliseconds.
@return false|null|string | [
"Convert",
"start",
"time",
"to",
"datetime",
"from",
"milliseconds",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Profiler/Profiler.php#L43-L49 |
PandaPlatform/framework | src/Panda/Bootstrap/Debugger.php | Debugger.isActive | public function isActive(Request $request)
{
// Check request arguments
$debugger = $request ? $request->get($key = 'pdebug', $default = null, $includeCookies = true) : false;
// Reload status
$this->setActive(self::$active || $debugger || $this->app->getEnvironment() == 'developmen... | php | public function isActive(Request $request)
{
// Check request arguments
$debugger = $request ? $request->get($key = 'pdebug', $default = null, $includeCookies = true) : false;
// Reload status
$this->setActive(self::$active || $debugger || $this->app->getEnvironment() == 'developmen... | [
"public",
"function",
"isActive",
"(",
"Request",
"$",
"request",
")",
"{",
"// Check request arguments",
"$",
"debugger",
"=",
"$",
"request",
"?",
"$",
"request",
"->",
"get",
"(",
"$",
"key",
"=",
"'pdebug'",
",",
"$",
"default",
"=",
"null",
",",
"$"... | @param Request $request
@return bool | [
"@param",
"Request",
"$request"
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Bootstrap/Debugger.php#L69-L78 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLDefinition.php | HTMLPurifier_HTMLDefinition.parseTinyMCEAllowedList | public function parseTinyMCEAllowedList($list) {
$list = str_replace(array(' ', "\t"), '', $list);
$elements = array();
$attributes = array();
$chunks = preg_split('/(,|[\n\r]+)/', $list);
foreach ($chunks as $chunk) {
if (empty($chunk)) continue;
// re... | php | public function parseTinyMCEAllowedList($list) {
$list = str_replace(array(' ', "\t"), '', $list);
$elements = array();
$attributes = array();
$chunks = preg_split('/(,|[\n\r]+)/', $list);
foreach ($chunks as $chunk) {
if (empty($chunk)) continue;
// re... | [
"public",
"function",
"parseTinyMCEAllowedList",
"(",
"$",
"list",
")",
"{",
"$",
"list",
"=",
"str_replace",
"(",
"array",
"(",
"' '",
",",
"\"\\t\"",
")",
",",
"''",
",",
"$",
"list",
")",
";",
"$",
"elements",
"=",
"array",
"(",
")",
";",
"$",
"... | Parses a TinyMCE-flavored Allowed Elements and Attributes list into
separate lists for processing. Format is element[attr1|attr2],element2...
@warning Although it's largely drawn from TinyMCE's implementation,
it is different, and you'll probably have to modify your lists
@param $list String list to parse
@param array(... | [
"Parses",
"a",
"TinyMCE",
"-",
"flavored",
"Allowed",
"Elements",
"and",
"Attributes",
"list",
"into",
"separate",
"lists",
"for",
"processing",
".",
"Format",
"is",
"element",
"[",
"attr1|attr2",
"]",
"element2",
"..."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLDefinition.php#L387-L415 |
activecollab/bootstrap | src/Router/RouteExtender/RouteExtender.php | RouteExtender.& | public function &extend($path, array $method_to_action = [], $name = '', $controller_name = null)
{
if (empty($path)) {
throw new InvalidArgumentException('Route path is required');
}
$path = trim($path, '/');
if (empty($name)) {
$name = str_replace(['{', '}... | php | public function &extend($path, array $method_to_action = [], $name = '', $controller_name = null)
{
if (empty($path)) {
throw new InvalidArgumentException('Route path is required');
}
$path = trim($path, '/');
if (empty($name)) {
$name = str_replace(['{', '}... | [
"public",
"function",
"&",
"extend",
"(",
"$",
"path",
",",
"array",
"$",
"method_to_action",
"=",
"[",
"]",
",",
"$",
"name",
"=",
"''",
",",
"$",
"controller_name",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
")",
"{",
"th... | {@inheritdoc} | [
"{"
] | train | https://github.com/activecollab/bootstrap/blob/92eea19b2b2b329035f20e855a78f36e74084ccf/src/Router/RouteExtender/RouteExtender.php#L49-L78 |
terdia/legato-framework | src/Validation/Validator.php | Validator.parseData | private function parseData(array $data)
{
$field = $data['field'];
foreach ($data['policies'] as $rule => $policy) {
$passes = call_user_func_array([new Rule(), $rule], [$field, $data['value'], $policy]);
if (!$passes) {
ErrorHandler::set(
... | php | private function parseData(array $data)
{
$field = $data['field'];
foreach ($data['policies'] as $rule => $policy) {
$passes = call_user_func_array([new Rule(), $rule], [$field, $data['value'], $policy]);
if (!$passes) {
ErrorHandler::set(
... | [
"private",
"function",
"parseData",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"field",
"=",
"$",
"data",
"[",
"'field'",
"]",
";",
"foreach",
"(",
"$",
"data",
"[",
"'policies'",
"]",
"as",
"$",
"rule",
"=>",
"$",
"policy",
")",
"{",
"$",
"passes",... | Perform validation for the data provider and set error messages.
@param array $data | [
"Perform",
"validation",
"for",
"the",
"data",
"provider",
"and",
"set",
"error",
"messages",
"."
] | train | https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Validation/Validator.php#L35-L50 |
vi-kon/laravel-parser | src/ViKon/Parser/rule/AbstractRule.php | AbstractRule.parseContent | protected function parseContent($content, TokenList $tokenList = null, $independent = false) {
$parser = new Parser();
$lexer = new Lexer();
$this->set->init($parser, $lexer);
$parser->setStartRule($this);
$tokenList = $parser->parse($content, $tokenList, !$independent);
... | php | protected function parseContent($content, TokenList $tokenList = null, $independent = false) {
$parser = new Parser();
$lexer = new Lexer();
$this->set->init($parser, $lexer);
$parser->setStartRule($this);
$tokenList = $parser->parse($content, $tokenList, !$independent);
... | [
"protected",
"function",
"parseContent",
"(",
"$",
"content",
",",
"TokenList",
"$",
"tokenList",
"=",
"null",
",",
"$",
"independent",
"=",
"false",
")",
"{",
"$",
"parser",
"=",
"new",
"Parser",
"(",
")",
";",
"$",
"lexer",
"=",
"new",
"Lexer",
"(",
... | Parse token match content
@param string $content content to parse
@param TokenList|null $tokenList already initialized token list
@param bool $independent independent parsing (mark as not recursive parsing)
@return \ViKon\Parser\TokenList
@throws \ViKon\Parser\ParserException | [
"Parse",
"token",
"match",
"content"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/rule/AbstractRule.php#L156-L166 |
Chansig/DirectoryIndex | src/index.php | Listing.parse | static public function parse()
{
// if (!static::$settings['show_dots']) {
// ini_set('open_basedir', __DIR__);
// }
$directory = new \DirectoryIterator('.');
foreach ($directory as $fileInfo) {
if ($fileInfo->isDot() && !static::$settings['show_dots']) {
... | php | static public function parse()
{
// if (!static::$settings['show_dots']) {
// ini_set('open_basedir', __DIR__);
// }
$directory = new \DirectoryIterator('.');
foreach ($directory as $fileInfo) {
if ($fileInfo->isDot() && !static::$settings['show_dots']) {
... | [
"static",
"public",
"function",
"parse",
"(",
")",
"{",
"// if (!static::$settings['show_dots']) {",
"// ini_set('open_basedir', __DIR__);",
"// }",
"$",
"directory",
"=",
"new",
"\\",
"DirectoryIterator",
"(",
"'.'",
")",
";",
"foreach",
"(",
"$"... | Directory Index | [
"Directory",
"Index"
] | train | https://github.com/Chansig/DirectoryIndex/blob/aefa04761c0b755bf4bc99f68f317527f07b5034/src/index.php#L55-L104 |
Chansig/DirectoryIndex | src/index.php | Theme.display | static public function display()
{
Sorter::sort(Listing::$files);
$content = '<!DOCTYPE html>';
$content .= sprintf('
<html xmlns="http://www.w3.org/1999/xhtml" lang="%s">', Translation::getCanonicalLocale());
$content .= '
<head>
<meta charset="utf-8">
<meta name... | php | static public function display()
{
Sorter::sort(Listing::$files);
$content = '<!DOCTYPE html>';
$content .= sprintf('
<html xmlns="http://www.w3.org/1999/xhtml" lang="%s">', Translation::getCanonicalLocale());
$content .= '
<head>
<meta charset="utf-8">
<meta name... | [
"static",
"public",
"function",
"display",
"(",
")",
"{",
"Sorter",
"::",
"sort",
"(",
"Listing",
"::",
"$",
"files",
")",
";",
"$",
"content",
"=",
"'<!DOCTYPE html>'",
";",
"$",
"content",
".=",
"sprintf",
"(",
"'\n<html xmlns=\"http://www.w3.org/1999/xhtml\" ... | Display directory listing | [
"Display",
"directory",
"listing"
] | train | https://github.com/Chansig/DirectoryIndex/blob/aefa04761c0b755bf4bc99f68f317527f07b5034/src/index.php#L737-L766 |
DevGroup-ru/yii2-data-structure-tools | src/Properties/helpers/FrontendPropertiesHelper.php | FrontendPropertiesHelper.dataTypeSelectOptions | public static function dataTypeSelectOptions()
{
return [
Property::DATA_TYPE_STRING => Module::t('app', 'String'),
Property::DATA_TYPE_TEXT => Module::t('app', 'Text'),
Property::DATA_TYPE_INTEGER => Module::t('app', 'Integer'),
Property::DATA_TYPE_FLOAT => M... | php | public static function dataTypeSelectOptions()
{
return [
Property::DATA_TYPE_STRING => Module::t('app', 'String'),
Property::DATA_TYPE_TEXT => Module::t('app', 'Text'),
Property::DATA_TYPE_INTEGER => Module::t('app', 'Integer'),
Property::DATA_TYPE_FLOAT => M... | [
"public",
"static",
"function",
"dataTypeSelectOptions",
"(",
")",
"{",
"return",
"[",
"Property",
"::",
"DATA_TYPE_STRING",
"=>",
"Module",
"::",
"t",
"(",
"'app'",
",",
"'String'",
")",
",",
"Property",
"::",
"DATA_TYPE_TEXT",
"=>",
"Module",
"::",
"t",
"(... | Returns array of data types for select inputs
@return array | [
"Returns",
"array",
"of",
"data",
"types",
"for",
"select",
"inputs"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/Properties/helpers/FrontendPropertiesHelper.php#L25-L36 |
DevGroup-ru/yii2-data-structure-tools | src/Properties/helpers/FrontendPropertiesHelper.php | FrontendPropertiesHelper.handlersSelectOptions | public static function handlersSelectOptions()
{
return Yii::$app->cache->lazy(function () {
$query = (new Query)
->select(['name', 'id'])
->from(PropertyHandlers::tableName())
->orderBy(['sort_order' => SORT_ASC])
->indexBy('id');
... | php | public static function handlersSelectOptions()
{
return Yii::$app->cache->lazy(function () {
$query = (new Query)
->select(['name', 'id'])
->from(PropertyHandlers::tableName())
->orderBy(['sort_order' => SORT_ASC])
->indexBy('id');
... | [
"public",
"static",
"function",
"handlersSelectOptions",
"(",
")",
"{",
"return",
"Yii",
"::",
"$",
"app",
"->",
"cache",
"->",
"lazy",
"(",
"function",
"(",
")",
"{",
"$",
"query",
"=",
"(",
"new",
"Query",
")",
"->",
"select",
"(",
"[",
"'name'",
"... | Returns array of property handlers for select inputs(handler.id => handler.name)
@return array | [
"Returns",
"array",
"of",
"property",
"handlers",
"for",
"select",
"inputs",
"(",
"handler",
".",
"id",
"=",
">",
"handler",
".",
"name",
")"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/Properties/helpers/FrontendPropertiesHelper.php#L42-L56 |
DevGroup-ru/yii2-data-structure-tools | src/Properties/helpers/FrontendPropertiesHelper.php | FrontendPropertiesHelper.storagesSelectOptions | public static function storagesSelectOptions()
{
return Yii::$app->cache->lazy(function () {
return (new Query)
->select(['name', 'id'])
->from(PropertyStorage::tableName())
->orderBy(['sort_order' => SORT_ASC])
->indexBy('id')
... | php | public static function storagesSelectOptions()
{
return Yii::$app->cache->lazy(function () {
return (new Query)
->select(['name', 'id'])
->from(PropertyStorage::tableName())
->orderBy(['sort_order' => SORT_ASC])
->indexBy('id')
... | [
"public",
"static",
"function",
"storagesSelectOptions",
"(",
")",
"{",
"return",
"Yii",
"::",
"$",
"app",
"->",
"cache",
"->",
"lazy",
"(",
"function",
"(",
")",
"{",
"return",
"(",
"new",
"Query",
")",
"->",
"select",
"(",
"[",
"'name'",
",",
"'id'",... | Returns array of property storages for select inputs(storage.id => storage.name)
@return array | [
"Returns",
"array",
"of",
"property",
"storages",
"for",
"select",
"inputs",
"(",
"storage",
".",
"id",
"=",
">",
"storage",
".",
"name",
")"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/Properties/helpers/FrontendPropertiesHelper.php#L81-L91 |
dphn/ScContent | src/ScContent/Filter/File/MimeType.php | MimeType.getMagicFile | public function getMagicFile()
{
if (null === $this->options['magicFile']) {
$magic = getenv('magic');
if (! empty($magic)) {
$this->setMagicFile($magic);
if ($this->options['magicFile'] === null) {
$this->options['magicFile'] = fal... | php | public function getMagicFile()
{
if (null === $this->options['magicFile']) {
$magic = getenv('magic');
if (! empty($magic)) {
$this->setMagicFile($magic);
if ($this->options['magicFile'] === null) {
$this->options['magicFile'] = fal... | [
"public",
"function",
"getMagicFile",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"options",
"[",
"'magicFile'",
"]",
")",
"{",
"$",
"magic",
"=",
"getenv",
"(",
"'magic'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"magic",
")",
... | Returns the actual set magicfile
@return string | [
"Returns",
"the",
"actual",
"set",
"magicfile"
] | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Filter/File/MimeType.php#L64-L99 |
dphn/ScContent | src/ScContent/Filter/File/MimeType.php | MimeType.setMagicFile | public function setMagicFile($file)
{
if ($file === false) {
$this->options['magicFile'] = false;
} elseif (empty($file)) {
$this->options['magicFile'] = null;
} elseif (! (class_exists('finfo', false))) {
$this->options['magicFile'] = null;
th... | php | public function setMagicFile($file)
{
if ($file === false) {
$this->options['magicFile'] = false;
} elseif (empty($file)) {
$this->options['magicFile'] = null;
} elseif (! (class_exists('finfo', false))) {
$this->options['magicFile'] = null;
th... | [
"public",
"function",
"setMagicFile",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"$",
"file",
"===",
"false",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'magicFile'",
"]",
"=",
"false",
";",
"}",
"elseif",
"(",
"empty",
"(",
"$",
"file",
")",
")",
... | Sets the magicfile to use
if null, the MAGIC constant from php is used
if the MAGIC file is erroneous, no file will be set
if false, the default MAGIC file from PHP will be used
@param string $file
@throws \Zend\Filter\Exception\RuntimeException When finfo can not read the magicfile
@throws \Zend\Filter\Exception\Inv... | [
"Sets",
"the",
"magicfile",
"to",
"use",
"if",
"null",
"the",
"MAGIC",
"constant",
"from",
"php",
"is",
"used",
"if",
"the",
"MAGIC",
"file",
"is",
"erroneous",
"no",
"file",
"will",
"be",
"set",
"if",
"false",
"the",
"default",
"MAGIC",
"file",
"from",
... | train | https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Filter/File/MimeType.php#L112-L143 |
Arcavias/ext-phpexcel | lib/custom/src/MW/Container/PHPExcel.php | MW_Container_PHPExcel.create | public function create( $name )
{
$sheet = $this->_container->createSheet();
$sheet->setTitle( $name );
return new MW_Container_Content_PHPExcel( $sheet, $name, $this->_getOptions() );
} | php | public function create( $name )
{
$sheet = $this->_container->createSheet();
$sheet->setTitle( $name );
return new MW_Container_Content_PHPExcel( $sheet, $name, $this->_getOptions() );
} | [
"public",
"function",
"create",
"(",
"$",
"name",
")",
"{",
"$",
"sheet",
"=",
"$",
"this",
"->",
"_container",
"->",
"createSheet",
"(",
")",
";",
"$",
"sheet",
"->",
"setTitle",
"(",
"$",
"name",
")",
";",
"return",
"new",
"MW_Container_Content_PHPExce... | Creates a new content object.
@param string $name Name of the content
@return MW_Container_Content_Interface New content object | [
"Creates",
"a",
"new",
"content",
"object",
"."
] | train | https://github.com/Arcavias/ext-phpexcel/blob/00e6ce6205e4f44eb0c438093b523b084a019e8d/lib/custom/src/MW/Container/PHPExcel.php#L86-L92 |
Arcavias/ext-phpexcel | lib/custom/src/MW/Container/PHPExcel.php | MW_Container_PHPExcel.close | public function close()
{
$writer = PHPExcel_IOFactory::createWriter( $this->_container, $this->_format );
$writer->save( $this->_resourcepath );
} | php | public function close()
{
$writer = PHPExcel_IOFactory::createWriter( $this->_container, $this->_format );
$writer->save( $this->_resourcepath );
} | [
"public",
"function",
"close",
"(",
")",
"{",
"$",
"writer",
"=",
"PHPExcel_IOFactory",
"::",
"createWriter",
"(",
"$",
"this",
"->",
"_container",
",",
"$",
"this",
"->",
"_format",
")",
";",
"$",
"writer",
"->",
"save",
"(",
"$",
"this",
"->",
"_reso... | Cleans up and saves the container. | [
"Cleans",
"up",
"and",
"saves",
"the",
"container",
"."
] | train | https://github.com/Arcavias/ext-phpexcel/blob/00e6ce6205e4f44eb0c438093b523b084a019e8d/lib/custom/src/MW/Container/PHPExcel.php#L109-L113 |
Arcavias/ext-phpexcel | lib/custom/src/MW/Container/PHPExcel.php | MW_Container_PHPExcel.current | function current()
{
$sheet = $this->_iterator->current();
return new MW_Container_Content_PHPExcel( $sheet, $sheet->getTitle(), $this->_getOptions() );
} | php | function current()
{
$sheet = $this->_iterator->current();
return new MW_Container_Content_PHPExcel( $sheet, $sheet->getTitle(), $this->_getOptions() );
} | [
"function",
"current",
"(",
")",
"{",
"$",
"sheet",
"=",
"$",
"this",
"->",
"_iterator",
"->",
"current",
"(",
")",
";",
"return",
"new",
"MW_Container_Content_PHPExcel",
"(",
"$",
"sheet",
",",
"$",
"sheet",
"->",
"getTitle",
"(",
")",
",",
"$",
"this... | Return the current element.
@return MW_Container_Content_Interface Content object with PHPExcel sheet | [
"Return",
"the",
"current",
"element",
"."
] | train | https://github.com/Arcavias/ext-phpexcel/blob/00e6ce6205e4f44eb0c438093b523b084a019e8d/lib/custom/src/MW/Container/PHPExcel.php#L121-L126 |
mybb/standards | MyBB2/Sniffs/Naming/AbstractClassConventionSniff.php | MyBB2_Sniffs_Naming_AbstractClassConventionSniff.process | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
$className = $phpcsFile->findNext(T_STRING, $stackPtr);
$name = trim($tokens[$className]['content']);
$errorData = array(ucfirst($tokens[$stackPtr]['content']));
$classProperties = $phpcsFile->getCla... | php | public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
{
$tokens = $phpcsFile->getTokens();
$className = $phpcsFile->findNext(T_STRING, $stackPtr);
$name = trim($tokens[$className]['content']);
$errorData = array(ucfirst($tokens[$stackPtr]['content']));
$classProperties = $phpcsFile->getCla... | [
"public",
"function",
"process",
"(",
"PHP_CodeSniffer_File",
"$",
"phpcsFile",
",",
"$",
"stackPtr",
")",
"{",
"$",
"tokens",
"=",
"$",
"phpcsFile",
"->",
"getTokens",
"(",
")",
";",
"$",
"className",
"=",
"$",
"phpcsFile",
"->",
"findNext",
"(",
"T_STRIN... | Processes this test, when one of its tokens is encountered.
@param PHP_CodeSniffer_File $phpcsFile The current file being processed.
@param int $stackPtr The position of the current token
in the stack passed in $tokens.
@return void | [
"Processes",
"this",
"test",
"when",
"one",
"of",
"its",
"tokens",
"is",
"encountered",
"."
] | train | https://github.com/mybb/standards/blob/78beaef4c8940f251bc62fdb7998566fe3a20be0/MyBB2/Sniffs/Naming/AbstractClassConventionSniff.php#L35-L54 |
csun-metalab/laravel-directory-authentication | src/Authentication/Providers/UserProviderDB.php | UserProviderDB.retrieveByCredentials | public function retrieveByCredentials(array $credentials) {
$u = $credentials['username'];
$p = $credentials['password'];
$m = $this->modelName;
// attempt to auth with the credentials provided
try
{
// build the query to retrieve the model instance
$user = $m::where($this->u... | php | public function retrieveByCredentials(array $credentials) {
$u = $credentials['username'];
$p = $credentials['password'];
$m = $this->modelName;
// attempt to auth with the credentials provided
try
{
// build the query to retrieve the model instance
$user = $m::where($this->u... | [
"public",
"function",
"retrieveByCredentials",
"(",
"array",
"$",
"credentials",
")",
"{",
"$",
"u",
"=",
"$",
"credentials",
"[",
"'username'",
"]",
";",
"$",
"p",
"=",
"$",
"credentials",
"[",
"'password'",
"]",
";",
"$",
"m",
"=",
"$",
"this",
"->",... | Retrieves the user with the specified credentials from the database.
Returns null if the model instance could not be found.
@param array $credentials The credentials to use
@return User|boolean|null | [
"Retrieves",
"the",
"user",
"with",
"the",
"specified",
"credentials",
"from",
"the",
"database",
".",
"Returns",
"null",
"if",
"the",
"model",
"instance",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Providers/UserProviderDB.php#L72-L109 |
csun-metalab/laravel-directory-authentication | src/Authentication/Providers/UserProviderDB.php | UserProviderDB.retrieveByToken | public function retrieveByToken($identifier, $token) {
$m = $this->modelName;
return $m::findForAuthToken($identifier, $token);
} | php | public function retrieveByToken($identifier, $token) {
$m = $this->modelName;
return $m::findForAuthToken($identifier, $token);
} | [
"public",
"function",
"retrieveByToken",
"(",
"$",
"identifier",
",",
"$",
"token",
")",
"{",
"$",
"m",
"=",
"$",
"this",
"->",
"modelName",
";",
"return",
"$",
"m",
"::",
"findForAuthToken",
"(",
"$",
"identifier",
",",
"$",
"token",
")",
";",
"}"
] | Returns the user with the specified identifier and Remember Me token.
@param string $identifier The identifier to use
@param string $token The Remember Me token to use
@return User | [
"Returns",
"the",
"user",
"with",
"the",
"specified",
"identifier",
"and",
"Remember",
"Me",
"token",
"."
] | train | https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Providers/UserProviderDB.php#L129-L132 |
csun-metalab/laravel-directory-authentication | src/Authentication/Providers/UserProviderDB.php | UserProviderDB.updateRememberToken | public function updateRememberToken(AuthenticatableContract $user, $token) {
if(!empty($user)) {
// make sure there is a remember_token field available for
// updating before trying to update; otherwise we run into
// an uncatchable exception
if($user->canHaveRememberToken()) {
$user... | php | public function updateRememberToken(AuthenticatableContract $user, $token) {
if(!empty($user)) {
// make sure there is a remember_token field available for
// updating before trying to update; otherwise we run into
// an uncatchable exception
if($user->canHaveRememberToken()) {
$user... | [
"public",
"function",
"updateRememberToken",
"(",
"AuthenticatableContract",
"$",
"user",
",",
"$",
"token",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"user",
")",
")",
"{",
"// make sure there is a remember_token field available for",
"// updating before trying to u... | Updates the Remember Me token for the specified identifier.
@param UserInterface $user The user object whose token is being updated
@param string $token The Remember Me token to update | [
"Updates",
"the",
"Remember",
"Me",
"token",
"for",
"the",
"specified",
"identifier",
"."
] | train | https://github.com/csun-metalab/laravel-directory-authentication/blob/b8d4fa64dd646566e508cdf838d6a3d03b1d53ea/src/Authentication/Providers/UserProviderDB.php#L140-L150 |
unimapper/unimapper | src/Entity/Reflection.php | Reflection.load | public static function load($arg)
{
if (is_object($arg) && $arg instanceof Entity) {
$class = get_class($arg);
} elseif (is_object($arg) && $arg instanceof Collection) {
$class = $arg->getEntityClass();
} elseif (is_object($arg) && $arg instanceof Reflection) {
... | php | public static function load($arg)
{
if (is_object($arg) && $arg instanceof Entity) {
$class = get_class($arg);
} elseif (is_object($arg) && $arg instanceof Collection) {
$class = $arg->getEntityClass();
} elseif (is_object($arg) && $arg instanceof Reflection) {
... | [
"public",
"static",
"function",
"load",
"(",
"$",
"arg",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"arg",
")",
"&&",
"$",
"arg",
"instanceof",
"Entity",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"arg",
")",
";",
"}",
"elseif",
"(",
"i... | Load and register reflection
@param string|Entity|Collection|Reflection $arg
@throws Exception\InvalidArgumentException
@return Reflection | [
"Load",
"and",
"register",
"reflection"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection.php#L98-L135 |
unimapper/unimapper | src/Entity/Reflection.php | Reflection._parseProperties | private function _parseProperties($docComment, \ReflectionClass $reflectionClass)
{
$properties = [];
foreach (Reflection\Annotation::parseProperties($docComment) as $definition) {
try {
$property = new Reflection\Property(
$definition[2],
... | php | private function _parseProperties($docComment, \ReflectionClass $reflectionClass)
{
$properties = [];
foreach (Reflection\Annotation::parseProperties($docComment) as $definition) {
try {
$property = new Reflection\Property(
$definition[2],
... | [
"private",
"function",
"_parseProperties",
"(",
"$",
"docComment",
",",
"\\",
"ReflectionClass",
"$",
"reflectionClass",
")",
"{",
"$",
"properties",
"=",
"[",
"]",
";",
"foreach",
"(",
"Reflection",
"\\",
"Annotation",
"::",
"parseProperties",
"(",
"$",
"docC... | Parse properties from annotations
@param string $docComment
@param \ReflectionClass $reflectionClass
@throws Exception\ReflectionException | [
"Parse",
"properties",
"from",
"annotations"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection.php#L166-L208 |
unimapper/unimapper | src/Entity/Reflection.php | Reflection.getProperty | public function getProperty($name)
{
if (!$this->hasProperty($name)) {
throw new Exception\InvalidArgumentException(
"Unknown property " . $name . "!"
);
}
return $this->properties[$name];
} | php | public function getProperty($name)
{
if (!$this->hasProperty($name)) {
throw new Exception\InvalidArgumentException(
"Unknown property " . $name . "!"
);
}
return $this->properties[$name];
} | [
"public",
"function",
"getProperty",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasProperty",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"InvalidArgumentException",
"(",
"\"Unknown property \"",
".",
"$",
"name... | Get property reflection object
@param string $name
@return Reflection\Property
@throws Exception\InvalidArgumentException | [
"Get",
"property",
"reflection",
"object"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection.php#L239-L247 |
unimapper/unimapper | src/Entity/Reflection.php | Reflection.getRelatedFiles | public function getRelatedFiles(array $files = [])
{
if (in_array($this->fileName, $files)) {
return $files;
}
$files[] = $this->fileName;
foreach ($this->properties as $property) {
if (in_array($property->getType(), [Reflection\Property::TYPE_COLLECTION, Ref... | php | public function getRelatedFiles(array $files = [])
{
if (in_array($this->fileName, $files)) {
return $files;
}
$files[] = $this->fileName;
foreach ($this->properties as $property) {
if (in_array($property->getType(), [Reflection\Property::TYPE_COLLECTION, Ref... | [
"public",
"function",
"getRelatedFiles",
"(",
"array",
"$",
"files",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"this",
"->",
"fileName",
",",
"$",
"files",
")",
")",
"{",
"return",
"$",
"files",
";",
"}",
"$",
"files",
"[",
"]",
"... | Get arg's related files
@param array $files
@return array | [
"Get",
"arg",
"s",
"related",
"files"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection.php#L261-L274 |
unimapper/unimapper | src/Entity/Reflection.php | Reflection.getPrimaryProperty | public function getPrimaryProperty()
{
foreach ($this->properties as $property) {
if ($property->hasOption(Entity\Reflection\Property\Option\Primary::KEY)) {
return $property;
}
}
throw new \Exception(
"Primary property not defined in " . ... | php | public function getPrimaryProperty()
{
foreach ($this->properties as $property) {
if ($property->hasOption(Entity\Reflection\Property\Option\Primary::KEY)) {
return $property;
}
}
throw new \Exception(
"Primary property not defined in " . ... | [
"public",
"function",
"getPrimaryProperty",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"properties",
"as",
"$",
"property",
")",
"{",
"if",
"(",
"$",
"property",
"->",
"hasOption",
"(",
"Entity",
"\\",
"Reflection",
"\\",
"Property",
"\\",
"Option",... | Get primary property reflection
@return Reflection\Property
@throws \Exception | [
"Get",
"primary",
"property",
"reflection"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Entity/Reflection.php#L294-L305 |
vardius/crud-bundle | Routing/CrudLoader.php | CrudLoader.load | public function load($resource, $type = null)
{
$routes = new RouteCollection();
foreach ($this->pool->getControllers() as $controllerKey => $controller) {
/** @var CrudController $controller */
foreach ($controller->getActions() as $actionKey => $action) {
/... | php | public function load($resource, $type = null)
{
$routes = new RouteCollection();
foreach ($this->pool->getControllers() as $controllerKey => $controller) {
/** @var CrudController $controller */
foreach ($controller->getActions() as $actionKey => $action) {
/... | [
"public",
"function",
"load",
"(",
"$",
"resource",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"routes",
"=",
"new",
"RouteCollection",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"pool",
"->",
"getControllers",
"(",
")",
"as",
"$",
"control... | Loads a resource.
@param mixed $resource The resource
@param string|null $type The resource type or null if unknown
@return RouteCollection | [
"Loads",
"a",
"resource",
"."
] | train | https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Routing/CrudLoader.php#L46-L79 |
ahmad-sa3d/saad-image | src/Traits/EloquentImageSaverTrait.php | EloquentImageSaverTrait.saveImage | public function saveImage( \Illuminate\Http\UploadedFile $imageFile, $path, $name = null, Array $sizes = [], $callback = null )
{
$extension = $imageFile->extension();
if( !in_array( $extension, [ 'png', 'jpeg', 'jpg', 'gif' ] ) )
throw new NotSupportedImageFormatException( $extension ... | php | public function saveImage( \Illuminate\Http\UploadedFile $imageFile, $path, $name = null, Array $sizes = [], $callback = null )
{
$extension = $imageFile->extension();
if( !in_array( $extension, [ 'png', 'jpeg', 'jpg', 'gif' ] ) )
throw new NotSupportedImageFormatException( $extension ... | [
"public",
"function",
"saveImage",
"(",
"\\",
"Illuminate",
"\\",
"Http",
"\\",
"UploadedFile",
"$",
"imageFile",
",",
"$",
"path",
",",
"$",
"name",
"=",
"null",
",",
"Array",
"$",
"sizes",
"=",
"[",
"]",
",",
"$",
"callback",
"=",
"null",
")",
"{",... | Save Uploaded File Image
@param \Illuminate\Http\UploadedFile $imageFile [description]
@param String $path Path where to save Image
@param String $name Image Save Name
@param Array|array $sizes Array of image sizes
@param Function ... | [
"Save",
"Uploaded",
"File",
"Image"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Traits/EloquentImageSaverTrait.php#L26-L69 |
ahmad-sa3d/saad-image | src/Traits/EloquentImageSaverTrait.php | EloquentImageSaverTrait.saveImages | public function saveImages( Array $images, $path, $name = null, Array $sizes = [], $callback = null )
{
$array = [];
foreach( $images as $file )
{
$array[] = $this->saveImage( $file, $path );
}
// CallBack
if( is_callable( $callback ) )
call_... | php | public function saveImages( Array $images, $path, $name = null, Array $sizes = [], $callback = null )
{
$array = [];
foreach( $images as $file )
{
$array[] = $this->saveImage( $file, $path );
}
// CallBack
if( is_callable( $callback ) )
call_... | [
"public",
"function",
"saveImages",
"(",
"Array",
"$",
"images",
",",
"$",
"path",
",",
"$",
"name",
"=",
"null",
",",
"Array",
"$",
"sizes",
"=",
"[",
"]",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"array",
"=",
"[",
"]",
";",
"foreach",... | Save Array Of Uploaded Files Image
@param Array $images Array of \Illuminate\Http\UploadedFile
@param String $path Path where to save Image
@param String $name Image Save Name
@param Array|array $sizes Array of... | [
"Save",
"Array",
"Of",
"Uploaded",
"Files",
"Image"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Traits/EloquentImageSaverTrait.php#L81-L96 |
ahmad-sa3d/saad-image | src/Traits/EloquentImageSaverTrait.php | EloquentImageSaverTrait.getSize | public static function getSize( $size )
{
$dim = [];
if( is_array( $size ) )
{
$dim[ 'w' ] = $size[0];
$dim[ 'h' ] = isset( $size[1] ) ? $size[1] : $size[0];
}
else
{
$dim[ 'w' ] = $size;
$dim[ 'h' ] = null;
}
... | php | public static function getSize( $size )
{
$dim = [];
if( is_array( $size ) )
{
$dim[ 'w' ] = $size[0];
$dim[ 'h' ] = isset( $size[1] ) ? $size[1] : $size[0];
}
else
{
$dim[ 'w' ] = $size;
$dim[ 'h' ] = null;
}
... | [
"public",
"static",
"function",
"getSize",
"(",
"$",
"size",
")",
"{",
"$",
"dim",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"size",
")",
")",
"{",
"$",
"dim",
"[",
"'w'",
"]",
"=",
"$",
"size",
"[",
"0",
"]",
";",
"$",
"dim",
"[... | Get Width, Height values | [
"Get",
"Width",
"Height",
"values"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Traits/EloquentImageSaverTrait.php#L101-L116 |
ahmad-sa3d/saad-image | src/Traits/EloquentImageSaverTrait.php | EloquentImageSaverTrait.saveLocalImage | public function saveLocalImage( $imageFile, $path, $name = null, Array $sizes = [], $callback = null )
{
$arr = explode('.',$imageFile);
$extension = end($arr);
if( !in_array( $extension, [ 'png', 'jpeg', 'jpg', 'gif' ] ) )
throw new NotSupportedImageFormatException( $extension... | php | public function saveLocalImage( $imageFile, $path, $name = null, Array $sizes = [], $callback = null )
{
$arr = explode('.',$imageFile);
$extension = end($arr);
if( !in_array( $extension, [ 'png', 'jpeg', 'jpg', 'gif' ] ) )
throw new NotSupportedImageFormatException( $extension... | [
"public",
"function",
"saveLocalImage",
"(",
"$",
"imageFile",
",",
"$",
"path",
",",
"$",
"name",
"=",
"null",
",",
"Array",
"$",
"sizes",
"=",
"[",
"]",
",",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"arr",
"=",
"explode",
"(",
"'.'",
",",
"... | Save Locale Images
@param String $imageFile Image Path
@param String $path Path where to save Image
@param String $name Image Save Name
@param Array|array $sizes Array of image sizes
@param Function ... | [
"Save",
"Locale",
"Images"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Traits/EloquentImageSaverTrait.php#L128-L172 |
eliep/avro-rpc-php | lib/avro/protocol.php | AvroProtocol.to_avro | public function to_avro()
{
$avro = array("protocol" => $this->name, "namespace" => $this->namespace);
if (!is_null($this->doc))
$avro["doc"] = $this->doc;
$types = array();
$avro["types"] = $this->schemata->to_avro();
$messages = array();
foreach ($this->messages as $name... | php | public function to_avro()
{
$avro = array("protocol" => $this->name, "namespace" => $this->namespace);
if (!is_null($this->doc))
$avro["doc"] = $this->doc;
$types = array();
$avro["types"] = $this->schemata->to_avro();
$messages = array();
foreach ($this->messages as $name... | [
"public",
"function",
"to_avro",
"(",
")",
"{",
"$",
"avro",
"=",
"array",
"(",
"\"protocol\"",
"=>",
"$",
"this",
"->",
"name",
",",
"\"namespace\"",
"=>",
"$",
"this",
"->",
"namespace",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
... | Internal represention of this Avro Protocol.
@returns mixed | [
"Internal",
"represention",
"of",
"this",
"Avro",
"Protocol",
"."
] | train | https://github.com/eliep/avro-rpc-php/blob/645321e5224eac9234fc79dbf447de3973a9ed1e/lib/avro/protocol.php#L99-L115 |
DevGroup-ru/yii2-data-structure-tools | src/searchOld/elastic/Watch.php | Watch.flushForModel | protected function flushForModel($index, $modelId)
{
$query = [
'index' => $index,
'body' => [
'query' => [
'bool' => [
'filter' => [
'bool' => [
'must' => [
... | php | protected function flushForModel($index, $modelId)
{
$query = [
'index' => $index,
'body' => [
'query' => [
'bool' => [
'filter' => [
'bool' => [
'must' => [
... | [
"protected",
"function",
"flushForModel",
"(",
"$",
"index",
",",
"$",
"modelId",
")",
"{",
"$",
"query",
"=",
"[",
"'index'",
"=>",
"$",
"index",
",",
"'body'",
"=>",
"[",
"'query'",
"=>",
"[",
"'bool'",
"=>",
"[",
"'filter'",
"=>",
"[",
"'bool'",
"... | Flushes all elasticsearch indices for given model id
@param string $index
@param integer $modelId | [
"Flushes",
"all",
"elasticsearch",
"indices",
"for",
"given",
"model",
"id"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/Watch.php#L95-L129 |
DevGroup-ru/yii2-data-structure-tools | src/searchOld/elastic/Watch.php | Watch.fillForModel | protected function fillForModel($index, $model)
{
if (false === empty($model->propertiesIds) && false === empty($model->propertiesValues)) {
//leave only not empty properties
$workingProps = array_filter($model->propertiesValues, function ($e) {
if (true === is_array(... | php | protected function fillForModel($index, $model)
{
if (false === empty($model->propertiesIds) && false === empty($model->propertiesValues)) {
//leave only not empty properties
$workingProps = array_filter($model->propertiesValues, function ($e) {
if (true === is_array(... | [
"protected",
"function",
"fillForModel",
"(",
"$",
"index",
",",
"$",
"model",
")",
"{",
"if",
"(",
"false",
"===",
"empty",
"(",
"$",
"model",
"->",
"propertiesIds",
")",
"&&",
"false",
"===",
"empty",
"(",
"$",
"model",
"->",
"propertiesValues",
")",
... | Performs model index filling
@param string $index
@param ActiveRecord | HasProperties | PropertiesTrait $model | [
"Performs",
"model",
"index",
"filling"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/Watch.php#L137-L175 |
DevGroup-ru/yii2-data-structure-tools | src/searchOld/elastic/Watch.php | Watch.prepareStatic | private static function prepareStatic($props, $modelId, $workingProps, $index, $type, $languages)
{
$res = $valIds = [];
//leave only applicable properties with according values
$workingProps = array_intersect_key($workingProps, $props);
$workingProps = array_flip($workingProps);
... | php | private static function prepareStatic($props, $modelId, $workingProps, $index, $type, $languages)
{
$res = $valIds = [];
//leave only applicable properties with according values
$workingProps = array_intersect_key($workingProps, $props);
$workingProps = array_flip($workingProps);
... | [
"private",
"static",
"function",
"prepareStatic",
"(",
"$",
"props",
",",
"$",
"modelId",
",",
"$",
"workingProps",
",",
"$",
"index",
",",
"$",
"type",
",",
"$",
"languages",
")",
"{",
"$",
"res",
"=",
"$",
"valIds",
"=",
"[",
"]",
";",
"//leave onl... | Prepares bulk data to store in elasticsearch index for model properties static values
@param array $props
@param integer $modelId
@param array $workingProps
@param string $index index name i.e.: page
@param string $type index type i.e.: static_values
@param array $languages
@return array | [
"Prepares",
"bulk",
"data",
"to",
"store",
"in",
"elasticsearch",
"index",
"for",
"model",
"properties",
"static",
"values"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/Watch.php#L212-L251 |
DevGroup-ru/yii2-data-structure-tools | src/searchOld/elastic/Watch.php | Watch.prepareEav | private static function prepareEav($model, $props, $index, $type, $languages)
{
$eavTable = $model->eavTable();
$values = (new Query())
->from($eavTable)
->where([
'model_id' => $model->id,
'property_id' => array_keys($props)
])
... | php | private static function prepareEav($model, $props, $index, $type, $languages)
{
$eavTable = $model->eavTable();
$values = (new Query())
->from($eavTable)
->where([
'model_id' => $model->id,
'property_id' => array_keys($props)
])
... | [
"private",
"static",
"function",
"prepareEav",
"(",
"$",
"model",
",",
"$",
"props",
",",
"$",
"index",
",",
"$",
"type",
",",
"$",
"languages",
")",
"{",
"$",
"eavTable",
"=",
"$",
"model",
"->",
"eavTable",
"(",
")",
";",
"$",
"values",
"=",
"(",... | Prepares bulk data to store in elasticsearch index for model properties eav values
@param HasProperties | PropertiesTrait $model
@param array $props
@param string $index
@param string $type
@param array $languages
@return array | [
"Prepares",
"bulk",
"data",
"to",
"store",
"in",
"elasticsearch",
"index",
"for",
"model",
"properties",
"eav",
"values"
] | train | https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/elastic/Watch.php#L263-L315 |
scottrobertson/premailer | src/ScottRobertson/Premailer/Request.php | Request.convert | public function convert(
$source,
$adapter = 'hpricot',
$base_url = null,
$line_length = 65,
$link_query_string = null,
$preserve_styles = true,
$remove_ids = true,
$remove_classes = true,
$remove_comments = true
)
{
$params = array(
'adapter' => $adapter,
'bas... | php | public function convert(
$source,
$adapter = 'hpricot',
$base_url = null,
$line_length = 65,
$link_query_string = null,
$preserve_styles = true,
$remove_ids = true,
$remove_classes = true,
$remove_comments = true
)
{
$params = array(
'adapter' => $adapter,
'bas... | [
"public",
"function",
"convert",
"(",
"$",
"source",
",",
"$",
"adapter",
"=",
"'hpricot'",
",",
"$",
"base_url",
"=",
"null",
",",
"$",
"line_length",
"=",
"65",
",",
"$",
"link_query_string",
"=",
"null",
",",
"$",
"preserve_styles",
"=",
"true",
",",
... | Convert an email using Premailer
@param string $source Can either be a url, or raw html
@param string $adapter Which document handler to use
@param string $base_url Base URL for converting relative links
@param integer $line_length Length of lines in the plain text version
@pa... | [
"Convert",
"an",
"email",
"using",
"Premailer"
] | train | https://github.com/scottrobertson/premailer/blob/c7869561473c496766ddd5ed10506508aa24dd8f/src/ScottRobertson/Premailer/Request.php#L48-L80 |
scottrobertson/premailer | src/ScottRobertson/Premailer/Request.php | Request.request | private function request(array $params = array())
{
$request = $this->client->createRequest('POST', $this->url);
$body = $request->getBody();
foreach ($params as $key => $value) {
$body->setField($key, $value);
}
try {
$response = $this->client->send($request);
} catch (\Exceptio... | php | private function request(array $params = array())
{
$request = $this->client->createRequest('POST', $this->url);
$body = $request->getBody();
foreach ($params as $key => $value) {
$body->setField($key, $value);
}
try {
$response = $this->client->send($request);
} catch (\Exceptio... | [
"private",
"function",
"request",
"(",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"client",
"->",
"createRequest",
"(",
"'POST'",
",",
"$",
"this",
"->",
"url",
")",
";",
"$",
"body",
"=",
"$",... | Make the request to Premailer
@param array $params
@return \ScottRobertson\Premailer\Response | [
"Make",
"the",
"request",
"to",
"Premailer"
] | train | https://github.com/scottrobertson/premailer/blob/c7869561473c496766ddd5ed10506508aa24dd8f/src/ScottRobertson/Premailer/Request.php#L87-L106 |
rokde/laravel-bootstrap-formbuilder | src/HtmlServiceProvider.php | HtmlServiceProvider.register | public function register()
{
$this->registerHtmlBuilder();
$this->registerFormBuilder();
$this->app->alias('html', 'Collective\Html\HtmlBuilder');
$this->app->alias('form', 'Rokde\LaravelBootstrap\Html\BootstrapFormBuilder');
} | php | public function register()
{
$this->registerHtmlBuilder();
$this->registerFormBuilder();
$this->app->alias('html', 'Collective\Html\HtmlBuilder');
$this->app->alias('form', 'Rokde\LaravelBootstrap\Html\BootstrapFormBuilder');
} | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"registerHtmlBuilder",
"(",
")",
";",
"$",
"this",
"->",
"registerFormBuilder",
"(",
")",
";",
"$",
"this",
"->",
"app",
"->",
"alias",
"(",
"'html'",
",",
"'Collective\\Html\\HtmlBuilder'",... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/rokde/laravel-bootstrap-formbuilder/blob/f3ce43ad3d74b045176e24a03e9deffb71c17cd6/src/HtmlServiceProvider.php#L27-L35 |
rokde/laravel-bootstrap-formbuilder | src/HtmlServiceProvider.php | HtmlServiceProvider.registerFormBuilder | protected function registerFormBuilder()
{
$this->app->singleton('form', function ($app) {
$form = new BootstrapFormBuilder($app['html'], $app['url'], $app['view'], $app['session.store']->getToken());
return $form->setSessionStore($app['session.store']);
});
} | php | protected function registerFormBuilder()
{
$this->app->singleton('form', function ($app) {
$form = new BootstrapFormBuilder($app['html'], $app['url'], $app['view'], $app['session.store']->getToken());
return $form->setSessionStore($app['session.store']);
});
} | [
"protected",
"function",
"registerFormBuilder",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"singleton",
"(",
"'form'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"$",
"form",
"=",
"new",
"BootstrapFormBuilder",
"(",
"$",
"app",
"[",
"'html'",
"]",
... | Register the form builder instance.
@return void | [
"Register",
"the",
"form",
"builder",
"instance",
"."
] | train | https://github.com/rokde/laravel-bootstrap-formbuilder/blob/f3ce43ad3d74b045176e24a03e9deffb71c17cd6/src/HtmlServiceProvider.php#L54-L61 |
vi-kon/laravel-parser | src/ViKon/Parser/lexer/LexerPattern.php | LexerPattern.addPattern | public function addPattern($pattern, $childRuleName = null) {
preg_match_all(
'/\\\\.|' . // match \.
'\(\?|[()]|' . // match "(" or ")"
'\[\^?\]?(?:\\\\.|\[:[^]]*:\]|[^]\\\\])*\]|' . // match combination of "[]"
'[^[()\\\\]+/', // match not in list "()\"
... | php | public function addPattern($pattern, $childRuleName = null) {
preg_match_all(
'/\\\\.|' . // match \.
'\(\?|[()]|' . // match "(" or ")"
'\[\^?\]?(?:\\\\.|\[:[^]]*:\]|[^]\\\\])*\]|' . // match combination of "[]"
'[^[()\\\\]+/', // match not in list "()\"
... | [
"public",
"function",
"addPattern",
"(",
"$",
"pattern",
",",
"$",
"childRuleName",
"=",
"null",
")",
"{",
"preg_match_all",
"(",
"'/\\\\\\\\.|'",
".",
"// match \\.",
"'\\(\\?|[()]|'",
".",
"// match \"(\" or \")\"",
"'\\[\\^?\\]?(?:\\\\\\\\.|\\[:[^]]*:\\]|[^]\\\\\\\\])*\\... | Add pattern to rule pattern
@param string $pattern regex pattern
@param string|null $childRuleName regex pattern owner rule name | [
"Add",
"pattern",
"to",
"rule",
"pattern"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/lexer/LexerPattern.php#L45-L90 |
vi-kon/laravel-parser | src/ViKon/Parser/lexer/LexerPattern.php | LexerPattern.split | public function split($text) {
if (count($this->patterns) === 0) {
return false;
}
if ($this->concatenatedPatterns === null) {
$this->concatenatedPatterns = '/' . implode('|', array_map(function ($pattern) {
return $pattern['pattern'];
... | php | public function split($text) {
if (count($this->patterns) === 0) {
return false;
}
if ($this->concatenatedPatterns === null) {
$this->concatenatedPatterns = '/' . implode('|', array_map(function ($pattern) {
return $pattern['pattern'];
... | [
"public",
"function",
"split",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"patterns",
")",
"===",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"concatenatedPatterns",
"===",
"null",
")",
"{"... | Split subject into pieces
@param string $text raw text to split
@return array|bool return array with exploded string chunks | [
"Split",
"subject",
"into",
"pieces"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/lexer/LexerPattern.php#L99-L119 |
joomla-projects/jorobo | src/Tasks/BumpVersion.php | BumpVersion.run | public function run()
{
$this->say('Updating ' . $this->getJConfig()->extension . " to " . $this->getJConfig()->version);
// Reusing the header config here
$exclude = explode(",", trim($this->getJConfig()->header->exclude));
$path = realpath($this->getJConfig()->source);
$fileTypes = explode(",", trim... | php | public function run()
{
$this->say('Updating ' . $this->getJConfig()->extension . " to " . $this->getJConfig()->version);
// Reusing the header config here
$exclude = explode(",", trim($this->getJConfig()->header->exclude));
$path = realpath($this->getJConfig()->source);
$fileTypes = explode(",", trim... | [
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"say",
"(",
"'Updating '",
".",
"$",
"this",
"->",
"getJConfig",
"(",
")",
"->",
"extension",
".",
"\" to \"",
".",
"$",
"this",
"->",
"getJConfig",
"(",
")",
"->",
"version",
")",
";",
... | Maps all parts of an extension into a Joomla! installation
@return bool
@since 1.0 | [
"Maps",
"all",
"parts",
"of",
"an",
"extension",
"into",
"a",
"Joomla!",
"installation"
] | train | https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/BumpVersion.php#L43-L103 |
unimapper/unimapper | src/Validator.php | Validator.addCondition | public function addCondition($validation)
{
if (!$this->property) {
throw new Exception\InvalidArgumentException(
"Condition can be called only on properties!"
);
}
$condition = new Validator\Condition(
$this->_getValidation($validation),
... | php | public function addCondition($validation)
{
if (!$this->property) {
throw new Exception\InvalidArgumentException(
"Condition can be called only on properties!"
);
}
$condition = new Validator\Condition(
$this->_getValidation($validation),
... | [
"public",
"function",
"addCondition",
"(",
"$",
"validation",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"property",
")",
"{",
"throw",
"new",
"Exception",
"\\",
"InvalidArgumentException",
"(",
"\"Condition can be called only on properties!\"",
")",
";",
"}",
... | Add validation condition
@param mixed $validation Callable or some default validation method name
@return \UniMapper\Validator | [
"Add",
"validation",
"condition"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Validator.php#L66-L79 |
unimapper/unimapper | src/Validator.php | Validator.addError | public function addError($message, $severity = Validator\Rule::ERROR,
array $indexes = []
) {
$rule = new Validator\Rule(
$this->entity,
function () {
return false;
},
$message,
$this->property,
$severity,
... | php | public function addError($message, $severity = Validator\Rule::ERROR,
array $indexes = []
) {
$rule = new Validator\Rule(
$this->entity,
function () {
return false;
},
$message,
$this->property,
$severity,
... | [
"public",
"function",
"addError",
"(",
"$",
"message",
",",
"$",
"severity",
"=",
"Validator",
"\\",
"Rule",
"::",
"ERROR",
",",
"array",
"$",
"indexes",
"=",
"[",
"]",
")",
"{",
"$",
"rule",
"=",
"new",
"Validator",
"\\",
"Rule",
"(",
"$",
"this",
... | Add permanent error manually
@param string $message
@param integer $severity
@param array $indexes Failed indexes, has effect on collections only
@return \UniMapper\Validator | [
"Add",
"permanent",
"error",
"manually"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Validator.php#L98-L114 |
unimapper/unimapper | src/Validator.php | Validator.on | public function on($name, $child = null)
{
$reflection = $this->entity->getReflection();
if (!$reflection->hasProperty($name)) {
throw new Exception\InvalidArgumentException(
"Unknown property '" . $name . "'!"
);
}
$this->property = $reflecti... | php | public function on($name, $child = null)
{
$reflection = $this->entity->getReflection();
if (!$reflection->hasProperty($name)) {
throw new Exception\InvalidArgumentException(
"Unknown property '" . $name . "'!"
);
}
$this->property = $reflecti... | [
"public",
"function",
"on",
"(",
"$",
"name",
",",
"$",
"child",
"=",
"null",
")",
"{",
"$",
"reflection",
"=",
"$",
"this",
"->",
"entity",
"->",
"getReflection",
"(",
")",
";",
"if",
"(",
"!",
"$",
"reflection",
"->",
"hasProperty",
"(",
"$",
"na... | Set property which is validation configured on
@param string $name Property name in entity
@param string $child Child property name
@return \UniMapper\Validator
@throws \Exception | [
"Set",
"property",
"which",
"is",
"validation",
"configured",
"on"
] | train | https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Validator.php#L126-L153 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.