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 |
|---|---|---|---|---|---|---|---|---|---|---|
netbull/CoreBundle | ORM/Subscribers/Sluggable/SluggableSubscriber.php | SluggableSubscriber.onFlush | public function onFlush(OnFlushEventArgs $args)
{
$em = $args->getEntityManager();
$uow = $em->getUnitOfWork();
$uow->computeChangeSets();
} | php | public function onFlush(OnFlushEventArgs $args)
{
$em = $args->getEntityManager();
$uow = $em->getUnitOfWork();
$uow->computeChangeSets();
} | [
"public",
"function",
"onFlush",
"(",
"OnFlushEventArgs",
"$",
"args",
")",
"{",
"$",
"em",
"=",
"$",
"args",
"->",
"getEntityManager",
"(",
")",
";",
"$",
"uow",
"=",
"$",
"em",
"->",
"getUnitOfWork",
"(",
")",
";",
"$",
"uow",
"->",
"computeChangeSet... | {@inheritdoc} | [
"{"
] | train | https://github.com/netbull/CoreBundle/blob/0bacc1d9e4733b6da613027400c48421e5a14645/ORM/Subscribers/Sluggable/SluggableSubscriber.php#L87-L93 |
KDF5000/EasyThink | src/ThinkPHP/Library/Think/Cache/Driver/Memcache.php | Memcache.rm | public function rm($name, $ttl = false) {
$name = $this->options['prefix'].$name;
return $ttl === false ?
$this->handler->delete($name) :
$this->handler->delete($name, $ttl);
} | php | public function rm($name, $ttl = false) {
$name = $this->options['prefix'].$name;
return $ttl === false ?
$this->handler->delete($name) :
$this->handler->delete($name, $ttl);
} | [
"public",
"function",
"rm",
"(",
"$",
"name",
",",
"$",
"ttl",
"=",
"false",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"options",
"[",
"'prefix'",
"]",
".",
"$",
"name",
";",
"return",
"$",
"ttl",
"===",
"false",
"?",
"$",
"this",
"->",
"h... | 删除缓存
@access public
@param string $name 缓存变量名
@return boolean | [
"删除缓存"
] | train | https://github.com/KDF5000/EasyThink/blob/86efc9c8a0d504e01e2fea55868227fdc8928841/src/ThinkPHP/Library/Think/Cache/Driver/Memcache.php#L88-L93 |
Soneritics/Database | Soneritics/Database/DatabaseRecord/PDODatabaseRecord.php | PDODatabaseRecord.createMapping | private function createMapping()
{
$columns = $this->pdoStatement->columnCount();
if ($columns > 0) {
$this->mapping = [];
for ($i = 0; $i < $columns; $i++) {
$meta = $this->pdoStatement->getColumnMeta($i);
$this->mapping[$i] = [$meta['table'],... | php | private function createMapping()
{
$columns = $this->pdoStatement->columnCount();
if ($columns > 0) {
$this->mapping = [];
for ($i = 0; $i < $columns; $i++) {
$meta = $this->pdoStatement->getColumnMeta($i);
$this->mapping[$i] = [$meta['table'],... | [
"private",
"function",
"createMapping",
"(",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"pdoStatement",
"->",
"columnCount",
"(",
")",
";",
"if",
"(",
"$",
"columns",
">",
"0",
")",
"{",
"$",
"this",
"->",
"mapping",
"=",
"[",
"]",
";",
"for... | Create the mapping to use for mapping the column names to a result array. | [
"Create",
"the",
"mapping",
"to",
"use",
"for",
"mapping",
"the",
"column",
"names",
"to",
"a",
"result",
"array",
"."
] | train | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseRecord/PDODatabaseRecord.php#L51-L61 |
Soneritics/Database | Soneritics/Database/DatabaseRecord/PDODatabaseRecord.php | PDODatabaseRecord.all | public function all()
{
$this->reset();
$result = [];
while ($row = $this->get()) {
$result[] = $row;
}
return $result;
} | php | public function all()
{
$this->reset();
$result = [];
while ($row = $this->get()) {
$result[] = $row;
}
return $result;
} | [
"public",
"function",
"all",
"(",
")",
"{",
"$",
"this",
"->",
"reset",
"(",
")",
";",
"$",
"result",
"=",
"[",
"]",
";",
"while",
"(",
"$",
"row",
"=",
"$",
"this",
"->",
"get",
"(",
")",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"$",
"row",... | Return an array with all the data from the query.
@return array | [
"Return",
"an",
"array",
"with",
"all",
"the",
"data",
"from",
"the",
"query",
"."
] | train | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseRecord/PDODatabaseRecord.php#L80-L90 |
Soneritics/Database | Soneritics/Database/DatabaseRecord/PDODatabaseRecord.php | PDODatabaseRecord.get | public function get()
{
$row = $this->pdoStatement->fetch(\PDO::FETCH_NUM);
return $row ? $this->map($row) : $row;
} | php | public function get()
{
$row = $this->pdoStatement->fetch(\PDO::FETCH_NUM);
return $row ? $this->map($row) : $row;
} | [
"public",
"function",
"get",
"(",
")",
"{",
"$",
"row",
"=",
"$",
"this",
"->",
"pdoStatement",
"->",
"fetch",
"(",
"\\",
"PDO",
"::",
"FETCH_NUM",
")",
";",
"return",
"$",
"row",
"?",
"$",
"this",
"->",
"map",
"(",
"$",
"row",
")",
":",
"$",
"... | Fetch the next (or first) row from the results.
@return mixed | [
"Fetch",
"the",
"next",
"(",
"or",
"first",
")",
"row",
"from",
"the",
"results",
"."
] | train | https://github.com/Soneritics/Database/blob/20cb74f2a2ee8d9161d3144b5c061a6da11cd066/Soneritics/Database/DatabaseRecord/PDODatabaseRecord.php#L105-L109 |
maddoger/yii2-cms-user | common/models/PasswordResetRequestForm.php | PasswordResetRequestForm.sendEmail | public function sendEmail()
{
/* @var $user User */
$user = User::findOne([
'status' => User::STATUS_ACTIVE,
'email' => $this->email,
]);
if ($user) {
if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
$user->gene... | php | public function sendEmail()
{
/* @var $user User */
$user = User::findOne([
'status' => User::STATUS_ACTIVE,
'email' => $this->email,
]);
if ($user) {
if (!User::isPasswordResetTokenValid($user->password_reset_token)) {
$user->gene... | [
"public",
"function",
"sendEmail",
"(",
")",
"{",
"/* @var $user User */",
"$",
"user",
"=",
"User",
"::",
"findOne",
"(",
"[",
"'status'",
"=>",
"User",
"::",
"STATUS_ACTIVE",
",",
"'email'",
"=>",
"$",
"this",
"->",
"email",
",",
"]",
")",
";",
"if",
... | Sends an email with a link, for resetting the password.
@return boolean whether the email was send | [
"Sends",
"an",
"email",
"with",
"a",
"link",
"for",
"resetting",
"the",
"password",
"."
] | train | https://github.com/maddoger/yii2-cms-user/blob/6792d1d0d2c0bf01fe87729985b5659de4c1aac1/common/models/PasswordResetRequestForm.php#L65-L89 |
as3io/As3ModlrBundle | DependencyInjection/Compiler/DirectoryCompilerPass.php | DirectoryCompilerPass.createDirectory | private function createDirectory($dir)
{
if (file_exists($dir)) {
return $this;
}
if (false === @mkdir($dir, 0777, true)) {
throw new \RuntimeException(sprintf('Unable to create directory "%s"', $dir));
}
return $this;
} | php | private function createDirectory($dir)
{
if (file_exists($dir)) {
return $this;
}
if (false === @mkdir($dir, 0777, true)) {
throw new \RuntimeException(sprintf('Unable to create directory "%s"', $dir));
}
return $this;
} | [
"private",
"function",
"createDirectory",
"(",
"$",
"dir",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"dir",
")",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"false",
"===",
"@",
"mkdir",
"(",
"$",
"dir",
",",
"0777",
",",
"true",
")... | Creates a directory (if nonexistent).
@param string $dir
@return self
@throws \RuntimeException | [
"Creates",
"a",
"directory",
"(",
"if",
"nonexistent",
")",
"."
] | train | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Compiler/DirectoryCompilerPass.php#L23-L32 |
as3io/As3ModlrBundle | DependencyInjection/Compiler/DirectoryCompilerPass.php | DirectoryCompilerPass.process | public function process(ContainerBuilder $container)
{
$name = Utility::getAliasedName('dirs');
if (false === $container->hasParameter($name)) {
return;
}
foreach ($container->getParameter($name) as $dir) {
$this->createDirectory($dir);
}
} | php | public function process(ContainerBuilder $container)
{
$name = Utility::getAliasedName('dirs');
if (false === $container->hasParameter($name)) {
return;
}
foreach ($container->getParameter($name) as $dir) {
$this->createDirectory($dir);
}
} | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"name",
"=",
"Utility",
"::",
"getAliasedName",
"(",
"'dirs'",
")",
";",
"if",
"(",
"false",
"===",
"$",
"container",
"->",
"hasParameter",
"(",
"$",
"name",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/Compiler/DirectoryCompilerPass.php#L37-L46 |
theopera/framework | src/Component/Http/Header/Header.php | Header.createFromString | public static function createFromString(string $string)
{
$string = trim($string);
$parts = explode(': ', $string, 2);
return new Header($parts[0], $parts[1]);
} | php | public static function createFromString(string $string)
{
$string = trim($string);
$parts = explode(': ', $string, 2);
return new Header($parts[0], $parts[1]);
} | [
"public",
"static",
"function",
"createFromString",
"(",
"string",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"trim",
"(",
"$",
"string",
")",
";",
"$",
"parts",
"=",
"explode",
"(",
"': '",
",",
"$",
"string",
",",
"2",
")",
";",
"return",
"new",
... | @param string $string
@return Header | [
"@param",
"string",
"$string"
] | train | https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/Http/Header/Header.php#L100-L106 |
ommu/mod-banner | models/BannerClicks.php | BannerClicks.search | public function search()
{
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria=new CDbCriteria;
// Custom Search
$criteria->with = array(
'banner' => array(
'alias' => 'banner',
'select' => 'publish, cat_id, title'
),
'user' => array(
'al... | php | public function search()
{
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria=new CDbCriteria;
// Custom Search
$criteria->with = array(
'banner' => array(
'alias' => 'banner',
'select' => 'publish, cat_id, title'
),
'user' => array(
'al... | [
"public",
"function",
"search",
"(",
")",
"{",
"// @todo Please modify the following code to remove attributes that should not be searched.",
"$",
"criteria",
"=",
"new",
"CDbCriteria",
";",
"// Custom Search",
"$",
"criteria",
"->",
"with",
"=",
"array",
"(",
"'banner'",
... | Retrieves a list of models based on the current search/filter conditions.
Typical usecase:
- Initialize the model fields with values from filter form.
- Execute this method to get CActiveDataProvider instance which will filter
models according to data in model fields.
- Pass data provider to CGridView, CListView or an... | [
"Retrieves",
"a",
"list",
"of",
"models",
"based",
"on",
"the",
"current",
"search",
"/",
"filter",
"conditions",
"."
] | train | https://github.com/ommu/mod-banner/blob/eb1c9fbb25a0a6be31749d5f32816de87fed8fdf/models/BannerClicks.php#L122-L163 |
ommu/mod-banner | models/BannerClicks.php | BannerClicks.insertClick | public static function insertClick($banner_id)
{
$criteria=new CDbCriteria;
$criteria->select = 'click_id, banner_id, user_id, clicks';
$criteria->compare('banner_id', $banner_id);
if(!Yii::app()->user->isGuest)
$criteria->compare('user_id', Yii::app()->user->id);
else
$criteria->addCondition('user_id ... | php | public static function insertClick($banner_id)
{
$criteria=new CDbCriteria;
$criteria->select = 'click_id, banner_id, user_id, clicks';
$criteria->compare('banner_id', $banner_id);
if(!Yii::app()->user->isGuest)
$criteria->compare('user_id', Yii::app()->user->id);
else
$criteria->addCondition('user_id ... | [
"public",
"static",
"function",
"insertClick",
"(",
"$",
"banner_id",
")",
"{",
"$",
"criteria",
"=",
"new",
"CDbCriteria",
";",
"$",
"criteria",
"->",
"select",
"=",
"'click_id, banner_id, user_id, clicks'",
";",
"$",
"criteria",
"->",
"compare",
"(",
"'banner_... | insertClick | [
"insertClick"
] | train | https://github.com/ommu/mod-banner/blob/eb1c9fbb25a0a6be31749d5f32816de87fed8fdf/models/BannerClicks.php#L251-L270 |
zapheus/zapheus | src/Routing/Dispatcher.php | Dispatcher.dispatch | public function dispatch($method, $uri)
{
$uri = $uri[0] !== '/' ? '/' . $uri : $uri;
if (($result = $this->match($method, $uri)) !== null)
{
list($matches, $route) = (array) $result;
$filtered = array_filter(array_keys($matches), 'is_string');
$flipped... | php | public function dispatch($method, $uri)
{
$uri = $uri[0] !== '/' ? '/' . $uri : $uri;
if (($result = $this->match($method, $uri)) !== null)
{
list($matches, $route) = (array) $result;
$filtered = array_filter(array_keys($matches), 'is_string');
$flipped... | [
"public",
"function",
"dispatch",
"(",
"$",
"method",
",",
"$",
"uri",
")",
"{",
"$",
"uri",
"=",
"$",
"uri",
"[",
"0",
"]",
"!==",
"'/'",
"?",
"'/'",
".",
"$",
"uri",
":",
"$",
"uri",
";",
"if",
"(",
"(",
"$",
"result",
"=",
"$",
"this",
"... | Dispatches against the provided HTTP method verb and URI.
@param string $method
@param string $uri
@return \Zapheus\Routing\RouteInterface
@throws \UnexpectedValueException | [
"Dispatches",
"against",
"the",
"provided",
"HTTP",
"method",
"verb",
"and",
"URI",
"."
] | train | https://github.com/zapheus/zapheus/blob/96618b5cee7d20b6700d0475e4334ae4b5163a6b/src/Routing/Dispatcher.php#L37-L59 |
zapheus/zapheus | src/Routing/Dispatcher.php | Dispatcher.match | protected function match($method, $uri)
{
$result = null;
foreach ((array) $this->router->routes() as $route)
{
$matched = preg_match($route->regex(), $uri, $matches);
if ($matched && $route->method() === $method)
{
return array($matches,... | php | protected function match($method, $uri)
{
$result = null;
foreach ((array) $this->router->routes() as $route)
{
$matched = preg_match($route->regex(), $uri, $matches);
if ($matched && $route->method() === $method)
{
return array($matches,... | [
"protected",
"function",
"match",
"(",
"$",
"method",
",",
"$",
"uri",
")",
"{",
"$",
"result",
"=",
"null",
";",
"foreach",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"router",
"->",
"routes",
"(",
")",
"as",
"$",
"route",
")",
"{",
"$",
"matche... | Matches the route from the parsed URI.
@param string $method
@param string $uri
@return array|null | [
"Matches",
"the",
"route",
"from",
"the",
"parsed",
"URI",
"."
] | train | https://github.com/zapheus/zapheus/blob/96618b5cee7d20b6700d0475e4334ae4b5163a6b/src/Routing/Dispatcher.php#L68-L83 |
spryker/product-measurement-unit-data-import | src/Spryker/Zed/ProductMeasurementUnitDataImport/Business/Model/ProductMeasurementSalesUnitStoreWriterStep.php | ProductMeasurementSalesUnitStoreWriterStep.getIdProductMeasurementSalesUnitByKey | protected function getIdProductMeasurementSalesUnitByKey($productMeasurementSalesUnitKey): int
{
$spyProductMeasurementSalesUnitEntity = SpyProductMeasurementSalesUnitQuery::create()
->findOneByKey($productMeasurementSalesUnitKey);
if (!$spyProductMeasurementSalesUnitEntity) {
... | php | protected function getIdProductMeasurementSalesUnitByKey($productMeasurementSalesUnitKey): int
{
$spyProductMeasurementSalesUnitEntity = SpyProductMeasurementSalesUnitQuery::create()
->findOneByKey($productMeasurementSalesUnitKey);
if (!$spyProductMeasurementSalesUnitEntity) {
... | [
"protected",
"function",
"getIdProductMeasurementSalesUnitByKey",
"(",
"$",
"productMeasurementSalesUnitKey",
")",
":",
"int",
"{",
"$",
"spyProductMeasurementSalesUnitEntity",
"=",
"SpyProductMeasurementSalesUnitQuery",
"::",
"create",
"(",
")",
"->",
"findOneByKey",
"(",
... | @param string $productMeasurementSalesUnitKey
@throws \Spryker\Zed\ProductMeasurementUnitDataImport\Business\Exception\EntityNotFoundException
@return int | [
"@param",
"string",
"$productMeasurementSalesUnitKey"
] | train | https://github.com/spryker/product-measurement-unit-data-import/blob/d9437537a9b72023c310b6d93b566671dec71a8a/src/Spryker/Zed/ProductMeasurementUnitDataImport/Business/Model/ProductMeasurementSalesUnitStoreWriterStep.php#L42-L54 |
spryker/product-measurement-unit-data-import | src/Spryker/Zed/ProductMeasurementUnitDataImport/Business/Model/ProductMeasurementSalesUnitStoreWriterStep.php | ProductMeasurementSalesUnitStoreWriterStep.saveProductMeasurementSalesUnitStore | protected function saveProductMeasurementSalesUnitStore(DataSetInterface $dataSet): void
{
SpyProductMeasurementSalesUnitStoreQuery::create()
->filterByFkProductMeasurementSalesUnit($this->getIdProductMeasurementSalesUnitByKey($dataSet[ProductMeasurementSalesUnitStoreDataSet::COLUMN_SALES_UNIT_K... | php | protected function saveProductMeasurementSalesUnitStore(DataSetInterface $dataSet): void
{
SpyProductMeasurementSalesUnitStoreQuery::create()
->filterByFkProductMeasurementSalesUnit($this->getIdProductMeasurementSalesUnitByKey($dataSet[ProductMeasurementSalesUnitStoreDataSet::COLUMN_SALES_UNIT_K... | [
"protected",
"function",
"saveProductMeasurementSalesUnitStore",
"(",
"DataSetInterface",
"$",
"dataSet",
")",
":",
"void",
"{",
"SpyProductMeasurementSalesUnitStoreQuery",
"::",
"create",
"(",
")",
"->",
"filterByFkProductMeasurementSalesUnit",
"(",
"$",
"this",
"->",
"g... | @param \Spryker\Zed\DataImport\Business\Model\DataSet\DataSetInterface $dataSet
@return void | [
"@param",
"\\",
"Spryker",
"\\",
"Zed",
"\\",
"DataImport",
"\\",
"Business",
"\\",
"Model",
"\\",
"DataSet",
"\\",
"DataSetInterface",
"$dataSet"
] | train | https://github.com/spryker/product-measurement-unit-data-import/blob/d9437537a9b72023c310b6d93b566671dec71a8a/src/Spryker/Zed/ProductMeasurementUnitDataImport/Business/Model/ProductMeasurementSalesUnitStoreWriterStep.php#L85-L92 |
kherge-abandoned/php-service-update | src/lib/Herrera/Service/Update/UpdateServiceProvider.php | UpdateServiceProvider.register | public function register(Container $container)
{
$container['update'] = $container->many(function (
$version,
$major = true,
$pre = false
) use (
$container
){
return $container['update.manager']->update($version, $major, $pre);
... | php | public function register(Container $container)
{
$container['update'] = $container->many(function (
$version,
$major = true,
$pre = false
) use (
$container
){
return $container['update.manager']->update($version, $major, $pre);
... | [
"public",
"function",
"register",
"(",
"Container",
"$",
"container",
")",
"{",
"$",
"container",
"[",
"'update'",
"]",
"=",
"$",
"container",
"->",
"many",
"(",
"function",
"(",
"$",
"version",
",",
"$",
"major",
"=",
"true",
",",
"$",
"pre",
"=",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/kherge-abandoned/php-service-update/blob/2b79d752556dac933063de3a908b254bbea8eec3/src/lib/Herrera/Service/Update/UpdateServiceProvider.php#L20-L43 |
miaoxing/wechat | src/Controller/Wechat.php | Wechat.jsConfigAction | public function jsConfigAction($req)
{
$account = wei()->wechatAccount->getCurrentAccount();
$url = $req['url'] ?: $req->getReferer();
$config = $account->getConfigData([], $url);
$this->response->setHeader('Access-Control-Allow-Origin', '*');
return $this->suc([
... | php | public function jsConfigAction($req)
{
$account = wei()->wechatAccount->getCurrentAccount();
$url = $req['url'] ?: $req->getReferer();
$config = $account->getConfigData([], $url);
$this->response->setHeader('Access-Control-Allow-Origin', '*');
return $this->suc([
... | [
"public",
"function",
"jsConfigAction",
"(",
"$",
"req",
")",
"{",
"$",
"account",
"=",
"wei",
"(",
")",
"->",
"wechatAccount",
"->",
"getCurrentAccount",
"(",
")",
";",
"$",
"url",
"=",
"$",
"req",
"[",
"'url'",
"]",
"?",
":",
"$",
"req",
"->",
"g... | 获取JS-SDK配置
@param Request $req
@return array | [
"获取JS",
"-",
"SDK配置"
] | train | https://github.com/miaoxing/wechat/blob/8620f7788cd0b6b9d20d436cede1f9f2fd24925f/src/Controller/Wechat.php#L196-L207 |
miaoxing/wechat | src/Controller/Wechat.php | Wechat.runComponent | protected function runComponent(WeChatApp $app, WechatAccount $account)
{
$this->logger->info('收到第三方平台通知', $app->getAttrs());
switch ($app->getAttr('InfoType')) {
case 'component_verify_ticket':
$account->save(['verifyTicket' => $app->getAttr('ComponentVerifyTicket')]);
... | php | protected function runComponent(WeChatApp $app, WechatAccount $account)
{
$this->logger->info('收到第三方平台通知', $app->getAttrs());
switch ($app->getAttr('InfoType')) {
case 'component_verify_ticket':
$account->save(['verifyTicket' => $app->getAttr('ComponentVerifyTicket')]);
... | [
"protected",
"function",
"runComponent",
"(",
"WeChatApp",
"$",
"app",
",",
"WechatAccount",
"$",
"account",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"info",
"(",
"'收到第三方平台通知', $app->getAttrs()",
")",
"",
"",
"",
"",
"",
"",
"",
"",
"switch",
"(",
... | 单独处理来自第三方平台的通知
@param WeChatApp $app
@param \Miaoxing\Wechat\Service\WechatAccount $account
@return string | [
"单独处理来自第三方平台的通知"
] | train | https://github.com/miaoxing/wechat/blob/8620f7788cd0b6b9d20d436cede1f9f2fd24925f/src/Controller/Wechat.php#L216-L245 |
SlabPHP/controllers | src/POSTBack.php | POSTBack.requireSubmitValue | protected function requireSubmitValue()
{
if ($this->system->input()->post('submit')) {
echo 'LOOK: ' . $this->system->input()->post('submit') . PHP_EOL;
return;
}
$this->setNotReady("No submit value present.");
} | php | protected function requireSubmitValue()
{
if ($this->system->input()->post('submit')) {
echo 'LOOK: ' . $this->system->input()->post('submit') . PHP_EOL;
return;
}
$this->setNotReady("No submit value present.");
} | [
"protected",
"function",
"requireSubmitValue",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"system",
"->",
"input",
"(",
")",
"->",
"post",
"(",
"'submit'",
")",
")",
"{",
"echo",
"'LOOK: '",
".",
"$",
"this",
"->",
"system",
"->",
"input",
"(",
")"... | Require Submit Value | [
"Require",
"Submit",
"Value"
] | train | https://github.com/SlabPHP/controllers/blob/a1c4fded0265100a85904dd664b972a7f8687652/src/POSTBack.php#L56-L64 |
SlabPHP/controllers | src/POSTBack.php | POSTBack.resolveRedirectRoute | protected function resolveRedirectRoute()
{
if (empty($this->redirectRoute)) return;
$route = $this->system->router()->getRouteByName($this->redirectRoute);
if (empty($route))
{
$this->setNotReady("Unable to find route " . $this->redirectRoute);
return;
... | php | protected function resolveRedirectRoute()
{
if (empty($this->redirectRoute)) return;
$route = $this->system->router()->getRouteByName($this->redirectRoute);
if (empty($route))
{
$this->setNotReady("Unable to find route " . $this->redirectRoute);
return;
... | [
"protected",
"function",
"resolveRedirectRoute",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"redirectRoute",
")",
")",
"return",
";",
"$",
"route",
"=",
"$",
"this",
"->",
"system",
"->",
"router",
"(",
")",
"->",
"getRouteByName",
"(",
... | Resolve redirect route | [
"Resolve",
"redirect",
"route"
] | train | https://github.com/SlabPHP/controllers/blob/a1c4fded0265100a85904dd664b972a7f8687652/src/POSTBack.php#L86-L99 |
intpro/scalar | src/Db/ScalarCMapper.php | ScalarCMapper.getByRef | public function getByRef(ARef $ref, $asUnitMember = false)
{
$ownerType = $ref->getType();
$owner_name = $ownerType->getName();
$rank = $ownerType->getRank();
if($rank === TypeRank::GROUP and $asUnitMember)
{
$selectionUnit = $this->tuner->getSelection($owner_nam... | php | public function getByRef(ARef $ref, $asUnitMember = false)
{
$ownerType = $ref->getType();
$owner_name = $ownerType->getName();
$rank = $ownerType->getRank();
if($rank === TypeRank::GROUP and $asUnitMember)
{
$selectionUnit = $this->tuner->getSelection($owner_nam... | [
"public",
"function",
"getByRef",
"(",
"ARef",
"$",
"ref",
",",
"$",
"asUnitMember",
"=",
"false",
")",
"{",
"$",
"ownerType",
"=",
"$",
"ref",
"->",
"getType",
"(",
")",
";",
"$",
"owner_name",
"=",
"$",
"ownerType",
"->",
"getName",
"(",
")",
";",
... | @param \Interpro\Core\Contracts\Ref\ARef $ref
@param bool $asUnitMember
@return \Interpro\Extractor\Contracts\Collections\MapCCollection | [
"@param",
"\\",
"Interpro",
"\\",
"Core",
"\\",
"Contracts",
"\\",
"Ref",
"\\",
"ARef",
"$ref",
"@param",
"bool",
"$asUnitMember"
] | train | https://github.com/intpro/scalar/blob/de2d8c6e39efc9edf479447d8b2ed265aebe0a8d/src/Db/ScalarCMapper.php#L78-L115 |
Stinger-Soft/PhpCommons | src/StingerSoft/PhpCommons/Formatter/TimeFormatter.php | TimeFormatter.prettyPrintMicroTimeInterval | public static function prettyPrintMicroTimeInterval($startTime, $endTime) {
$seconds = abs($endTime - $startTime);
return sprintf('%02d:%02d:%02d', ($seconds / 3600), ($seconds / 60 % 60), $seconds % 60);
} | php | public static function prettyPrintMicroTimeInterval($startTime, $endTime) {
$seconds = abs($endTime - $startTime);
return sprintf('%02d:%02d:%02d', ($seconds / 3600), ($seconds / 60 % 60), $seconds % 60);
} | [
"public",
"static",
"function",
"prettyPrintMicroTimeInterval",
"(",
"$",
"startTime",
",",
"$",
"endTime",
")",
"{",
"$",
"seconds",
"=",
"abs",
"(",
"$",
"endTime",
"-",
"$",
"startTime",
")",
";",
"return",
"sprintf",
"(",
"'%02d:%02d:%02d'",
",",
"(",
... | Pretty prints an interval specfied by two timestamps
@param float $startTime
Starttime as returned by microtime(true)
@param float $endTime
Endtime as returned by microtime(true)
@param string $locale
Locale used to format the result | [
"Pretty",
"prints",
"an",
"interval",
"specfied",
"by",
"two",
"timestamps"
] | train | https://github.com/Stinger-Soft/PhpCommons/blob/e1d7e2bb7b384fb9182903d3b6138aa3bbd05d9b/src/StingerSoft/PhpCommons/Formatter/TimeFormatter.php#L53-L56 |
Stinger-Soft/PhpCommons | src/StingerSoft/PhpCommons/Formatter/TimeFormatter.php | TimeFormatter.getRelativeTimeDifference | public static function getRelativeTimeDifference($from, $to = null) {
if($from instanceof \DateTime) {
$from = $from->getTimestamp();
} else if(!is_int($from)) {
throw new \InvalidArgumentException('$from must be a \DateTime or an integer!');
}
if($to === null) {
$to = time();
} else if($... | php | public static function getRelativeTimeDifference($from, $to = null) {
if($from instanceof \DateTime) {
$from = $from->getTimestamp();
} else if(!is_int($from)) {
throw new \InvalidArgumentException('$from must be a \DateTime or an integer!');
}
if($to === null) {
$to = time();
} else if($... | [
"public",
"static",
"function",
"getRelativeTimeDifference",
"(",
"$",
"from",
",",
"$",
"to",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"from",
"instanceof",
"\\",
"DateTime",
")",
"{",
"$",
"from",
"=",
"$",
"from",
"->",
"getTimestamp",
"(",
")",
";",
... | Get the relative difference between a given start time and end time.
Depending on the amount of time passed between given from and to, the difference between the two may be
expressed in seconds, hours, days, weeks, months or years.
@param int|\DateTime $from
the start time, either as <code>DateTime</code> object or a... | [
"Get",
"the",
"relative",
"difference",
"between",
"a",
"given",
"start",
"time",
"and",
"end",
"time",
"."
] | train | https://github.com/Stinger-Soft/PhpCommons/blob/e1d7e2bb7b384fb9182903d3b6138aa3bbd05d9b/src/StingerSoft/PhpCommons/Formatter/TimeFormatter.php#L82-L127 |
OpenConext-Attic/OpenConext-engineblock-metadata | src/MetadataRepository/Visitor/DisableDisallowedEntitiesInWayfVisitor.php | DisableDisallowedEntitiesInWayfVisitor.visitIdentityProvider | public function visitIdentityProvider(IdentityProvider $identityProvider)
{
if (in_array($identityProvider->entityId, $this->allowedEntityIds)) {
return;
}
$identityProvider->enabledInWayf = false;
} | php | public function visitIdentityProvider(IdentityProvider $identityProvider)
{
if (in_array($identityProvider->entityId, $this->allowedEntityIds)) {
return;
}
$identityProvider->enabledInWayf = false;
} | [
"public",
"function",
"visitIdentityProvider",
"(",
"IdentityProvider",
"$",
"identityProvider",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"identityProvider",
"->",
"entityId",
",",
"$",
"this",
"->",
"allowedEntityIds",
")",
")",
"{",
"return",
";",
"}",
"$"... | {@inheritdoc} | [
"{"
] | train | https://github.com/OpenConext-Attic/OpenConext-engineblock-metadata/blob/236e2f52ef9cf28e71404544a1c4388f63ee535d/src/MetadataRepository/Visitor/DisableDisallowedEntitiesInWayfVisitor.php#L32-L39 |
makinacorpus/drupal-ulink | src/EntityFinderRegistry.php | EntityFinderRegistry.get | public function get($types)
{
$ret = [];
if (!$types) {
return $ret;
}
if (!is_array($types)) {
$types = [];
}
foreach ($types as $type) {
if (isset($this->instances[$type])) {
$ret = array_merge($ret, $this->inst... | php | public function get($types)
{
$ret = [];
if (!$types) {
return $ret;
}
if (!is_array($types)) {
$types = [];
}
foreach ($types as $type) {
if (isset($this->instances[$type])) {
$ret = array_merge($ret, $this->inst... | [
"public",
"function",
"get",
"(",
"$",
"types",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"$",
"types",
")",
"{",
"return",
"$",
"ret",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"types",
")",
")",
"{",
"$",
"types",
"=... | Get all instances for type(s)
@param string|string[] $types
@return EntityFinderInterface[] | [
"Get",
"all",
"instances",
"for",
"type",
"(",
"s",
")"
] | train | https://github.com/makinacorpus/drupal-ulink/blob/4e1e54b979d72934a6fc0242aae3f12abebf41d0/src/EntityFinderRegistry.php#L29-L48 |
makinacorpus/drupal-ulink | src/EntityFinderRegistry.php | EntityFinderRegistry.all | public function all()
{
$ret = [];
foreach ($this->instances as $instances) {
$ret = array_merge($ret, $instances);
}
return $ret;
} | php | public function all()
{
$ret = [];
foreach ($this->instances as $instances) {
$ret = array_merge($ret, $instances);
}
return $ret;
} | [
"public",
"function",
"all",
"(",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"instances",
"as",
"$",
"instances",
")",
"{",
"$",
"ret",
"=",
"array_merge",
"(",
"$",
"ret",
",",
"$",
"instances",
")",
";",
"}",
... | Get all instances
@return EntityFinderInterface[] | [
"Get",
"all",
"instances"
] | train | https://github.com/makinacorpus/drupal-ulink/blob/4e1e54b979d72934a6fc0242aae3f12abebf41d0/src/EntityFinderRegistry.php#L55-L64 |
kduma-OSS/L5-permissions | Middleware/Permission.php | Permission.handle | public function handle($request, Closure $next, $permissions)
{
if (! empty($permissions) && $this->auth->check()) {
$permissions = explode(':', $permissions);
if ($this->permissionsHelper->can($permissions)) {
return $next($request);
}
retur... | php | public function handle($request, Closure $next, $permissions)
{
if (! empty($permissions) && $this->auth->check()) {
$permissions = explode(':', $permissions);
if ($this->permissionsHelper->can($permissions)) {
return $next($request);
}
retur... | [
"public",
"function",
"handle",
"(",
"$",
"request",
",",
"Closure",
"$",
"next",
",",
"$",
"permissions",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"permissions",
")",
"&&",
"$",
"this",
"->",
"auth",
"->",
"check",
"(",
")",
")",
"{",
"$",
"... | Handle an incoming request.
@param \Illuminate\Http\Request $request
@param \Closure $next
@param $permissions
@return mixed | [
"Handle",
"an",
"incoming",
"request",
"."
] | train | https://github.com/kduma-OSS/L5-permissions/blob/0e11c1dc1dc083f972cef5a52ced664b7390b054/Middleware/Permission.php#L42-L58 |
Vectrex/vxPHP | src/Http/AcceptHeaderItem.php | AcceptHeaderItem.getAttribute | public function getAttribute($name, $default = NULL) {
return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
} | php | public function getAttribute($name, $default = NULL) {
return isset($this->attributes[$name]) ? $this->attributes[$name] : $default;
} | [
"public",
"function",
"getAttribute",
"(",
"$",
"name",
",",
"$",
"default",
"=",
"NULL",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"this",
"->",
"attributes",
"[",
"$",
"name",
"]",
":... | Returns an attribute by its name.
@param string $name
@param mixed $default
@return mixed | [
"Returns",
"an",
"attribute",
"by",
"its",
"name",
"."
] | train | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Http/AcceptHeaderItem.php#L209-L213 |
pryley/castor-framework | src/Services/Validator.php | Validator.validate | public function validate( $data, array $rules = [] )
{
$this->normalizeData( $data );
$this->setRules( $rules );
foreach( $this->rules as $attribute => $rules ) {
foreach( $rules as $rule ) {
$this->validateAttribute( $rule, $attribute );
if( $this->shouldStopValidating( $attribute ))break;
}
}... | php | public function validate( $data, array $rules = [] )
{
$this->normalizeData( $data );
$this->setRules( $rules );
foreach( $this->rules as $attribute => $rules ) {
foreach( $rules as $rule ) {
$this->validateAttribute( $rule, $attribute );
if( $this->shouldStopValidating( $attribute ))break;
}
}... | [
"public",
"function",
"validate",
"(",
"$",
"data",
",",
"array",
"$",
"rules",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"normalizeData",
"(",
"$",
"data",
")",
";",
"$",
"this",
"->",
"setRules",
"(",
"$",
"rules",
")",
";",
"foreach",
"(",
"... | Run the validator's rules against its data.
@param mixed $data
@return array | [
"Run",
"the",
"validator",
"s",
"rules",
"against",
"its",
"data",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L72-L86 |
pryley/castor-framework | src/Services/Validator.php | Validator.addError | protected function addError( $attribute, $rule, array $parameters )
{
$message = $this->getMessage( $attribute, $rule, $parameters );
$this->errors[ $attribute ]['errors'][] = $message;
if( !isset( $this->errors[ $attribute ]['value'] )) {
$this->errors[ $attribute ]['value'] = $this->getValue( $attribute )... | php | protected function addError( $attribute, $rule, array $parameters )
{
$message = $this->getMessage( $attribute, $rule, $parameters );
$this->errors[ $attribute ]['errors'][] = $message;
if( !isset( $this->errors[ $attribute ]['value'] )) {
$this->errors[ $attribute ]['value'] = $this->getValue( $attribute )... | [
"protected",
"function",
"addError",
"(",
"$",
"attribute",
",",
"$",
"rule",
",",
"array",
"$",
"parameters",
")",
"{",
"$",
"message",
"=",
"$",
"this",
"->",
"getMessage",
"(",
"$",
"attribute",
",",
"$",
"rule",
",",
"$",
"parameters",
")",
";",
... | Add an error message to the validator's collection of errors.
@param string $attribute
@param string $rule
@return void | [
"Add",
"an",
"error",
"message",
"to",
"the",
"validator",
"s",
"collection",
"of",
"errors",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L96-L105 |
pryley/castor-framework | src/Services/Validator.php | Validator.addFailure | protected function addFailure( $attribute, $rule, array $parameters )
{
$this->addError( $attribute, $rule, $parameters );
$this->failedRules[ $attribute ][ $rule ] = $parameters;
} | php | protected function addFailure( $attribute, $rule, array $parameters )
{
$this->addError( $attribute, $rule, $parameters );
$this->failedRules[ $attribute ][ $rule ] = $parameters;
} | [
"protected",
"function",
"addFailure",
"(",
"$",
"attribute",
",",
"$",
"rule",
",",
"array",
"$",
"parameters",
")",
"{",
"$",
"this",
"->",
"addError",
"(",
"$",
"attribute",
",",
"$",
"rule",
",",
"$",
"parameters",
")",
";",
"$",
"this",
"->",
"f... | Add a failed rule and error message to the collection.
@param string $attribute
@param string $rule
@return void | [
"Add",
"a",
"failed",
"rule",
"and",
"error",
"message",
"to",
"the",
"collection",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L115-L120 |
pryley/castor-framework | src/Services/Validator.php | Validator.getMessage | protected function getMessage( $attribute, $rule, array $parameters )
{
if( in_array( $rule, $this->sizeRules )) {
return $this->getSizeMessage( $attribute, $rule, $parameters );
}
$lowerRule = $this->snakeCase( $rule );
return $this->translator( $lowerRule, $rule, $attribute, $parameters );
} | php | protected function getMessage( $attribute, $rule, array $parameters )
{
if( in_array( $rule, $this->sizeRules )) {
return $this->getSizeMessage( $attribute, $rule, $parameters );
}
$lowerRule = $this->snakeCase( $rule );
return $this->translator( $lowerRule, $rule, $attribute, $parameters );
} | [
"protected",
"function",
"getMessage",
"(",
"$",
"attribute",
",",
"$",
"rule",
",",
"array",
"$",
"parameters",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"rule",
",",
"$",
"this",
"->",
"sizeRules",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getS... | Get the validation message for an attribute and rule.
@param string $attribute
@param string $rule
@return string|null | [
"Get",
"the",
"validation",
"message",
"for",
"an",
"attribute",
"and",
"rule",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L143-L152 |
pryley/castor-framework | src/Services/Validator.php | Validator.getSizeMessage | protected function getSizeMessage( $attribute, $rule, array $parameters )
{
$lowerRule = $this->snakeCase( $rule );
$type = $this->getAttributeType( $attribute );
$lowerRule .= ".{$type}";
return $this->translator( $lowerRule, $rule, $attribute, $parameters );
} | php | protected function getSizeMessage( $attribute, $rule, array $parameters )
{
$lowerRule = $this->snakeCase( $rule );
$type = $this->getAttributeType( $attribute );
$lowerRule .= ".{$type}";
return $this->translator( $lowerRule, $rule, $attribute, $parameters );
} | [
"protected",
"function",
"getSizeMessage",
"(",
"$",
"attribute",
",",
"$",
"rule",
",",
"array",
"$",
"parameters",
")",
"{",
"$",
"lowerRule",
"=",
"$",
"this",
"->",
"snakeCase",
"(",
"$",
"rule",
")",
";",
"$",
"type",
"=",
"$",
"this",
"->",
"ge... | Get the proper error message for an attribute and size rule.
@param string $attribute
@param string $rule
@return string|null | [
"Get",
"the",
"proper",
"error",
"message",
"for",
"an",
"attribute",
"and",
"size",
"rule",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L207-L215 |
pryley/castor-framework | src/Services/Validator.php | Validator.normalizeData | protected function normalizeData( $data )
{
// If an object was provided, get its public properties
if( is_object( $data )) {
$this->data = get_object_vars( $data );
}
else {
$this->data = $data;
}
return $this;
} | php | protected function normalizeData( $data )
{
// If an object was provided, get its public properties
if( is_object( $data )) {
$this->data = get_object_vars( $data );
}
else {
$this->data = $data;
}
return $this;
} | [
"protected",
"function",
"normalizeData",
"(",
"$",
"data",
")",
"{",
"// If an object was provided, get its public properties",
"if",
"(",
"is_object",
"(",
"$",
"data",
")",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"get_object_vars",
"(",
"$",
"data",
")",
... | Normalize the provided data to an array.
@param mixed $data
@return $this | [
"Normalize",
"the",
"provided",
"data",
"to",
"an",
"array",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L251-L262 |
pryley/castor-framework | src/Services/Validator.php | Validator.parseRule | protected function parseRule( $rule )
{
$parameters = [];
// example: {rule}:{parameters}
if( strpos( $rule, ':' ) !== false ) {
list( $rule, $parameter ) = explode( ':', $rule, 2 );
// example: {parameter1,parameter2,...}
$parameters = $this->parseParameters( $rule, $parameter );
}
$rule = ucwor... | php | protected function parseRule( $rule )
{
$parameters = [];
// example: {rule}:{parameters}
if( strpos( $rule, ':' ) !== false ) {
list( $rule, $parameter ) = explode( ':', $rule, 2 );
// example: {parameter1,parameter2,...}
$parameters = $this->parseParameters( $rule, $parameter );
}
$rule = ucwor... | [
"protected",
"function",
"parseRule",
"(",
"$",
"rule",
")",
"{",
"$",
"parameters",
"=",
"[",
"]",
";",
"// example: {rule}:{parameters}",
"if",
"(",
"strpos",
"(",
"$",
"rule",
",",
"':'",
")",
"!==",
"false",
")",
"{",
"list",
"(",
"$",
"rule",
",",... | Extract the rule name and parameters from a rule.
@param string $rule
@return array | [
"Extract",
"the",
"rule",
"name",
"and",
"parameters",
"from",
"a",
"rule",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L288-L304 |
pryley/castor-framework | src/Services/Validator.php | Validator.setRules | protected function setRules( array $rules )
{
foreach( $rules as $key => $rule ) {
$rules[ $key ] = is_string( $rule ) ? explode( '|', $rule ) : $rule;
}
$this->rules = $rules;
return $this;
} | php | protected function setRules( array $rules )
{
foreach( $rules as $key => $rule ) {
$rules[ $key ] = is_string( $rule ) ? explode( '|', $rule ) : $rule;
}
$this->rules = $rules;
return $this;
} | [
"protected",
"function",
"setRules",
"(",
"array",
"$",
"rules",
")",
"{",
"foreach",
"(",
"$",
"rules",
"as",
"$",
"key",
"=>",
"$",
"rule",
")",
"{",
"$",
"rules",
"[",
"$",
"key",
"]",
"=",
"is_string",
"(",
"$",
"rule",
")",
"?",
"explode",
"... | Set the validation rules.
@return $this | [
"Set",
"the",
"validation",
"rules",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L363-L372 |
pryley/castor-framework | src/Services/Validator.php | Validator.shouldStopValidating | protected function shouldStopValidating( $attribute )
{
return $this->hasRule( $attribute, $this->implicitRules )
&& isset( $this->failedRules[ $attribute ] )
&& array_intersect( array_keys( $this->failedRules[ $attribute ] ), $this->implicitRules );
} | php | protected function shouldStopValidating( $attribute )
{
return $this->hasRule( $attribute, $this->implicitRules )
&& isset( $this->failedRules[ $attribute ] )
&& array_intersect( array_keys( $this->failedRules[ $attribute ] ), $this->implicitRules );
} | [
"protected",
"function",
"shouldStopValidating",
"(",
"$",
"attribute",
")",
"{",
"return",
"$",
"this",
"->",
"hasRule",
"(",
"$",
"attribute",
",",
"$",
"this",
"->",
"implicitRules",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"failedRules",
"[",
"$",
... | Check if we should stop further validations on a given attribute.
@param string $attribute
@return bool | [
"Check",
"if",
"we",
"should",
"stop",
"further",
"validations",
"on",
"a",
"given",
"attribute",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L381-L386 |
pryley/castor-framework | src/Services/Validator.php | Validator.snakeCase | protected function snakeCase( $string )
{
if( !ctype_lower( $string )) {
$string = preg_replace( '/\s+/u', '', $string );
$string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
$string = mb_strtolower( $string, 'UTF-8' );
}
return $string;
} | php | protected function snakeCase( $string )
{
if( !ctype_lower( $string )) {
$string = preg_replace( '/\s+/u', '', $string );
$string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
$string = mb_strtolower( $string, 'UTF-8' );
}
return $string;
} | [
"protected",
"function",
"snakeCase",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"!",
"ctype_lower",
"(",
"$",
"string",
")",
")",
"{",
"$",
"string",
"=",
"preg_replace",
"(",
"'/\\s+/u'",
",",
"''",
",",
"$",
"string",
")",
";",
"$",
"string",
"=",
... | Convert a string to snake case.
@param string $string
@return string | [
"Convert",
"a",
"string",
"to",
"snake",
"case",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L395-L404 |
pryley/castor-framework | src/Services/Validator.php | Validator.translator | protected function translator( $key, $rule, $attribute, array $parameters )
{
$strings = [];//glsr_resolve( 'Strings' )->validation();
$message = isset( $strings[$key] )
? $strings[$key]
: false;
if( !$message )return;
$message = str_replace( ':attribute', $attribute, $message );
if( method_exists(... | php | protected function translator( $key, $rule, $attribute, array $parameters )
{
$strings = [];//glsr_resolve( 'Strings' )->validation();
$message = isset( $strings[$key] )
? $strings[$key]
: false;
if( !$message )return;
$message = str_replace( ':attribute', $attribute, $message );
if( method_exists(... | [
"protected",
"function",
"translator",
"(",
"$",
"key",
",",
"$",
"rule",
",",
"$",
"attribute",
",",
"array",
"$",
"parameters",
")",
"{",
"$",
"strings",
"=",
"[",
"]",
";",
"//glsr_resolve( 'Strings' )->validation();",
"$",
"message",
"=",
"isset",
"(",
... | Returns a translated message for the attribute
@param string $key
@param string $rule
@param string $attribute
@return string|null | [
"Returns",
"a",
"translated",
"message",
"for",
"the",
"attribute"
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L415-L432 |
pryley/castor-framework | src/Services/Validator.php | Validator.validateAccepted | protected function validateAccepted( $value )
{
$acceptable = ['yes', 'on', '1', 1, true, 'true'];
return $this->validateRequired( $value ) && in_array( $value, $acceptable, true );
} | php | protected function validateAccepted( $value )
{
$acceptable = ['yes', 'on', '1', 1, true, 'true'];
return $this->validateRequired( $value ) && in_array( $value, $acceptable, true );
} | [
"protected",
"function",
"validateAccepted",
"(",
"$",
"value",
")",
"{",
"$",
"acceptable",
"=",
"[",
"'yes'",
",",
"'on'",
",",
"'1'",
",",
"1",
",",
"true",
",",
"'true'",
"]",
";",
"return",
"$",
"this",
"->",
"validateRequired",
"(",
"$",
"value",... | Validate that an attribute was "accepted".
This validation rule implies the attribute is "required".
@param mixed $value
@return bool | [
"Validate",
"that",
"an",
"attribute",
"was",
"accepted",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L446-L451 |
pryley/castor-framework | src/Services/Validator.php | Validator.validateAttribute | protected function validateAttribute( $rule, $attribute )
{
list( $rule, $parameters ) = $this->parseRule( $rule );
if( $rule == '' )return;
$method = "validate{$rule}";
if( !method_exists( $this, $method )) {
throw new BadMethodCallException( "Method [$method] does not exist." );
}
if( !$this->$met... | php | protected function validateAttribute( $rule, $attribute )
{
list( $rule, $parameters ) = $this->parseRule( $rule );
if( $rule == '' )return;
$method = "validate{$rule}";
if( !method_exists( $this, $method )) {
throw new BadMethodCallException( "Method [$method] does not exist." );
}
if( !$this->$met... | [
"protected",
"function",
"validateAttribute",
"(",
"$",
"rule",
",",
"$",
"attribute",
")",
"{",
"list",
"(",
"$",
"rule",
",",
"$",
"parameters",
")",
"=",
"$",
"this",
"->",
"parseRule",
"(",
"$",
"rule",
")",
";",
"if",
"(",
"$",
"rule",
"==",
"... | Validate a given attribute against a rule.
@param string $rule
@param string $attribute
@return void
@throws BadMethodCallException | [
"Validate",
"a",
"given",
"attribute",
"against",
"a",
"rule",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L462-L477 |
pryley/castor-framework | src/Services/Validator.php | Validator.validateMin | protected function validateMin( $value, $attribute, array $parameters )
{
$this->requireParameterCount( 1, $parameters, 'min' );
return $this->getSize( $attribute, $value ) >= $parameters[0];
} | php | protected function validateMin( $value, $attribute, array $parameters )
{
$this->requireParameterCount( 1, $parameters, 'min' );
return $this->getSize( $attribute, $value ) >= $parameters[0];
} | [
"protected",
"function",
"validateMin",
"(",
"$",
"value",
",",
"$",
"attribute",
",",
"array",
"$",
"parameters",
")",
"{",
"$",
"this",
"->",
"requireParameterCount",
"(",
"1",
",",
"$",
"parameters",
",",
"'min'",
")",
";",
"return",
"$",
"this",
"->"... | Validate the size of an attribute is greater than a minimum value.
@param mixed $value
@param string $attribute
@return bool | [
"Validate",
"the",
"size",
"of",
"an",
"attribute",
"is",
"greater",
"than",
"a",
"minimum",
"value",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L531-L536 |
pryley/castor-framework | src/Services/Validator.php | Validator.validateRequired | protected function validateRequired( $value )
{
if( is_string( $value )) {
$value = trim( $value );
}
return is_null( $value ) || empty( $value )
? false
: true;
} | php | protected function validateRequired( $value )
{
if( is_string( $value )) {
$value = trim( $value );
}
return is_null( $value ) || empty( $value )
? false
: true;
} | [
"protected",
"function",
"validateRequired",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"trim",
"(",
"$",
"value",
")",
";",
"}",
"return",
"is_null",
"(",
"$",
"value",
")",
"||",
"emp... | Validate that a required attribute exists.
@param mixed $value
@return bool | [
"Validate",
"that",
"a",
"required",
"attribute",
"exists",
"."
] | train | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Validator.php#L557-L565 |
PenoaksDev/Milky-Framework | src/Milky/Http/View/Compilers/Compiler.php | Compiler.getCompiledPath | public function getCompiledPath( $path )
{
$views = Framework::fw()->buildPath( "__views" );
if ( starts_with($path, $views) )
$path = substr( $path, strlen( $views ) + 1 );
if ( !ends_with( $path, '.php' ) )
$path .= '.php';
// $path = substr( $path, 0, strrpos( $path, "." ) );
$path = $this->cach... | php | public function getCompiledPath( $path )
{
$views = Framework::fw()->buildPath( "__views" );
if ( starts_with($path, $views) )
$path = substr( $path, strlen( $views ) + 1 );
if ( !ends_with( $path, '.php' ) )
$path .= '.php';
// $path = substr( $path, 0, strrpos( $path, "." ) );
$path = $this->cach... | [
"public",
"function",
"getCompiledPath",
"(",
"$",
"path",
")",
"{",
"$",
"views",
"=",
"Framework",
"::",
"fw",
"(",
")",
"->",
"buildPath",
"(",
"\"__views\"",
")",
";",
"if",
"(",
"starts_with",
"(",
"$",
"path",
",",
"$",
"views",
")",
")",
"$",
... | Get the path to the compiled version of a view.
@param string $path
@return string | [
"Get",
"the",
"path",
"to",
"the",
"compiled",
"version",
"of",
"a",
"view",
"."
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Http/View/Compilers/Compiler.php#L48-L69 |
PenoaksDev/Milky-Framework | src/Milky/Http/View/Compilers/Compiler.php | Compiler.isExpired | public function isExpired( $path )
{
$compiled = $this->getCompiledPath( $path );
// If the compiled file doesn't exist we will indicate that the view is expired
// so that it can be re-compiled. Else, we will verify the last modification
// of the views is less than the modification times of the compiled vie... | php | public function isExpired( $path )
{
$compiled = $this->getCompiledPath( $path );
// If the compiled file doesn't exist we will indicate that the view is expired
// so that it can be re-compiled. Else, we will verify the last modification
// of the views is less than the modification times of the compiled vie... | [
"public",
"function",
"isExpired",
"(",
"$",
"path",
")",
"{",
"$",
"compiled",
"=",
"$",
"this",
"->",
"getCompiledPath",
"(",
"$",
"path",
")",
";",
"// If the compiled file doesn't exist we will indicate that the view is expired",
"// so that it can be re-compiled. Else,... | Determine if the view at the given path is expired.
@param string $path
@return bool | [
"Determine",
"if",
"the",
"view",
"at",
"the",
"given",
"path",
"is",
"expired",
"."
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Http/View/Compilers/Compiler.php#L77-L92 |
native5/native5-sdk-client-php | src/Native5/UI/ScriptPathResolver.php | ScriptPathResolver.resolve | public static function resolve($name)
{
$logger = $GLOBALS['logger'];
$app = $GLOBALS['app'];
$staticPath = 'public';
if ($app->getConfiguration()->isLocal()) {
$staticPath = 'views';
}
$session = $app->getSessionManager()->getActiv... | php | public static function resolve($name)
{
$logger = $GLOBALS['logger'];
$app = $GLOBALS['app'];
$staticPath = 'public';
if ($app->getConfiguration()->isLocal()) {
$staticPath = 'views';
}
$session = $app->getSessionManager()->getActiv... | [
"public",
"static",
"function",
"resolve",
"(",
"$",
"name",
")",
"{",
"$",
"logger",
"=",
"$",
"GLOBALS",
"[",
"'logger'",
"]",
";",
"$",
"app",
"=",
"$",
"GLOBALS",
"[",
"'app'",
"]",
";",
"$",
"staticPath",
"=",
"'public'",
";",
"if",
"(",
"$",
... | Resolve Script Path based on name.
@param mixed $name Name of the script to resolve.
@access public
@return void | [
"Resolve",
"Script",
"Path",
"based",
"on",
"name",
"."
] | train | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/UI/ScriptPathResolver.php#L55-L95 |
native5/native5-sdk-client-php | src/Native5/UI/ScriptPathResolver.php | ScriptPathResolver.secureLink | public static function secureLink($url)
{
$app = $GLOBALS['app'];
if ($app->getSubject() !== null && $app->getSubject()->isAuthenticated()) {
$separator = '&';
if(!strpos($url, '?')) {
$separator = '?';
}
$url = $url.$separator.'... | php | public static function secureLink($url)
{
$app = $GLOBALS['app'];
if ($app->getSubject() !== null && $app->getSubject()->isAuthenticated()) {
$separator = '&';
if(!strpos($url, '?')) {
$separator = '?';
}
$url = $url.$separator.'... | [
"public",
"static",
"function",
"secureLink",
"(",
"$",
"url",
")",
"{",
"$",
"app",
"=",
"$",
"GLOBALS",
"[",
"'app'",
"]",
";",
"if",
"(",
"$",
"app",
"->",
"getSubject",
"(",
")",
"!==",
"null",
"&&",
"$",
"app",
"->",
"getSubject",
"(",
")",
... | secureLink
@param mixed $url Append nonce to token.
@static
@access public
@return void | [
"secureLink"
] | train | https://github.com/native5/native5-sdk-client-php/blob/e1f598cf27654d81bb5facace1990b737242a2f9/src/Native5/UI/ScriptPathResolver.php#L107-L117 |
jonesiscoding/device | src/DetectDefaults.php | DetectDefaults.getDefaults | public function getDefaults()
{
return array(
'android' => false,
'browser' => self::BROWSER,
'cookies' => ( count( $_COOKIE ) > 0 ) ? true : false,
'height' => self::HEIGHT,
'hidpi' => ( array_key_exists( 'HTTP_DPR', $_SERVER ) ) ? $_SERVER[ 'HTTP_DPR' ] > 1 :... | php | public function getDefaults()
{
return array(
'android' => false,
'browser' => self::BROWSER,
'cookies' => ( count( $_COOKIE ) > 0 ) ? true : false,
'height' => self::HEIGHT,
'hidpi' => ( array_key_exists( 'HTTP_DPR', $_SERVER ) ) ? $_SERVER[ 'HTTP_DPR' ] > 1 :... | [
"public",
"function",
"getDefaults",
"(",
")",
"{",
"return",
"array",
"(",
"'android'",
"=>",
"false",
",",
"'browser'",
"=>",
"self",
"::",
"BROWSER",
",",
"'cookies'",
"=>",
"(",
"count",
"(",
"$",
"_COOKIE",
")",
">",
"0",
")",
"?",
"true",
":",
... | These defaults come from an number of places, including client hints. The only values based on a UA string are
the Android & iOS values.
References:
* https://developers.google.com/web/updates/2015/09/automating-resource-selection-with-client-hints
* http://httpwg.org/http-extensions/client-hints.html
* https://devel... | [
"These",
"defaults",
"come",
"from",
"an",
"number",
"of",
"places",
"including",
"client",
"hints",
".",
"The",
"only",
"values",
"based",
"on",
"a",
"UA",
"string",
"are",
"the",
"Android",
"&",
"iOS",
"values",
"."
] | train | https://github.com/jonesiscoding/device/blob/d3c66f934bcaa8e5e0424cf684c995b1c80cee29/src/DetectDefaults.php#L59-L76 |
jonesiscoding/device | src/DetectDefaults.php | DetectDefaults.getMeteredDefault | private function getMeteredDefault()
{
foreach( self::METERED_HEADERS as $header )
{
if( array_key_exists( $header, $_SERVER ) )
{
return true;
}
}
return false;
} | php | private function getMeteredDefault()
{
foreach( self::METERED_HEADERS as $header )
{
if( array_key_exists( $header, $_SERVER ) )
{
return true;
}
}
return false;
} | [
"private",
"function",
"getMeteredDefault",
"(",
")",
"{",
"foreach",
"(",
"self",
"::",
"METERED_HEADERS",
"as",
"$",
"header",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"header",
",",
"$",
"_SERVER",
")",
")",
"{",
"return",
"true",
";",
"}",
... | Uses potential mobile headers & Google's new 'save-data' header to determine if we have a metered connection.
* Reference for 'save-data': https://developers.google.com/web/updates/2016/02/save-data
@return bool | [
"Uses",
"potential",
"mobile",
"headers",
"&",
"Google",
"s",
"new",
"save",
"-",
"data",
"header",
"to",
"determine",
"if",
"we",
"have",
"a",
"metered",
"connection",
"."
] | train | https://github.com/jonesiscoding/device/blob/d3c66f934bcaa8e5e0424cf684c995b1c80cee29/src/DetectDefaults.php#L85-L96 |
e-commit/EcommitUtilBundle | Command/CompareLocalesCommand.php | CompareLocalesCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$sourceLocale = $input->getArgument('source-locale');
$targetLocale = $input->getArgument('target-locale');
$domain = $input->getOption('domain');
//Config
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new SymfonyStyle($input, $output);
$sourceLocale = $input->getArgument('source-locale');
$targetLocale = $input->getArgument('target-locale');
$domain = $input->getOption('domain');
//Config
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"io",
"=",
"new",
"SymfonyStyle",
"(",
"$",
"input",
",",
"$",
"output",
")",
";",
"$",
"sourceLocale",
"=",
"$",
"input",
"->"... | {@inheritdoc} | [
"{"
] | train | https://github.com/e-commit/EcommitUtilBundle/blob/2ee5ddae7709e8ad4412739cbecda28e0590da8b/Command/CompareLocalesCommand.php#L72-L133 |
e-commit/EcommitUtilBundle | Command/CompareLocalesCommand.php | CompareLocalesCommand.ignoreMissingMessage | protected function ignoreMissingMessage($locale, $domain, $messageId, $config)
{
if (!isset($config['ignore_missing_messages'])) {
return false;
}
if (!isset($config['ignore_missing_messages'][$domain])) {
return false;
}
foreach ([$locale, 'all'] as ... | php | protected function ignoreMissingMessage($locale, $domain, $messageId, $config)
{
if (!isset($config['ignore_missing_messages'])) {
return false;
}
if (!isset($config['ignore_missing_messages'][$domain])) {
return false;
}
foreach ([$locale, 'all'] as ... | [
"protected",
"function",
"ignoreMissingMessage",
"(",
"$",
"locale",
",",
"$",
"domain",
",",
"$",
"messageId",
",",
"$",
"config",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"config",
"[",
"'ignore_missing_messages'",
"]",
")",
")",
"{",
"return",
"fa... | @param string $locale
@param string $domain
@param string $messageId
@param array $config
@return bool | [
"@param",
"string",
"$locale",
"@param",
"string",
"$domain",
"@param",
"string",
"$messageId",
"@param",
"array",
"$config"
] | train | https://github.com/e-commit/EcommitUtilBundle/blob/2ee5ddae7709e8ad4412739cbecda28e0590da8b/Command/CompareLocalesCommand.php#L167-L183 |
PenoaksDev/Milky-Framework | src/Milky/Account/Permissions/PermissionManager.php | PermissionManager.getPermission | public function getPermission( $namespace )
{
$node = Arr::get( $this->cachedPermissions, $namespace . '.__node' );
if ( !$node )
{
$node = new Permission( $this, basename( str_replace( ".", "/", $namespace ) ) );
Arr::set( $this->cachedPermissions, $namespace . '.__node', $node );
}
return $node;
} | php | public function getPermission( $namespace )
{
$node = Arr::get( $this->cachedPermissions, $namespace . '.__node' );
if ( !$node )
{
$node = new Permission( $this, basename( str_replace( ".", "/", $namespace ) ) );
Arr::set( $this->cachedPermissions, $namespace . '.__node', $node );
}
return $node;
} | [
"public",
"function",
"getPermission",
"(",
"$",
"namespace",
")",
"{",
"$",
"node",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"cachedPermissions",
",",
"$",
"namespace",
".",
"'.__node'",
")",
";",
"if",
"(",
"!",
"$",
"node",
")",
"{",
"$",
... | @param $namespace
@return Permission | [
"@param",
"$namespace"
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Account/Permissions/PermissionManager.php#L59-L69 |
PenoaksDev/Milky-Framework | src/Milky/Account/Permissions/PermissionManager.php | PermissionManager.policy | public function policy( Policy $policy )
{
$this->loadedPolicies[] = $policy;
// Caches the policy nodes as a nestable tree
foreach ( $policy->getNodes() as $namespace => $callable )
$this->getPermission( $namespace )->addPolicyMethod( $callable );
} | php | public function policy( Policy $policy )
{
$this->loadedPolicies[] = $policy;
// Caches the policy nodes as a nestable tree
foreach ( $policy->getNodes() as $namespace => $callable )
$this->getPermission( $namespace )->addPolicyMethod( $callable );
} | [
"public",
"function",
"policy",
"(",
"Policy",
"$",
"policy",
")",
"{",
"$",
"this",
"->",
"loadedPolicies",
"[",
"]",
"=",
"$",
"policy",
";",
"// Caches the policy nodes as a nestable tree",
"foreach",
"(",
"$",
"policy",
"->",
"getNodes",
"(",
")",
"as",
... | Adds a new policy checker.
Policies are checked for permissions before they are checked by the general permission backend
@param Policy $policy | [
"Adds",
"a",
"new",
"policy",
"checker",
"."
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Account/Permissions/PermissionManager.php#L78-L85 |
PenoaksDev/Milky-Framework | src/Milky/Account/Permissions/PermissionManager.php | PermissionManager.checkRaw | protected function checkRaw( $namespace, PermissibleEntity $entity = null )
{
if ( $namespace == null || strlen( $namespace ) == 0 || $namespace == "everybody" || $namespace == "-1" )
$namespace = Permission::EVERYBODY;
if ( $namespace == "op" || $namespace == "0" )
$namespace = Permission::OP;
if ( $names... | php | protected function checkRaw( $namespace, PermissibleEntity $entity = null )
{
if ( $namespace == null || strlen( $namespace ) == 0 || $namespace == "everybody" || $namespace == "-1" )
$namespace = Permission::EVERYBODY;
if ( $namespace == "op" || $namespace == "0" )
$namespace = Permission::OP;
if ( $names... | [
"protected",
"function",
"checkRaw",
"(",
"$",
"namespace",
",",
"PermissibleEntity",
"$",
"entity",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"namespace",
"==",
"null",
"||",
"strlen",
"(",
"$",
"namespace",
")",
"==",
"0",
"||",
"$",
"namespace",
"==",
... | Checks a raw singular namespace and returns the unhindered result
@param $namespace
@param PermissibleEntity|null $entity
@return string | [
"Checks",
"a",
"raw",
"singular",
"namespace",
"and",
"returns",
"the",
"unhindered",
"result"
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Account/Permissions/PermissionManager.php#L178-L243 |
PenoaksDev/Milky-Framework | src/Milky/Account/Permissions/PermissionManager.php | PermissionManager.check | public function check( $namespaces, PermissibleModel $model = null, PermissibleEntity $entity = null )
{
// Allows for static calling
$instance = $this ?: self::i();
if ( !is_array( $namespaces ) )
$namespaces = [$namespaces];
foreach ( $namespaces as &$ns )
{
if ( !is_string( $ns ) )
throw new P... | php | public function check( $namespaces, PermissibleModel $model = null, PermissibleEntity $entity = null )
{
// Allows for static calling
$instance = $this ?: self::i();
if ( !is_array( $namespaces ) )
$namespaces = [$namespaces];
foreach ( $namespaces as &$ns )
{
if ( !is_string( $ns ) )
throw new P... | [
"public",
"function",
"check",
"(",
"$",
"namespaces",
",",
"PermissibleModel",
"$",
"model",
"=",
"null",
",",
"PermissibleEntity",
"$",
"entity",
"=",
"null",
")",
"{",
"// Allows for static calling",
"$",
"instance",
"=",
"$",
"this",
"?",
":",
"self",
":... | Checks a permission for assignment and policy checks
@param string|array $namespace
@param PermissibleEntity|null $entity
@return bool | [
"Checks",
"a",
"permission",
"for",
"assignment",
"and",
"policy",
"checks"
] | train | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Account/Permissions/PermissionManager.php#L253-L308 |
danielgp/common-lib | source/DomCssAndJavascriptByDanielGPwithCDN.php | DomCssAndJavascriptByDanielGPwithCDN.setCssFileCDN | protected function setCssFileCDN($cssFileName)
{
$patternFound = null;
if (strpos(pathinfo($cssFileName)['basename'], 'font-awesome-') !== false) {
$patternFound = $this->setCssFileCDNforFontAwesome($cssFileName);
}
if (is_null($patternFound)) {
$patternFound ... | php | protected function setCssFileCDN($cssFileName)
{
$patternFound = null;
if (strpos(pathinfo($cssFileName)['basename'], 'font-awesome-') !== false) {
$patternFound = $this->setCssFileCDNforFontAwesome($cssFileName);
}
if (is_null($patternFound)) {
$patternFound ... | [
"protected",
"function",
"setCssFileCDN",
"(",
"$",
"cssFileName",
")",
"{",
"$",
"patternFound",
"=",
"null",
";",
"if",
"(",
"strpos",
"(",
"pathinfo",
"(",
"$",
"cssFileName",
")",
"[",
"'basename'",
"]",
",",
"'font-awesome-'",
")",
"!==",
"false",
")"... | Manages all known CSS that can be handled through CDNs
@param string $cssFileName
@return array|string | [
"Manages",
"all",
"known",
"CSS",
"that",
"can",
"be",
"handled",
"through",
"CDNs"
] | train | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomCssAndJavascriptByDanielGPwithCDN.php#L78-L88 |
danielgp/common-lib | source/DomCssAndJavascriptByDanielGPwithCDN.php | DomCssAndJavascriptByDanielGPwithCDN.setJavascriptFileCDN | protected function setJavascriptFileCDN($jsFileName)
{
$onlyFileName = pathinfo($jsFileName)['basename'];
$patternFound = null;
if (in_array($onlyFileName, ['jquery.placeholder.min.js', 'jquery.easing.1.3.min.js'])) {
$patternFound = $this->setJavascriptFileCDNjQueryLibs($jsFileN... | php | protected function setJavascriptFileCDN($jsFileName)
{
$onlyFileName = pathinfo($jsFileName)['basename'];
$patternFound = null;
if (in_array($onlyFileName, ['jquery.placeholder.min.js', 'jquery.easing.1.3.min.js'])) {
$patternFound = $this->setJavascriptFileCDNjQueryLibs($jsFileN... | [
"protected",
"function",
"setJavascriptFileCDN",
"(",
"$",
"jsFileName",
")",
"{",
"$",
"onlyFileName",
"=",
"pathinfo",
"(",
"$",
"jsFileName",
")",
"[",
"'basename'",
"]",
";",
"$",
"patternFound",
"=",
"null",
";",
"if",
"(",
"in_array",
"(",
"$",
"only... | Manages all known Javascript that can be handled through CDNs
(if within local network makes no sense to use CDNs)
@param string $jsFileName
@return array|string | [
"Manages",
"all",
"known",
"Javascript",
"that",
"can",
"be",
"handled",
"through",
"CDNs",
"(",
"if",
"within",
"local",
"network",
"makes",
"no",
"sense",
"to",
"use",
"CDNs",
")"
] | train | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomCssAndJavascriptByDanielGPwithCDN.php#L113-L126 |
danielgp/common-lib | source/DomCssAndJavascriptByDanielGPwithCDN.php | DomCssAndJavascriptByDanielGPwithCDN.setJavascriptFileCDNforHighChartsMain | private function setJavascriptFileCDNforHighChartsMain($jsFileName, $libName)
{
$jsFN = $this->sanitizeString($jsFileName);
$jsVersionlessFN = str_replace([$libName . '-', '.js'], '', pathinfo($jsFileName)['basename'])
. ($libName === 'exporting' ? '/modules' : '');
if... | php | private function setJavascriptFileCDNforHighChartsMain($jsFileName, $libName)
{
$jsFN = $this->sanitizeString($jsFileName);
$jsVersionlessFN = str_replace([$libName . '-', '.js'], '', pathinfo($jsFileName)['basename'])
. ($libName === 'exporting' ? '/modules' : '');
if... | [
"private",
"function",
"setJavascriptFileCDNforHighChartsMain",
"(",
"$",
"jsFileName",
",",
"$",
"libName",
")",
"{",
"$",
"jsFN",
"=",
"$",
"this",
"->",
"sanitizeString",
"(",
"$",
"jsFileName",
")",
";",
"$",
"jsVersionlessFN",
"=",
"str_replace",
"(",
"["... | Returns an array with CDN call of a known Javascript library
and fall-back line that points to local cache of it
specific for HighCharts
@param string $jsFileName
@param string $libName
@return array | [
"Returns",
"an",
"array",
"with",
"CDN",
"call",
"of",
"a",
"known",
"Javascript",
"library",
"and",
"fall",
"-",
"back",
"line",
"that",
"points",
"to",
"local",
"cache",
"of",
"it",
"specific",
"for",
"HighCharts"
] | train | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomCssAndJavascriptByDanielGPwithCDN.php#L178-L191 |
danielgp/common-lib | source/DomCssAndJavascriptByDanielGPwithCDN.php | DomCssAndJavascriptByDanielGPwithCDN.setJavascriptFileCDNjQuery | private function setJavascriptFileCDNjQuery($jsFileName)
{
$jQueryPosition = strpos($jsFileName, 'jquery-');
$jQueryMajorVersion = substr($jsFileName, 7, 1);
if (($jQueryPosition !== false) && is_numeric($jQueryMajorVersion) && (substr($jsFileName, -7) == '.min.js')) {
return... | php | private function setJavascriptFileCDNjQuery($jsFileName)
{
$jQueryPosition = strpos($jsFileName, 'jquery-');
$jQueryMajorVersion = substr($jsFileName, 7, 1);
if (($jQueryPosition !== false) && is_numeric($jQueryMajorVersion) && (substr($jsFileName, -7) == '.min.js')) {
return... | [
"private",
"function",
"setJavascriptFileCDNjQuery",
"(",
"$",
"jsFileName",
")",
"{",
"$",
"jQueryPosition",
"=",
"strpos",
"(",
"$",
"jsFileName",
",",
"'jquery-'",
")",
";",
"$",
"jQueryMajorVersion",
"=",
"substr",
"(",
"$",
"jsFileName",
",",
"7",
",",
... | Returns an array with CDN call of a known Javascript library
and fall-back line that points to local cache of it
specific for jQuery
@param string $jsFileName
@return array | [
"Returns",
"an",
"array",
"with",
"CDN",
"call",
"of",
"a",
"known",
"Javascript",
"library",
"and",
"fall",
"-",
"back",
"line",
"that",
"points",
"to",
"local",
"cache",
"of",
"it",
"specific",
"for",
"jQuery"
] | train | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomCssAndJavascriptByDanielGPwithCDN.php#L201-L214 |
danielgp/common-lib | source/DomCssAndJavascriptByDanielGPwithCDN.php | DomCssAndJavascriptByDanielGPwithCDN.setJavascriptFileCDNjQueryLibs | private function setJavascriptFileCDNjQueryLibs($jsFileName)
{
$sFN = $this->sanitizeString($jsFileName);
$eArray = $this->knownCloudFlareJavascript($sFN);
if (!is_null($eArray['version'])) {
return [
true,
$this->sCloundFlareUrl . $eArray['vers... | php | private function setJavascriptFileCDNjQueryLibs($jsFileName)
{
$sFN = $this->sanitizeString($jsFileName);
$eArray = $this->knownCloudFlareJavascript($sFN);
if (!is_null($eArray['version'])) {
return [
true,
$this->sCloundFlareUrl . $eArray['vers... | [
"private",
"function",
"setJavascriptFileCDNjQueryLibs",
"(",
"$",
"jsFileName",
")",
"{",
"$",
"sFN",
"=",
"$",
"this",
"->",
"sanitizeString",
"(",
"$",
"jsFileName",
")",
";",
"$",
"eArray",
"=",
"$",
"this",
"->",
"knownCloudFlareJavascript",
"(",
"$",
"... | Returns an array with CDN call of a known Javascript library
and fall-back line that points to local cache of it
specific for jQuery Libraries
@param string $jsFileName
@return array | [
"Returns",
"an",
"array",
"with",
"CDN",
"call",
"of",
"a",
"known",
"Javascript",
"library",
"and",
"fall",
"-",
"back",
"line",
"that",
"points",
"to",
"local",
"cache",
"of",
"it",
"specific",
"for",
"jQuery",
"Libraries"
] | train | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/DomCssAndJavascriptByDanielGPwithCDN.php#L224-L237 |
SysControllers/Admin | src/app/Http/Controllers/Admin/UsersController.php | UsersController.store | public function store(Request $request)
{
$dataProfile = $request->only('nombres', 'apellidos');
$dataUser = $request->only('email', 'password');
$this->validate($request, $this->rulesProfile);
$this->validate($request, $this->rulesUser);
$user = new User($dataUser);
$... | php | public function store(Request $request)
{
$dataProfile = $request->only('nombres', 'apellidos');
$dataUser = $request->only('email', 'password');
$this->validate($request, $this->rulesProfile);
$this->validate($request, $this->rulesUser);
$user = new User($dataUser);
$... | [
"public",
"function",
"store",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"dataProfile",
"=",
"$",
"request",
"->",
"only",
"(",
"'nombres'",
",",
"'apellidos'",
")",
";",
"$",
"dataUser",
"=",
"$",
"request",
"->",
"only",
"(",
"'email'",
",",
"'p... | Store a newly created resource in storage.
@param Request $request
@return Response | [
"Store",
"a",
"newly",
"created",
"resource",
"in",
"storage",
"."
] | train | https://github.com/SysControllers/Admin/blob/8f1df46aca422b87f2f522fbba610dcfa0c5f7f3/src/app/Http/Controllers/Admin/UsersController.php#L66-L87 |
SysControllers/Admin | src/app/Http/Controllers/Admin/UsersController.php | UsersController.update | public function update($id, Request $request)
{
$user = UserProfile::whereUserId($id)->first();
$rules = [
'nombre' => 'required',
'apellidos' => 'required'
];
$this->validate($request, $rules);
$user->fill($request->all());
$user->save();
... | php | public function update($id, Request $request)
{
$user = UserProfile::whereUserId($id)->first();
$rules = [
'nombre' => 'required',
'apellidos' => 'required'
];
$this->validate($request, $rules);
$user->fill($request->all());
$user->save();
... | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"UserProfile",
"::",
"whereUserId",
"(",
"$",
"id",
")",
"->",
"first",
"(",
")",
";",
"$",
"rules",
"=",
"[",
"'nombre'",
"=>",
"'required'",... | Update the specified resource in storage.
@param int $id
@return Response | [
"Update",
"the",
"specified",
"resource",
"in",
"storage",
"."
] | train | https://github.com/SysControllers/Admin/blob/8f1df46aca422b87f2f522fbba610dcfa0c5f7f3/src/app/Http/Controllers/Admin/UsersController.php#L124-L143 |
SysControllers/Admin | src/app/Http/Controllers/Admin/UsersController.php | UsersController.updatePassword | public function updatePassword($id, Request $request)
{
$user = User::findOrFail($id);
$rules = [
'password' => 'required|confirmed',
'password_confirmation' => 'required'
];
$this->validate($request, $rules);
$user->fill($request->all());
$... | php | public function updatePassword($id, Request $request)
{
$user = User::findOrFail($id);
$rules = [
'password' => 'required|confirmed',
'password_confirmation' => 'required'
];
$this->validate($request, $rules);
$user->fill($request->all());
$... | [
"public",
"function",
"updatePassword",
"(",
"$",
"id",
",",
"Request",
"$",
"request",
")",
"{",
"$",
"user",
"=",
"User",
"::",
"findOrFail",
"(",
"$",
"id",
")",
";",
"$",
"rules",
"=",
"[",
"'password'",
"=>",
"'required|confirmed'",
",",
"'password_... | Funcion para cambiar contraseña de Perfil de usuario logeado | [
"Funcion",
"para",
"cambiar",
"contraseña",
"de",
"Perfil",
"de",
"usuario",
"logeado"
] | train | https://github.com/SysControllers/Admin/blob/8f1df46aca422b87f2f522fbba610dcfa0c5f7f3/src/app/Http/Controllers/Admin/UsersController.php#L148-L167 |
SysControllers/Admin | src/app/Http/Controllers/Admin/UsersController.php | UsersController.profileData | public function profileData()
{
$user = Auth::user();
$profile = UserProfile::whereUserId($user->id)->first();
$data = Input::all();
$rules = [
'nombre' => 'required',
'apellidos' => 'required'
];
$validator = Validator::make($data, $rules)... | php | public function profileData()
{
$user = Auth::user();
$profile = UserProfile::whereUserId($user->id)->first();
$data = Input::all();
$rules = [
'nombre' => 'required',
'apellidos' => 'required'
];
$validator = Validator::make($data, $rules)... | [
"public",
"function",
"profileData",
"(",
")",
"{",
"$",
"user",
"=",
"Auth",
"::",
"user",
"(",
")",
";",
"$",
"profile",
"=",
"UserProfile",
"::",
"whereUserId",
"(",
"$",
"user",
"->",
"id",
")",
"->",
"first",
"(",
")",
";",
"$",
"data",
"=",
... | Funcion para cambiar datos de Perfil de usuario logeado | [
"Funcion",
"para",
"cambiar",
"datos",
"de",
"Perfil",
"de",
"usuario",
"logeado"
] | train | https://github.com/SysControllers/Admin/blob/8f1df46aca422b87f2f522fbba610dcfa0c5f7f3/src/app/Http/Controllers/Admin/UsersController.php#L197-L224 |
SysControllers/Admin | src/app/Http/Controllers/Admin/UsersController.php | UsersController.profileChangePassword | public function profileChangePassword()
{
$user = Auth::user();
$data = Input::all();
$rules = [
'password' => 'required|confirmed',
'password_confirmation' => 'required'
];
$validator = Validator::make($data, $rules);
if($validator->passes... | php | public function profileChangePassword()
{
$user = Auth::user();
$data = Input::all();
$rules = [
'password' => 'required|confirmed',
'password_confirmation' => 'required'
];
$validator = Validator::make($data, $rules);
if($validator->passes... | [
"public",
"function",
"profileChangePassword",
"(",
")",
"{",
"$",
"user",
"=",
"Auth",
"::",
"user",
"(",
")",
";",
"$",
"data",
"=",
"Input",
"::",
"all",
"(",
")",
";",
"$",
"rules",
"=",
"[",
"'password'",
"=>",
"'required|confirmed'",
",",
"'passw... | Funcion para cambiar contraseña de Perfil de usuario logeado | [
"Funcion",
"para",
"cambiar",
"contraseña",
"de",
"Perfil",
"de",
"usuario",
"logeado"
] | train | https://github.com/SysControllers/Admin/blob/8f1df46aca422b87f2f522fbba610dcfa0c5f7f3/src/app/Http/Controllers/Admin/UsersController.php#L230-L255 |
koolkode/lexer | src/AbstractTokenSequence.php | AbstractTokenSequence.contains | public function contains($type)
{
foreach($this->tokens as $token)
{
if($token->is($type))
{
return true;
}
}
return false;
} | php | public function contains($type)
{
foreach($this->tokens as $token)
{
if($token->is($type))
{
return true;
}
}
return false;
} | [
"public",
"function",
"contains",
"(",
"$",
"type",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"tokens",
"as",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"token",
"->",
"is",
"(",
"$",
"type",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"ret... | Check if the sequence contains at least one token of the given type.
@param integer $type
@return boolean | [
"Check",
"if",
"the",
"sequence",
"contains",
"at",
"least",
"one",
"token",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/koolkode/lexer/blob/1f33fb4e95bf3b6b21c63187e503bbe612a1646c/src/AbstractTokenSequence.php#L42-L53 |
koolkode/lexer | src/AbstractTokenSequence.php | AbstractTokenSequence.containsOneOf | public function containsOneOf(array $types)
{
foreach($this->tokens as $token)
{
if($token->isOneOf($types))
{
return true;
}
}
return false;
} | php | public function containsOneOf(array $types)
{
foreach($this->tokens as $token)
{
if($token->isOneOf($types))
{
return true;
}
}
return false;
} | [
"public",
"function",
"containsOneOf",
"(",
"array",
"$",
"types",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"tokens",
"as",
"$",
"token",
")",
"{",
"if",
"(",
"$",
"token",
"->",
"isOneOf",
"(",
"$",
"types",
")",
")",
"{",
"return",
"true",
";... | Check if the sequence contains at least one token of any of the given token types.
@param array<integer> $types
@return boolean | [
"Check",
"if",
"the",
"sequence",
"contains",
"at",
"least",
"one",
"token",
"of",
"any",
"of",
"the",
"given",
"token",
"types",
"."
] | train | https://github.com/koolkode/lexer/blob/1f33fb4e95bf3b6b21c63187e503bbe612a1646c/src/AbstractTokenSequence.php#L61-L72 |
koolkode/lexer | src/AbstractTokenSequence.php | AbstractTokenSequence.endsWith | public function endsWith($type)
{
if(empty($this->tokens))
{
return false;
}
return $this->tokens[count($this->tokens) - 1]->is($type);
} | php | public function endsWith($type)
{
if(empty($this->tokens))
{
return false;
}
return $this->tokens[count($this->tokens) - 1]->is($type);
} | [
"public",
"function",
"endsWith",
"(",
"$",
"type",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"tokens",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"tokens",
"[",
"count",
"(",
"$",
"this",
"->",
"tokens",
... | Check if the sequence ends with a token of the given token type.
@param integer $type
@return boolean | [
"Check",
"if",
"the",
"sequence",
"ends",
"with",
"a",
"token",
"of",
"the",
"given",
"token",
"type",
"."
] | train | https://github.com/koolkode/lexer/blob/1f33fb4e95bf3b6b21c63187e503bbe612a1646c/src/AbstractTokenSequence.php#L80-L88 |
koolkode/http | src/HttpResponse.php | HttpResponse.setStatus | public function setStatus($status)
{
$status = (int)$status;
if($status < 100)
{
throw new \InvalidArgumentException(sprintf('Invalid HTTP status code: %u', $status));
}
if($status >= 600)
{
throw new \InvalidArgumentException(sprintf('Invalid HTTP status code: %u', $status));
}
$this->... | php | public function setStatus($status)
{
$status = (int)$status;
if($status < 100)
{
throw new \InvalidArgumentException(sprintf('Invalid HTTP status code: %u', $status));
}
if($status >= 600)
{
throw new \InvalidArgumentException(sprintf('Invalid HTTP status code: %u', $status));
}
$this->... | [
"public",
"function",
"setStatus",
"(",
"$",
"status",
")",
"{",
"$",
"status",
"=",
"(",
"int",
")",
"$",
"status",
";",
"if",
"(",
"$",
"status",
"<",
"100",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Invalid H... | Set the HTTP status of this response.
@param integer $status
@return HttpResponse
@throws \InvalidArgumentException | [
"Set",
"the",
"HTTP",
"status",
"of",
"this",
"response",
"."
] | train | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpResponse.php#L82-L99 |
koolkode/http | src/HttpResponse.php | HttpResponse.removeCookie | public function removeCookie($name)
{
$cookie = new SetCookieHeader($name, '');
$cookie->setExpires(1337);
$this->addHeader($cookie);
return $this;
} | php | public function removeCookie($name)
{
$cookie = new SetCookieHeader($name, '');
$cookie->setExpires(1337);
$this->addHeader($cookie);
return $this;
} | [
"public",
"function",
"removeCookie",
"(",
"$",
"name",
")",
"{",
"$",
"cookie",
"=",
"new",
"SetCookieHeader",
"(",
"$",
"name",
",",
"''",
")",
";",
"$",
"cookie",
"->",
"setExpires",
"(",
"1337",
")",
";",
"$",
"this",
"->",
"addHeader",
"(",
"$",... | Remove a cookie by eliminating a Set-Cookie header for this cookie replacing it with a
header that will cause the client to remove the cookie.
@param string $name Name of the cookie to be removed.
@return HttpResponse | [
"Remove",
"a",
"cookie",
"by",
"eliminating",
"a",
"Set",
"-",
"Cookie",
"header",
"for",
"this",
"cookie",
"replacing",
"it",
"with",
"a",
"header",
"that",
"will",
"cause",
"the",
"client",
"to",
"remove",
"the",
"cookie",
"."
] | train | https://github.com/koolkode/http/blob/3c1626d409d5ce5d71d26f0e8f31ae3683a2a966/src/HttpResponse.php#L194-L202 |
shrink0r/monatic | src/Attempt.php | Attempt.get | public function get(callable $codeBlock = null)
{
if (!$this->result) {
$this->result = $this->run(new Success);
}
if ($this->result instanceof Success) {
return is_callable($codeBlock) ? $codeBlock($this->result) : $this->result;
}
return $this->res... | php | public function get(callable $codeBlock = null)
{
if (!$this->result) {
$this->result = $this->run(new Success);
}
if ($this->result instanceof Success) {
return is_callable($codeBlock) ? $codeBlock($this->result) : $this->result;
}
return $this->res... | [
"public",
"function",
"get",
"(",
"callable",
"$",
"codeBlock",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"result",
")",
"{",
"$",
"this",
"->",
"result",
"=",
"$",
"this",
"->",
"run",
"(",
"new",
"Success",
")",
";",
"}",
"if",
... | Returns the result of the code-block execution attempt.
@param callable $codeBlock Is never executed for this type.
@return null | [
"Returns",
"the",
"result",
"of",
"the",
"code",
"-",
"block",
"execution",
"attempt",
"."
] | train | https://github.com/shrink0r/monatic/blob/f39b8b2ef68a397d31d844341487412b335fd107/src/Attempt.php#L38-L49 |
shrink0r/monatic | src/Attempt.php | Attempt.bind | public function bind(callable $codeBlock)
{
return static::unit(function ($result) use ($codeBlock) {
$result = $this->run($result);
if ($result instanceof Success) {
return $codeBlock($result);
} else {
return $result;
}
... | php | public function bind(callable $codeBlock)
{
return static::unit(function ($result) use ($codeBlock) {
$result = $this->run($result);
if ($result instanceof Success) {
return $codeBlock($result);
} else {
return $result;
}
... | [
"public",
"function",
"bind",
"(",
"callable",
"$",
"codeBlock",
")",
"{",
"return",
"static",
"::",
"unit",
"(",
"function",
"(",
"$",
"result",
")",
"use",
"(",
"$",
"codeBlock",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"run",
"(",
"$",
"... | Returns a new Attempt monad that is bound to the given code-block.
@param callable $codeBlock
@return Attempt | [
"Returns",
"a",
"new",
"Attempt",
"monad",
"that",
"is",
"bound",
"to",
"the",
"given",
"code",
"-",
"block",
"."
] | train | https://github.com/shrink0r/monatic/blob/f39b8b2ef68a397d31d844341487412b335fd107/src/Attempt.php#L58-L68 |
shrink0r/monatic | src/Attempt.php | Attempt.run | protected function run(MonadInterface $prevResult, callable $next = null)
{
try {
$result = call_user_func($this->codeBlock, $prevResult);
return ($result instanceof MonadInterface) ? $result : Success::unit($result);
} catch (Exception $error) {
return Error::uni... | php | protected function run(MonadInterface $prevResult, callable $next = null)
{
try {
$result = call_user_func($this->codeBlock, $prevResult);
return ($result instanceof MonadInterface) ? $result : Success::unit($result);
} catch (Exception $error) {
return Error::uni... | [
"protected",
"function",
"run",
"(",
"MonadInterface",
"$",
"prevResult",
",",
"callable",
"$",
"next",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"result",
"=",
"call_user_func",
"(",
"$",
"this",
"->",
"codeBlock",
",",
"$",
"prevResult",
")",
";",
"retur... | Runs the monad's code-block.
@param MonadInterface $prevResult
@param callable $next
@return MonadInterface Either Success or Error in case an exception occured. | [
"Runs",
"the",
"monad",
"s",
"code",
"-",
"block",
"."
] | train | https://github.com/shrink0r/monatic/blob/f39b8b2ef68a397d31d844341487412b335fd107/src/Attempt.php#L89-L97 |
ciims/ciims-modules-install | models/UserForm.php | UserForm.validateForm | public function validateForm()
{
// Validates the model
if ($this->validate())
{
// Getters and setters don't work in CFormModel? So set them manually
$this->encryptionKey = $this->getEncryptionKey();
$this->encryptedPassword = $this->getEncrypte... | php | public function validateForm()
{
// Validates the model
if ($this->validate())
{
// Getters and setters don't work in CFormModel? So set them manually
$this->encryptionKey = $this->getEncryptionKey();
$this->encryptedPassword = $this->getEncrypte... | [
"public",
"function",
"validateForm",
"(",
")",
"{",
"// Validates the model",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
")",
")",
"{",
"// Getters and setters don't work in CFormModel? So set them manually",
"$",
"this",
"->",
"encryptionKey",
"=",
"$",
"this",
... | Validates the model, and provides the encrypted data stream for hashing
@return bool If the model validated or not | [
"Validates",
"the",
"model",
"and",
"provides",
"the",
"encrypted",
"data",
"stream",
"for",
"hashing"
] | train | https://github.com/ciims/ciims-modules-install/blob/54d6a93e5c42c2d98e19de38a90e27f77358e88b/models/UserForm.php#L90-L102 |
ciims/ciims-modules-install | models/UserForm.php | UserForm.save | public function save()
{
if (!$this->validateForm())
return false;
try
{
// Store some data in session temporarily
Yii::app()->session['encryptionKey'] = $this->encryptionKey;
Yii::app()->session['siteName'] = $this->siteNam... | php | public function save()
{
if (!$this->validateForm())
return false;
try
{
// Store some data in session temporarily
Yii::app()->session['encryptionKey'] = $this->encryptionKey;
Yii::app()->session['siteName'] = $this->siteNam... | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"validateForm",
"(",
")",
")",
"return",
"false",
";",
"try",
"{",
"// Store some data in session temporarily",
"Yii",
"::",
"app",
"(",
")",
"->",
"session",
"[",
"'encryption... | This method will save the admin user into the database, | [
"This",
"method",
"will",
"save",
"the",
"admin",
"user",
"into",
"the",
"database"
] | train | https://github.com/ciims/ciims-modules-install/blob/54d6a93e5c42c2d98e19de38a90e27f77358e88b/models/UserForm.php#L107-L136 |
ciims/ciims-modules-install | models/UserForm.php | UserForm.checkConfigDir | public function checkConfigDir()
{
if (is_writable(dirname(__FILE__) . '/../../../config'))
return true;
$this->addError('isConfigDirWritable', Yii::t('Install.main','Configuration directory is not writable. This must be corrected before your settings can be applied.'));
... | php | public function checkConfigDir()
{
if (is_writable(dirname(__FILE__) . '/../../../config'))
return true;
$this->addError('isConfigDirWritable', Yii::t('Install.main','Configuration directory is not writable. This must be corrected before your settings can be applied.'));
... | [
"public",
"function",
"checkConfigDir",
"(",
")",
"{",
"if",
"(",
"is_writable",
"(",
"dirname",
"(",
"__FILE__",
")",
".",
"'/../../../config'",
")",
")",
"return",
"true",
";",
"$",
"this",
"->",
"addError",
"(",
"'isConfigDirWritable'",
",",
"Yii",
"::",
... | Validator for checkConfigDir | [
"Validator",
"for",
"checkConfigDir"
] | train | https://github.com/ciims/ciims-modules-install/blob/54d6a93e5c42c2d98e19de38a90e27f77358e88b/models/UserForm.php#L141-L148 |
DeimosProject/Helper | src/Helper/Helpers/Send.php | Send.http_build_query_develop | protected function http_build_query_develop($data)
{
if (!is_array($data))
{
return $data;
}
foreach ($data as $key => $val)
{
if (is_array($val))
{
foreach ($val as $k => $v)
{
if (is_arr... | php | protected function http_build_query_develop($data)
{
if (!is_array($data))
{
return $data;
}
foreach ($data as $key => $val)
{
if (is_array($val))
{
foreach ($val as $k => $v)
{
if (is_arr... | [
"protected",
"function",
"http_build_query_develop",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"return",
"$",
"data",
";",
"}",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{"... | patch for CURL bug
@link https://bugs.php.net/bug.php?id=67477
@param $data
@return array | [
"patch",
"for",
"CURL",
"bug",
"@link",
"https",
":",
"//",
"bugs",
".",
"php",
".",
"net",
"/",
"bug",
".",
"php?id",
"=",
"67477"
] | train | https://github.com/DeimosProject/Helper/blob/39c67de21a87c7c6391b2f98416063f41c94e26f/src/Helper/Helpers/Send.php#L88-L115 |
DeimosProject/Helper | src/Helper/Helpers/Send.php | Send.exec | public function exec()
{
$this->build();
$data = curl_exec($this->ch);
if(curl_errno($this->ch))
{
throw new CurlError(curl_error($this->ch));
}
curl_close($this->ch);
return $data;
} | php | public function exec()
{
$this->build();
$data = curl_exec($this->ch);
if(curl_errno($this->ch))
{
throw new CurlError(curl_error($this->ch));
}
curl_close($this->ch);
return $data;
} | [
"public",
"function",
"exec",
"(",
")",
"{",
"$",
"this",
"->",
"build",
"(",
")",
";",
"$",
"data",
"=",
"curl_exec",
"(",
"$",
"this",
"->",
"ch",
")",
";",
"if",
"(",
"curl_errno",
"(",
"$",
"this",
"->",
"ch",
")",
")",
"{",
"throw",
"new",... | @return mixed
@throws CurlError | [
"@return",
"mixed"
] | train | https://github.com/DeimosProject/Helper/blob/39c67de21a87c7c6391b2f98416063f41c94e26f/src/Helper/Helpers/Send.php#L229-L243 |
DeimosProject/Helper | src/Helper/Helpers/Send.php | Send.httpAuth | public function httpAuth($user, $password)
{
curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($this->ch, CURLOPT_USERPWD, "$user:$password");
return $this;
} | php | public function httpAuth($user, $password)
{
curl_setopt($this->ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($this->ch, CURLOPT_USERPWD, "$user:$password");
return $this;
} | [
"public",
"function",
"httpAuth",
"(",
"$",
"user",
",",
"$",
"password",
")",
"{",
"curl_setopt",
"(",
"$",
"this",
"->",
"ch",
",",
"CURLOPT_HTTPAUTH",
",",
"CURLAUTH_BASIC",
")",
";",
"curl_setopt",
"(",
"$",
"this",
"->",
"ch",
",",
"CURLOPT_USERPWD",
... | @param string $user
@param string $password
@return $this | [
"@param",
"string",
"$user",
"@param",
"string",
"$password"
] | train | https://github.com/DeimosProject/Helper/blob/39c67de21a87c7c6391b2f98416063f41c94e26f/src/Helper/Helpers/Send.php#L268-L274 |
Stinger-Soft/TwigExtensions | src/StingerSoft/TwigExtensions/PrettyPrintExtensions.php | PrettyPrintExtensions.humanizeFileSizeFilter | public function humanizeFileSizeFilter($size, $precision = 2, $si = false, $locale = 'en') {
return ByteFormatter::prettyPrintSize($size, $precision, $si, $locale);
} | php | public function humanizeFileSizeFilter($size, $precision = 2, $si = false, $locale = 'en') {
return ByteFormatter::prettyPrintSize($size, $precision, $si, $locale);
} | [
"public",
"function",
"humanizeFileSizeFilter",
"(",
"$",
"size",
",",
"$",
"precision",
"=",
"2",
",",
"$",
"si",
"=",
"false",
",",
"$",
"locale",
"=",
"'en'",
")",
"{",
"return",
"ByteFormatter",
"::",
"prettyPrintSize",
"(",
"$",
"size",
",",
"$",
... | Pretty prints a given memory size
@see ByteFormatter @codeCoverageIgnore
@param integer $size
The memory size in bytes
@param boolean $si
Use SI prefixes?
@param string $locale
Locale used to format the result
@return string A pretty printed memory size | [
"Pretty",
"prints",
"a",
"given",
"memory",
"size"
] | train | https://github.com/Stinger-Soft/TwigExtensions/blob/7bfce337b0dd33106e22f80b221338451a02d7c5/src/StingerSoft/TwigExtensions/PrettyPrintExtensions.php#L66-L68 |
Stinger-Soft/TwigExtensions | src/StingerSoft/TwigExtensions/PrettyPrintExtensions.php | PrettyPrintExtensions.humanizeTimeDiffFilter | public function humanizeTimeDiffFilter($from, $to = null) {
$diff = TimeFormatter::getRelativeTimeDifference($from, $to);
$since = null;
switch($diff[1]) {
case TimeFormatter::UNIT_SECONDS:
$since = $this->translator->transChoice('stinger_soft.twig_extensions.pretty_print.time.seconds', $diff[0], array(
... | php | public function humanizeTimeDiffFilter($from, $to = null) {
$diff = TimeFormatter::getRelativeTimeDifference($from, $to);
$since = null;
switch($diff[1]) {
case TimeFormatter::UNIT_SECONDS:
$since = $this->translator->transChoice('stinger_soft.twig_extensions.pretty_print.time.seconds', $diff[0], array(
... | [
"public",
"function",
"humanizeTimeDiffFilter",
"(",
"$",
"from",
",",
"$",
"to",
"=",
"null",
")",
"{",
"$",
"diff",
"=",
"TimeFormatter",
"::",
"getRelativeTimeDifference",
"(",
"$",
"from",
",",
"$",
"to",
")",
";",
"$",
"since",
"=",
"null",
";",
"... | Get the relative difference between a given start time and end time.
Depending on the amount of time passed between given from and to, the difference between the two may be
expressed in seconds, hours, days, weeks, months or years.
@see TimeFormatter
@param int|\DateTime $from
the start time, either as <code>DateTim... | [
"Get",
"the",
"relative",
"difference",
"between",
"a",
"given",
"start",
"time",
"and",
"end",
"time",
"."
] | train | https://github.com/Stinger-Soft/TwigExtensions/blob/7bfce337b0dd33106e22f80b221338451a02d7c5/src/StingerSoft/TwigExtensions/PrettyPrintExtensions.php#L86-L129 |
frodosghost/AtomLoggerBundle | Connection/Request.php | Request.formatData | public function formatData()
{
$this->formatter->addData($this->data);
try {
$formatted = $this->formatter->format();
} catch (DataException $e) {
throw new FormattingException('The provided data has been incorrectly formatted.');
}
return $formatted... | php | public function formatData()
{
$this->formatter->addData($this->data);
try {
$formatted = $this->formatter->format();
} catch (DataException $e) {
throw new FormattingException('The provided data has been incorrectly formatted.');
}
return $formatted... | [
"public",
"function",
"formatData",
"(",
")",
"{",
"$",
"this",
"->",
"formatter",
"->",
"addData",
"(",
"$",
"this",
"->",
"data",
")",
";",
"try",
"{",
"$",
"formatted",
"=",
"$",
"this",
"->",
"formatter",
"->",
"format",
"(",
")",
";",
"}",
"ca... | Calls the Formatter with the data passed into the Request
@return string | [
"Calls",
"the",
"Formatter",
"with",
"the",
"data",
"passed",
"into",
"the",
"Request"
] | train | https://github.com/frodosghost/AtomLoggerBundle/blob/c48823e4b3772e498b366867f27e6581f613f733/Connection/Request.php#L57-L68 |
judus/minimal-html | src/Table.php | Table.setTheadData | public function setTheadData(array $theadData): Table
{
if ($theadData) {
$this->options['thead']['value'] = $theadData;
} else {
$this->options['thead'] = null;
}
$this->theadData = $theadData;
return $this;
} | php | public function setTheadData(array $theadData): Table
{
if ($theadData) {
$this->options['thead']['value'] = $theadData;
} else {
$this->options['thead'] = null;
}
$this->theadData = $theadData;
return $this;
} | [
"public",
"function",
"setTheadData",
"(",
"array",
"$",
"theadData",
")",
":",
"Table",
"{",
"if",
"(",
"$",
"theadData",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'thead'",
"]",
"[",
"'value'",
"]",
"=",
"$",
"theadData",
";",
"}",
"else",
"{",... | @param array $theadData
@return Table | [
"@param",
"array",
"$theadData"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L118-L129 |
judus/minimal-html | src/Table.php | Table.setTfootData | public function setTfootData(array $tfootData): Table
{
if ($tfootData) {
$this->options['tfoot']['value'] = $tfootData;
} else {
$this->options['tfoot'] = null;
}
$this->tfootData = $tfootData;
return $this;
} | php | public function setTfootData(array $tfootData): Table
{
if ($tfootData) {
$this->options['tfoot']['value'] = $tfootData;
} else {
$this->options['tfoot'] = null;
}
$this->tfootData = $tfootData;
return $this;
} | [
"public",
"function",
"setTfootData",
"(",
"array",
"$",
"tfootData",
")",
":",
"Table",
"{",
"if",
"(",
"$",
"tfootData",
")",
"{",
"$",
"this",
"->",
"options",
"[",
"'tfoot'",
"]",
"[",
"'value'",
"]",
"=",
"$",
"tfootData",
";",
"}",
"else",
"{",... | @param array $tfootData
@return Table | [
"@param",
"array",
"$tfootData"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L148-L159 |
judus/minimal-html | src/Table.php | Table.setTableId | public function setTableId($tableId): Table
{
$this->tableId = $tableId;
$this->options['table']['id'] = $tableId;
return $this;
} | php | public function setTableId($tableId): Table
{
$this->tableId = $tableId;
$this->options['table']['id'] = $tableId;
return $this;
} | [
"public",
"function",
"setTableId",
"(",
"$",
"tableId",
")",
":",
"Table",
"{",
"$",
"this",
"->",
"tableId",
"=",
"$",
"tableId",
";",
"$",
"this",
"->",
"options",
"[",
"'table'",
"]",
"[",
"'id'",
"]",
"=",
"$",
"tableId",
";",
"return",
"$",
"... | @param mixed $tableId
@return Table | [
"@param",
"mixed",
"$tableId"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L255-L261 |
judus/minimal-html | src/Table.php | Table.setTableClass | public function setTableClass($tableClass): Table
{
$this->tableClass = $tableClass;
$this->options['table']['class'] = $tableClass;
return $this;
} | php | public function setTableClass($tableClass): Table
{
$this->tableClass = $tableClass;
$this->options['table']['class'] = $tableClass;
return $this;
} | [
"public",
"function",
"setTableClass",
"(",
"$",
"tableClass",
")",
":",
"Table",
"{",
"$",
"this",
"->",
"tableClass",
"=",
"$",
"tableClass",
";",
"$",
"this",
"->",
"options",
"[",
"'table'",
"]",
"[",
"'class'",
"]",
"=",
"$",
"tableClass",
";",
"r... | @param mixed $tableClass
@return Table | [
"@param",
"mixed",
"$tableClass"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L276-L282 |
judus/minimal-html | src/Table.php | Table.setCaption | public function setCaption($caption): Table
{
$this->caption = $caption;
$this->options['caption']['value'] = $caption;
return $this;
} | php | public function setCaption($caption): Table
{
$this->caption = $caption;
$this->options['caption']['value'] = $caption;
return $this;
} | [
"public",
"function",
"setCaption",
"(",
"$",
"caption",
")",
":",
"Table",
"{",
"$",
"this",
"->",
"caption",
"=",
"$",
"caption",
";",
"$",
"this",
"->",
"options",
"[",
"'caption'",
"]",
"[",
"'value'",
"]",
"=",
"$",
"caption",
";",
"return",
"$"... | @param mixed $caption
@return Table | [
"@param",
"mixed",
"$caption"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L297-L303 |
judus/minimal-html | src/Table.php | Table.setThead | public function setThead(array $thead = null, $useKeyName = false): Table
{
$this->setTheadUsesValue(!$useKeyName);
$this->setShowThead(true);
!is_array($thead) || $this->setTheadData($thead);
return $this;
} | php | public function setThead(array $thead = null, $useKeyName = false): Table
{
$this->setTheadUsesValue(!$useKeyName);
$this->setShowThead(true);
!is_array($thead) || $this->setTheadData($thead);
return $this;
} | [
"public",
"function",
"setThead",
"(",
"array",
"$",
"thead",
"=",
"null",
",",
"$",
"useKeyName",
"=",
"false",
")",
":",
"Table",
"{",
"$",
"this",
"->",
"setTheadUsesValue",
"(",
"!",
"$",
"useKeyName",
")",
";",
"$",
"this",
"->",
"setShowThead",
"... | @param array|null $thead
@param bool $useKeyName
@return Table | [
"@param",
"array|null",
"$thead"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L320-L328 |
judus/minimal-html | src/Table.php | Table.setTfoot | public function setTfoot(array $tfoot = null, $useKeyName = false)
{
$this->setTfootUsesValue(!$useKeyName);
$this->setShowTfoot(!is_null($tfoot));
$this->setTfootData($tfoot);
return $this;
} | php | public function setTfoot(array $tfoot = null, $useKeyName = false)
{
$this->setTfootUsesValue(!$useKeyName);
$this->setShowTfoot(!is_null($tfoot));
$this->setTfootData($tfoot);
return $this;
} | [
"public",
"function",
"setTfoot",
"(",
"array",
"$",
"tfoot",
"=",
"null",
",",
"$",
"useKeyName",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"setTfootUsesValue",
"(",
"!",
"$",
"useKeyName",
")",
";",
"$",
"this",
"->",
"setShowTfoot",
"(",
"!",
"is_n... | @param array|null $tfoot
@param bool $useKeyName
@return Table | [
"@param",
"array|null",
"$tfoot"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L345-L352 |
judus/minimal-html | src/Table.php | Table.make | public function make(array $data = null, array $options = null)
{
$data = $data ? $data : $this->getData();
$this->setData($data);
$options = $options ? $options : $this->getOptions();
$options = array_replace_recursive($this->getDefaults(), $options);
$this->setOptions($opt... | php | public function make(array $data = null, array $options = null)
{
$data = $data ? $data : $this->getData();
$this->setData($data);
$options = $options ? $options : $this->getOptions();
$options = array_replace_recursive($this->getDefaults(), $options);
$this->setOptions($opt... | [
"public",
"function",
"make",
"(",
"array",
"$",
"data",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"$",
"data",
"?",
"$",
"data",
":",
"$",
"this",
"->",
"getData",
"(",
")",
";",
"$",
"this",
"->",
"se... | @param array|null $data
@param array|null $options
@return string | [
"@param",
"array|null",
"$data",
"@param",
"array|null",
"$options"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L699-L794 |
judus/minimal-html | src/Table.php | Table.getAttributes | public function getAttributes($name, $options = null)
{
$attributes = '';
if (!is_array($options[$name])) {
return $attributes;
}
foreach ($options[$name] as $key => $value) {
if ($key !== 'tag' && $key !== 'value') {
$value = is_callable($va... | php | public function getAttributes($name, $options = null)
{
$attributes = '';
if (!is_array($options[$name])) {
return $attributes;
}
foreach ($options[$name] as $key => $value) {
if ($key !== 'tag' && $key !== 'value') {
$value = is_callable($va... | [
"public",
"function",
"getAttributes",
"(",
"$",
"name",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"attributes",
"=",
"''",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"$",
"attribute... | @param $name
@param null $options
@return string | [
"@param",
"$name",
"@param",
"null",
"$options"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L803-L819 |
judus/minimal-html | src/Table.php | Table.getColgroup | public function getColgroup($data, $options = null)
{
$cols = '';
$i = 0;
foreach ($data as $rowIndex => $rowValue) {
foreach ($rowValue as $colIndex => $colValue) {
$attributes = '';
foreach ($options['col'] as $key => $value) {
... | php | public function getColgroup($data, $options = null)
{
$cols = '';
$i = 0;
foreach ($data as $rowIndex => $rowValue) {
foreach ($rowValue as $colIndex => $colValue) {
$attributes = '';
foreach ($options['col'] as $key => $value) {
... | [
"public",
"function",
"getColgroup",
"(",
"$",
"data",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"cols",
"=",
"''",
";",
"$",
"i",
"=",
"0",
";",
"foreach",
"(",
"$",
"data",
"as",
"$",
"rowIndex",
"=>",
"$",
"rowValue",
")",
"{",
"foreach... | @param $data
@param null $options
@return string | [
"@param",
"$data",
"@param",
"null",
"$options"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L827-L851 |
judus/minimal-html | src/Table.php | Table.getGrid | public function getGrid($data, $row = 'tr', $col = 'td', $options = null)
{
$rows = '';
if (!is_array($data)) {
return $rows;
}
foreach ($data as $rowIndex => $rowValue) {
// Attribute for tr
$attributes[$row] = '';
foreach ($option... | php | public function getGrid($data, $row = 'tr', $col = 'td', $options = null)
{
$rows = '';
if (!is_array($data)) {
return $rows;
}
foreach ($data as $rowIndex => $rowValue) {
// Attribute for tr
$attributes[$row] = '';
foreach ($option... | [
"public",
"function",
"getGrid",
"(",
"$",
"data",
",",
"$",
"row",
"=",
"'tr'",
",",
"$",
"col",
"=",
"'td'",
",",
"$",
"options",
"=",
"null",
")",
"{",
"$",
"rows",
"=",
"''",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"data",
")",
")",
"{... | @param $data
@param string $row
@param string $col
@param null $options
@return string | [
"@param",
"$data",
"@param",
"string",
"$row",
"@param",
"string",
"$col",
"@param",
"null",
"$options"
] | train | https://github.com/judus/minimal-html/blob/0e1788b0b4b86a705e4f8cd402b4a2336b09d666/src/Table.php#L861-L932 |
freialib/fenrir.system | src/Web.php | Web.send | function send($contents, $status = 200, array $headers = null) {
$this->http_response_code($status);
if ($headers !== null) {
foreach ($headers as $header) {
$this->header($header[0], $header[1], $header[2]);
}
}
if ( ! empty($contents)) {
echo $contents;
}
} | php | function send($contents, $status = 200, array $headers = null) {
$this->http_response_code($status);
if ($headers !== null) {
foreach ($headers as $header) {
$this->header($header[0], $header[1], $header[2]);
}
}
if ( ! empty($contents)) {
echo $contents;
}
} | [
"function",
"send",
"(",
"$",
"contents",
",",
"$",
"status",
"=",
"200",
",",
"array",
"$",
"headers",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"http_response_code",
"(",
"$",
"status",
")",
";",
"if",
"(",
"$",
"headers",
"!==",
"null",
")",
"{"... | Sent content to the client. | [
"Sent",
"content",
"to",
"the",
"client",
"."
] | train | https://github.com/freialib/fenrir.system/blob/388d360dbc3bc6dcf85b09bb06e08a2dce8f3ec8/src/Web.php#L86-L99 |
frodosghost/AtomLoggerBundle | Controller/Controller.php | Controller.createNotFoundException | public function createNotFoundException($message = 'Not Found', \Exception $previous = null)
{
if ($this->has('atom.404.logger')) {
$log = $this->get('atom.404.logger');
$log->addRecord(400, $message, array('request' => $this->getRequest()->getUri()));
}
return new N... | php | public function createNotFoundException($message = 'Not Found', \Exception $previous = null)
{
if ($this->has('atom.404.logger')) {
$log = $this->get('atom.404.logger');
$log->addRecord(400, $message, array('request' => $this->getRequest()->getUri()));
}
return new N... | [
"public",
"function",
"createNotFoundException",
"(",
"$",
"message",
"=",
"'Not Found'",
",",
"\\",
"Exception",
"$",
"previous",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"has",
"(",
"'atom.404.logger'",
")",
")",
"{",
"$",
"log",
"=",
"$",
... | Sends 404 to Page AtomLogger
@param string $message Error Message to be logged
@param \Exception $previous Previous message made prior to 404
@return NotFoundHttpException | [
"Sends",
"404",
"to",
"Page",
"AtomLogger"
] | train | https://github.com/frodosghost/AtomLoggerBundle/blob/c48823e4b3772e498b366867f27e6581f613f733/Controller/Controller.php#L26-L34 |
RhubarbPHP/Scaffold.RepositoryLog | src/RepositoryLog.php | RepositoryLog.writeFormattedEntry | protected function writeFormattedEntry($level, $message, $category = "", $additionalData)
{
// There are a number of occasions where this method can cause an infinite loop:
//
// 1) Writing a database entry could cause PDO log entries to be generated
// 2) If any of the following lin... | php | protected function writeFormattedEntry($level, $message, $category = "", $additionalData)
{
// There are a number of occasions where this method can cause an infinite loop:
//
// 1) Writing a database entry could cause PDO log entries to be generated
// 2) If any of the following lin... | [
"protected",
"function",
"writeFormattedEntry",
"(",
"$",
"level",
",",
"$",
"message",
",",
"$",
"category",
"=",
"\"\"",
",",
"$",
"additionalData",
")",
"{",
"// There are a number of occasions where this method can cause an infinite loop:",
"//",
"// 1) Writing a databa... | The logger should implement this method to perform the actual log committal.
@param int $level The log level
@param string $message The text message to log
@param string $category The category of log message
@param array $additionalData Any number of additional key value pairs which can be understood by specific
logs ... | [
"The",
"logger",
"should",
"implement",
"this",
"method",
"to",
"perform",
"the",
"actual",
"log",
"committal",
"."
] | train | https://github.com/RhubarbPHP/Scaffold.RepositoryLog/blob/7e54f6a1553d3baff7c2fd58c97e022ad1c2c8d3/src/RepositoryLog.php#L29-L65 |
nicodevs/laito | src/Laito/Controller.php | Controller.index | public function index($params = [])
{
// Set the filters
$params = (!empty($params))? $params : $this->app->request->input();
// Get records
$this->model->params = $params;
$result = $this->model->search($params)->get();
// Get pagination and number of records
... | php | public function index($params = [])
{
// Set the filters
$params = (!empty($params))? $params : $this->app->request->input();
// Get records
$this->model->params = $params;
$result = $this->model->search($params)->get();
// Get pagination and number of records
... | [
"public",
"function",
"index",
"(",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"// Set the filters",
"$",
"params",
"=",
"(",
"!",
"empty",
"(",
"$",
"params",
")",
")",
"?",
"$",
"params",
":",
"$",
"this",
"->",
"app",
"->",
"request",
"->",
"input"... | Display a listing of the resource
@param array $params Listing parameters
@return array Response | [
"Display",
"a",
"listing",
"of",
"the",
"resource"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Controller.php#L49-L70 |
nicodevs/laito | src/Laito/Controller.php | Controller.show | public function show($id = null)
{
// Check the ID
if (!isset($id)) {
throw new \InvalidArgumentException('Undefined ID', 400);
}
// Get record
$item = $this->model->find($id);
// Abort if the record is not found
if (!$item) {
throw n... | php | public function show($id = null)
{
// Check the ID
if (!isset($id)) {
throw new \InvalidArgumentException('Undefined ID', 400);
}
// Get record
$item = $this->model->find($id);
// Abort if the record is not found
if (!$item) {
throw n... | [
"public",
"function",
"show",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"// Check the ID",
"if",
"(",
"!",
"isset",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Undefined ID'",
",",
"400",
")",
";",
"}",
"// Get ... | Display the specified resource
@param array $id Resource ID
@return array Response | [
"Display",
"the",
"specified",
"resource"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Controller.php#L78-L98 |
nicodevs/laito | src/Laito/Controller.php | Controller.store | public function store($attributes = [])
{
// Set the attributes
$attributes = (!empty($attributes))? $attributes : $this->app->request->input();
// Create the record
$result = $this->model->create($attributes);
// Return results
return [
'success' => tru... | php | public function store($attributes = [])
{
// Set the attributes
$attributes = (!empty($attributes))? $attributes : $this->app->request->input();
// Create the record
$result = $this->model->create($attributes);
// Return results
return [
'success' => tru... | [
"public",
"function",
"store",
"(",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"// Set the attributes",
"$",
"attributes",
"=",
"(",
"!",
"empty",
"(",
"$",
"attributes",
")",
")",
"?",
"$",
"attributes",
":",
"$",
"this",
"->",
"app",
"->",
"request"... | Stores a newly created resource in storage
@param array $params Resource attributes
@return array Response | [
"Stores",
"a",
"newly",
"created",
"resource",
"in",
"storage"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Controller.php#L106-L120 |
nicodevs/laito | src/Laito/Controller.php | Controller.update | public function update($id = null, $attributes = [])
{
// Check the ID
if (!isset($id)) {
throw new \InvalidArgumentException('Undefined ID', 400);
}
// Set the attributes
$attributes = (!empty($attributes))? $attributes : $this->app->request->input();
/... | php | public function update($id = null, $attributes = [])
{
// Check the ID
if (!isset($id)) {
throw new \InvalidArgumentException('Undefined ID', 400);
}
// Set the attributes
$attributes = (!empty($attributes))? $attributes : $this->app->request->input();
/... | [
"public",
"function",
"update",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"attributes",
"=",
"[",
"]",
")",
"{",
"// Check the ID",
"if",
"(",
"!",
"isset",
"(",
"$",
"id",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Undefined ... | Update the specified resource in storage
@param array $id Resource ID
@return array Response | [
"Update",
"the",
"specified",
"resource",
"in",
"storage"
] | train | https://github.com/nicodevs/laito/blob/d2d28abfcbf981c4decfec28ce94f8849600e9fe/src/Laito/Controller.php#L128-L147 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.