repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
partition
stringclasses
1 value
m6w6/pq-gateway
lib/pq/Gateway/Rowset.php
Rowset.filter
function filter(callable $cb) { $rowset = clone $this; $rowset->index = 0; $rowset->rows = array_filter($this->rows, $cb); return $rowset; }
php
function filter(callable $cb) { $rowset = clone $this; $rowset->index = 0; $rowset->rows = array_filter($this->rows, $cb); return $rowset; }
[ "function", "filter", "(", "callable", "$", "cb", ")", "{", "$", "rowset", "=", "clone", "$", "this", ";", "$", "rowset", "->", "index", "=", "0", ";", "$", "rowset", "->", "rows", "=", "array_filter", "(", "$", "this", "->", "rows", ",", "$", "c...
Filter by callback @param callable $cb @return \pq\Gateway\Rowset
[ "Filter", "by", "callback" ]
58233722a06fd742f531f8f012ea540b309303da
https://github.com/m6w6/pq-gateway/blob/58233722a06fd742f531f8f012ea540b309303da/lib/pq/Gateway/Rowset.php#L274-L279
train
thienhungho/yii2-contact-management
src/modules/ContactManage/controllers/ContactController.php
ContactController.actionIndex
public function actionIndex() { $searchModel = new ContactSearch(); $dataProvider = $searchModel->search(request()->queryParams); $dataProvider->sort->defaultOrder = ['id' => SORT_DESC]; return $this->render('index', [ 'searchModel' => $searchModel, '...
php
public function actionIndex() { $searchModel = new ContactSearch(); $dataProvider = $searchModel->search(request()->queryParams); $dataProvider->sort->defaultOrder = ['id' => SORT_DESC]; return $this->render('index', [ 'searchModel' => $searchModel, '...
[ "public", "function", "actionIndex", "(", ")", "{", "$", "searchModel", "=", "new", "ContactSearch", "(", ")", ";", "$", "dataProvider", "=", "$", "searchModel", "->", "search", "(", "request", "(", ")", "->", "queryParams", ")", ";", "$", "dataProvider", ...
Lists all Contact models. @return mixed
[ "Lists", "all", "Contact", "models", "." ]
652d7b0ee628eb924e197ad956ce3c6045b878eb
https://github.com/thienhungho/yii2-contact-management/blob/652d7b0ee628eb924e197ad956ce3c6045b878eb/src/modules/ContactManage/controllers/ContactController.php#L33-L43
train
thienhungho/yii2-contact-management
src/modules/ContactManage/controllers/ContactController.php
ContactController.findModel
protected function findModel($id) { if (($model = Contact::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException(t('app', 'The requested page does not exist.')); } }
php
protected function findModel($id) { if (($model = Contact::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException(t('app', 'The requested page does not exist.')); } }
[ "protected", "function", "findModel", "(", "$", "id", ")", "{", "if", "(", "(", "$", "model", "=", "Contact", "::", "findOne", "(", "$", "id", ")", ")", "!==", "null", ")", "{", "return", "$", "model", ";", "}", "else", "{", "throw", "new", "NotF...
Finds the Contact model based on its primary key value. If the model is not found, a 404 HTTP exception will be thrown. @param integer $id @return Contact the loaded model @throws NotFoundHttpException if the model cannot be found
[ "Finds", "the", "Contact", "model", "based", "on", "its", "primary", "key", "value", ".", "If", "the", "model", "is", "not", "found", "a", "404", "HTTP", "exception", "will", "be", "thrown", "." ]
652d7b0ee628eb924e197ad956ce3c6045b878eb
https://github.com/thienhungho/yii2-contact-management/blob/652d7b0ee628eb924e197ad956ce3c6045b878eb/src/modules/ContactManage/controllers/ContactController.php#L174-L181
train
schpill/thin
src/Queuespl.php
Queuespl.insert
public function insert($data, $priority = 1) { $priority = (int) $priority; $this->items[] = array( 'data' => $data, 'priority' => $priority, ); $this->getQueue()->insert($data, $priority); return $this; }
php
public function insert($data, $priority = 1) { $priority = (int) $priority; $this->items[] = array( 'data' => $data, 'priority' => $priority, ); $this->getQueue()->insert($data, $priority); return $this; }
[ "public", "function", "insert", "(", "$", "data", ",", "$", "priority", "=", "1", ")", "{", "$", "priority", "=", "(", "int", ")", "$", "priority", ";", "$", "this", "->", "items", "[", "]", "=", "array", "(", "'data'", "=>", "$", "data", ",", ...
Insert an item into the queue Priority defaults to 1 (low priority) if none provided. @param mixed $data @param int $priority @return Queue
[ "Insert", "an", "item", "into", "the", "queue" ]
a9102d9d6f70e8b0f6be93153f70849f46489ee1
https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Queuespl.php#L56-L66
train
schpill/thin
src/Queuespl.php
Queuespl.getQueue
protected function getQueue() { if (null === $this->queue) { $this->queue = new $this->queueClass(); if (!$this->queue instanceof SplPriorityQueue) { throw new Exception(sprintf( 'Queue expects an internal queue of type Spl...
php
protected function getQueue() { if (null === $this->queue) { $this->queue = new $this->queueClass(); if (!$this->queue instanceof SplPriorityQueue) { throw new Exception(sprintf( 'Queue expects an internal queue of type Spl...
[ "protected", "function", "getQueue", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "queue", ")", "{", "$", "this", "->", "queue", "=", "new", "$", "this", "->", "queueClass", "(", ")", ";", "if", "(", "!", "$", "this", "->", "queue"...
Get the inner priority queue instance @throws Exception\DomainException @return SplQueue
[ "Get", "the", "inner", "priority", "queue", "instance" ]
a9102d9d6f70e8b0f6be93153f70849f46489ee1
https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Queuespl.php#L283-L297
train
alaa-almaliki/property-setter-config
src/PropertySetterConfig.php
PropertySetterConfig.setObjectProperties
static public function setObjectProperties($object, array $config = []) { foreach (static::createSetterMethods($config) as $method => $value) { if (method_exists($object, $method)) { call_user_func_array([$object, $method], [$value]); } } }
php
static public function setObjectProperties($object, array $config = []) { foreach (static::createSetterMethods($config) as $method => $value) { if (method_exists($object, $method)) { call_user_func_array([$object, $method], [$value]); } } }
[ "static", "public", "function", "setObjectProperties", "(", "$", "object", ",", "array", "$", "config", "=", "[", "]", ")", "{", "foreach", "(", "static", "::", "createSetterMethods", "(", "$", "config", ")", "as", "$", "method", "=>", "$", "value", ")",...
Sets object properties by a given array @param $object @param array $config
[ "Sets", "object", "properties", "by", "a", "given", "array" ]
0dd77d0a206d927990b708e0e935284d8a5d4116
https://github.com/alaa-almaliki/property-setter-config/blob/0dd77d0a206d927990b708e0e935284d8a5d4116/src/PropertySetterConfig.php#L16-L23
train
IftekherSunny/Planet-Framework
src/Sun/Validation/Form/Request.php
Request.validate
public function validate() { foreach($this->rules() as $key => $value) { $this->rules[$key] = [$this->input($key), $value]; } $validate = $this->validator->validate($this->rules); if ($validate->fails()) { if($this->isAjax()) { ret...
php
public function validate() { foreach($this->rules() as $key => $value) { $this->rules[$key] = [$this->input($key), $value]; } $validate = $this->validator->validate($this->rules); if ($validate->fails()) { if($this->isAjax()) { ret...
[ "public", "function", "validate", "(", ")", "{", "foreach", "(", "$", "this", "->", "rules", "(", ")", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "this", "->", "rules", "[", "$", "key", "]", "=", "[", "$", "this", "->", "input", "(", ...
Validate requested form. @return string
[ "Validate", "requested", "form", "." ]
530e772fb97695c1c4e1af73f81675f189474d9f
https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Validation/Form/Request.php#L56-L71
train
armazon/armazon
src/Armazon/Http/Peticion.php
Peticion.prepararArchivos
public static function prepararArchivos(array $archivos, $inicio = true) { $final = []; foreach ($archivos as $nombre => $archivo) { // Definimos sub nombre $subNombre = $nombre; if ($inicio) { $subNombre = $archivo['name']; } ...
php
public static function prepararArchivos(array $archivos, $inicio = true) { $final = []; foreach ($archivos as $nombre => $archivo) { // Definimos sub nombre $subNombre = $nombre; if ($inicio) { $subNombre = $archivo['name']; } ...
[ "public", "static", "function", "prepararArchivos", "(", "array", "$", "archivos", ",", "$", "inicio", "=", "true", ")", "{", "$", "final", "=", "[", "]", ";", "foreach", "(", "$", "archivos", "as", "$", "nombre", "=>", "$", "archivo", ")", "{", "// ...
Prepara el formato en que se presenta los archivos subidos. @link http://php.net/manual/es/reserved.variables.files.php#106608 @param array $archivos @param bool $inicio @return array
[ "Prepara", "el", "formato", "en", "que", "se", "presenta", "los", "archivos", "subidos", "." ]
ec76385ff80ce1659d81bc4050ef9483ab0ebe52
https://github.com/armazon/armazon/blob/ec76385ff80ce1659d81bc4050ef9483ab0ebe52/src/Armazon/Http/Peticion.php#L94-L120
train
phore/phore-system
src/PhoreProc.php
PhoreProc.wait
public function wait(bool $throwExceptionOnError=true) : PhoreProcResult { if ($this->proc === null) $this->exec(); $buf = null; if ($buf === null) { $buf = []; foreach ($this->listener as $chanId => $listener) { $buf[$chanId] = ""; ...
php
public function wait(bool $throwExceptionOnError=true) : PhoreProcResult { if ($this->proc === null) $this->exec(); $buf = null; if ($buf === null) { $buf = []; foreach ($this->listener as $chanId => $listener) { $buf[$chanId] = ""; ...
[ "public", "function", "wait", "(", "bool", "$", "throwExceptionOnError", "=", "true", ")", ":", "PhoreProcResult", "{", "if", "(", "$", "this", "->", "proc", "===", "null", ")", "$", "this", "->", "exec", "(", ")", ";", "$", "buf", "=", "null", ";", ...
Wait for the process to exit. This will call exec() if not done before. @param bool $throwExceptionOnError @return PhoreProcResult @throws PhoreExecException
[ "Wait", "for", "the", "process", "to", "exit", "." ]
564f41ea790d4fb564d65f1533a4aeb9f05dabf0
https://github.com/phore/phore-system/blob/564f41ea790d4fb564d65f1533a4aeb9f05dabf0/src/PhoreProc.php#L105-L162
train
IftekherSunny/Planet-Framework
src/Sun/Support/Alien.php
Alien.execute
protected static function execute() { try { $instance = static::getInstance(); $reflectionMethod = new ReflectionMethod($instance, static::$method); return $reflectionMethod->invokeArgs($instance, static::$arguments); } catch (Exception $e) { ...
php
protected static function execute() { try { $instance = static::getInstance(); $reflectionMethod = new ReflectionMethod($instance, static::$method); return $reflectionMethod->invokeArgs($instance, static::$arguments); } catch (Exception $e) { ...
[ "protected", "static", "function", "execute", "(", ")", "{", "try", "{", "$", "instance", "=", "static", "::", "getInstance", "(", ")", ";", "$", "reflectionMethod", "=", "new", "ReflectionMethod", "(", "$", "instance", ",", "static", "::", "$", "method", ...
Execute method of the registered alien @return mixed @throws Exception
[ "Execute", "method", "of", "the", "registered", "alien" ]
530e772fb97695c1c4e1af73f81675f189474d9f
https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Support/Alien.php#L46-L57
train
IftekherSunny/Planet-Framework
src/Sun/Support/Alien.php
Alien.shouldReceive
public static function shouldReceive() { if(!isset(static::$mocked[static::registerAlien()])) { static::$mocked[static::registerAlien()] = Mockery::mock(static::registerAlien()); } return call_user_func_array([static::$mocked[static::registerAlien()], 'shouldReceive'], fun...
php
public static function shouldReceive() { if(!isset(static::$mocked[static::registerAlien()])) { static::$mocked[static::registerAlien()] = Mockery::mock(static::registerAlien()); } return call_user_func_array([static::$mocked[static::registerAlien()], 'shouldReceive'], fun...
[ "public", "static", "function", "shouldReceive", "(", ")", "{", "if", "(", "!", "isset", "(", "static", "::", "$", "mocked", "[", "static", "::", "registerAlien", "(", ")", "]", ")", ")", "{", "static", "::", "$", "mocked", "[", "static", "::", "regi...
Initiate mock expectation for the registered alien @return mixed @throws Exception
[ "Initiate", "mock", "expectation", "for", "the", "registered", "alien" ]
530e772fb97695c1c4e1af73f81675f189474d9f
https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Support/Alien.php#L84-L91
train
lrezek/Arachnid
src/LRezek/Arachnid/Meta/Repository.php
Repository.findMeta
private function findMeta($className) { $class = new \ReflectionClass($className); //If it's a proxy class, use the parent for meta if($class->implementsInterface('LRezek\\Arachnid\\Proxy\\Entity')) { $class = $class->getParentClass(); } $node = $this->r...
php
private function findMeta($className) { $class = new \ReflectionClass($className); //If it's a proxy class, use the parent for meta if($class->implementsInterface('LRezek\\Arachnid\\Proxy\\Entity')) { $class = $class->getParentClass(); } $node = $this->r...
[ "private", "function", "findMeta", "(", "$", "className", ")", "{", "$", "class", "=", "new", "\\", "ReflectionClass", "(", "$", "className", ")", ";", "//If it's a proxy class, use the parent for meta", "if", "(", "$", "class", "->", "implementsInterface", "(", ...
Does the actual annotation parsing to get meta information for a given class. @param string $className The class name to get meta for. @return Node|Relation A node/relation meta object. @throws \LRezek\Arachnid\Exception Thrown if the class is not a node or relation.
[ "Does", "the", "actual", "annotation", "parsing", "to", "get", "meta", "information", "for", "a", "given", "class", "." ]
fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a
https://github.com/lrezek/Arachnid/blob/fbfc2c6f9d1dbfeef6f677813c12c570d5ea750a/src/LRezek/Arachnid/Meta/Repository.php#L74-L128
train
mojopollo/laravel-helpers
src/Mojopollo/Helpers/StringHelper.php
StringHelper.limitByWords
public static function limitByWords($str, $wordCount = 10) { // Reads amount of words in paragraph $words = preg_split("/[\s]+/", $str, $wordCount + 1); // limit paragraph to $wordCount value $words = array_slice($words, 0, $wordCount); // Return the words back return join(' ', $words); }
php
public static function limitByWords($str, $wordCount = 10) { // Reads amount of words in paragraph $words = preg_split("/[\s]+/", $str, $wordCount + 1); // limit paragraph to $wordCount value $words = array_slice($words, 0, $wordCount); // Return the words back return join(' ', $words); }
[ "public", "static", "function", "limitByWords", "(", "$", "str", ",", "$", "wordCount", "=", "10", ")", "{", "// Reads amount of words in paragraph", "$", "words", "=", "preg_split", "(", "\"/[\\s]+/\"", ",", "$", "str", ",", "$", "wordCount", "+", "1", ")",...
Returns a string limited by the word count specified logic borrowed from StackOverflow @see http://stackoverflow.com/questions/79960/how-to-truncate-a-string-in-php-to-the-word-closest-to-a-certain-number-of-chara#answer-10026115 @param string $str paragraph to limit by words @param integer $wordCount amoun...
[ "Returns", "a", "string", "limited", "by", "the", "word", "count", "specified", "logic", "borrowed", "from", "StackOverflow" ]
0becb5e0f4202a0f489fb5e384c01dacb8f29dc5
https://github.com/mojopollo/laravel-helpers/blob/0becb5e0f4202a0f489fb5e384c01dacb8f29dc5/src/Mojopollo/Helpers/StringHelper.php#L63-L73
train
gregorybesson/AdfabCore
src/AdfabCore/Service/Cron.php
Cron.process
public function process() { $em = $this->getEm(); $cronRegistry = $this->getCronjobs(); $pending = $this->getPending(); $scheduleLifetime = $this->scheduleLifetime * 60; //convert min to sec $now = new \DateTime; foreach ($pending as $job) { $scheduleTime...
php
public function process() { $em = $this->getEm(); $cronRegistry = $this->getCronjobs(); $pending = $this->getPending(); $scheduleLifetime = $this->scheduleLifetime * 60; //convert min to sec $now = new \DateTime; foreach ($pending as $job) { $scheduleTime...
[ "public", "function", "process", "(", ")", "{", "$", "em", "=", "$", "this", "->", "getEm", "(", ")", ";", "$", "cronRegistry", "=", "$", "this", "->", "getCronjobs", "(", ")", ";", "$", "pending", "=", "$", "this", "->", "getPending", "(", ")", ...
run cron jobs @return self
[ "run", "cron", "jobs" ]
94078662dae092c2782829bd1554e1426acdf671
https://github.com/gregorybesson/AdfabCore/blob/94078662dae092c2782829bd1554e1426acdf671/src/AdfabCore/Service/Cron.php#L160-L230
train
gregorybesson/AdfabCore
src/AdfabCore/Service/Cron.php
Cron.cleanLog
public function cleanLog() { $em = $this->getEm(); $lifetime = array( Mapper\Cronjob::STATUS_SUCCESS => $this->getSuccessLogLifetime() * 60, Mapper\Cronjob::STATUS_MISSED => $this->getFailureLogLifetime() * 60, Mapper\Cronjob::ST...
php
public function cleanLog() { $em = $this->getEm(); $lifetime = array( Mapper\Cronjob::STATUS_SUCCESS => $this->getSuccessLogLifetime() * 60, Mapper\Cronjob::STATUS_MISSED => $this->getFailureLogLifetime() * 60, Mapper\Cronjob::ST...
[ "public", "function", "cleanLog", "(", ")", "{", "$", "em", "=", "$", "this", "->", "getEm", "(", ")", ";", "$", "lifetime", "=", "array", "(", "Mapper", "\\", "Cronjob", "::", "STATUS_SUCCESS", "=>", "$", "this", "->", "getSuccessLogLifetime", "(", ")...
delete old cron job logs @return self
[ "delete", "old", "cron", "job", "logs" ]
94078662dae092c2782829bd1554e1426acdf671
https://github.com/gregorybesson/AdfabCore/blob/94078662dae092c2782829bd1554e1426acdf671/src/AdfabCore/Service/Cron.php#L333-L360
train
gregorybesson/AdfabCore
src/AdfabCore/Service/Cron.php
Cron.tryLockJob
public function tryLockJob(Entity\Cronjob $job) { $em = $this->getEm(); $repo = $em->getRepository('AdfabCore\Entity\Cronjob'); if ($job->getStatus() === Mapper\Cronjob::STATUS_PENDING) { $job->setStatus(Mapper\Cronjob::STATUS_RUNNING); $em->persist($job); ...
php
public function tryLockJob(Entity\Cronjob $job) { $em = $this->getEm(); $repo = $em->getRepository('AdfabCore\Entity\Cronjob'); if ($job->getStatus() === Mapper\Cronjob::STATUS_PENDING) { $job->setStatus(Mapper\Cronjob::STATUS_RUNNING); $em->persist($job); ...
[ "public", "function", "tryLockJob", "(", "Entity", "\\", "Cronjob", "$", "job", ")", "{", "$", "em", "=", "$", "this", "->", "getEm", "(", ")", ";", "$", "repo", "=", "$", "em", "->", "getRepository", "(", "'AdfabCore\\Entity\\Cronjob'", ")", ";", "if"...
try to acquire a lock on a cron job set a job to 'running' only if it is currently 'pending' @param Entity\Cronjob $job @return bool
[ "try", "to", "acquire", "a", "lock", "on", "a", "cron", "job" ]
94078662dae092c2782829bd1554e1426acdf671
https://github.com/gregorybesson/AdfabCore/blob/94078662dae092c2782829bd1554e1426acdf671/src/AdfabCore/Service/Cron.php#L380-L395
train
gregorybesson/AdfabCore
src/AdfabCore/Service/Cron.php
Cron.matchTime
public static function matchTime($time, $expr) { //ArgValidator::assert($time, array('string', 'numeric')); //ArgValidator::assert($expr, 'string'); $cronExpr = preg_split('/\s+/', $expr, null, PREG_SPLIT_NO_EMPTY); if (count($cronExpr) !== 5) { throw new Exception\Inval...
php
public static function matchTime($time, $expr) { //ArgValidator::assert($time, array('string', 'numeric')); //ArgValidator::assert($expr, 'string'); $cronExpr = preg_split('/\s+/', $expr, null, PREG_SPLIT_NO_EMPTY); if (count($cronExpr) !== 5) { throw new Exception\Inval...
[ "public", "static", "function", "matchTime", "(", "$", "time", ",", "$", "expr", ")", "{", "//ArgValidator::assert($time, array('string', 'numeric'));", "//ArgValidator::assert($expr, 'string');", "$", "cronExpr", "=", "preg_split", "(", "'/\\s+/'", ",", "$", "expr", ",...
determine whether a given time falls within the given cron expr @param string|numeric $time timestamp or strtotime()-compatible string @param string $expr any valid cron expression, in addition supporting: range: '0-5' range + interval: '10-59/5' comma-separated combinations of these: '1,4,7,10-20' English months: 'ja...
[ "determine", "whether", "a", "given", "time", "falls", "within", "the", "given", "cron", "expr" ]
94078662dae092c2782829bd1554e1426acdf671
https://github.com/gregorybesson/AdfabCore/blob/94078662dae092c2782829bd1554e1426acdf671/src/AdfabCore/Service/Cron.php#L423-L445
train
schpill/thin
src/Minify/Html.php
Html.process
public function process() { if ($this->_isXhtml === null) { $this->_isXhtml = (false !== strpos($this->_html, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML')); } $this->_replacementHash = 'MINIFYHTML' . md5($_SERVER['REQUEST_TIME']); $this->_placehold...
php
public function process() { if ($this->_isXhtml === null) { $this->_isXhtml = (false !== strpos($this->_html, '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML')); } $this->_replacementHash = 'MINIFYHTML' . md5($_SERVER['REQUEST_TIME']); $this->_placehold...
[ "public", "function", "process", "(", ")", "{", "if", "(", "$", "this", "->", "_isXhtml", "===", "null", ")", "{", "$", "this", "->", "_isXhtml", "=", "(", "false", "!==", "strpos", "(", "$", "this", "->", "_html", ",", "'<!DOCTYPE html PUBLIC \"-//W3C//...
Minify the markeup given in the constructor @return string
[ "Minify", "the", "markeup", "given", "in", "the", "constructor" ]
a9102d9d6f70e8b0f6be93153f70849f46489ee1
https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Minify/Html.php#L37-L103
train
hametuha/pattern
app/Hametuha/Pattern/Command.php
Command.sql
public function sql( $args ) { list( $table_name ) = $args; $rows = Model::$list; if ( ! isset( $rows[ $table_name ] ) ) { \WP_CLI::error( sprintf( '%s: table is not registered.', $table_name ) ); } $model = $rows[ $table_name ]; if ( ! class_exists( $model ) ) { \WP_CLI::error( sprintf( '%s: Model cl...
php
public function sql( $args ) { list( $table_name ) = $args; $rows = Model::$list; if ( ! isset( $rows[ $table_name ] ) ) { \WP_CLI::error( sprintf( '%s: table is not registered.', $table_name ) ); } $model = $rows[ $table_name ]; if ( ! class_exists( $model ) ) { \WP_CLI::error( sprintf( '%s: Model cl...
[ "public", "function", "sql", "(", "$", "args", ")", "{", "list", "(", "$", "table_name", ")", "=", "$", "args", ";", "$", "rows", "=", "Model", "::", "$", "list", ";", "if", "(", "!", "isset", "(", "$", "rows", "[", "$", "table_name", "]", ")",...
Display table schema SQL ## OPTIONS <model_class> : Model class name of Hametuha\Pattern\Model ## EXAMPLES wp schema wp_custom_table @synopsis <table_name> @param array $args
[ "Display", "table", "schema", "SQL" ]
562d18f8e750d1c4e52c537839679807a0e3d055
https://github.com/hametuha/pattern/blob/562d18f8e750d1c4e52c537839679807a0e3d055/app/Hametuha/Pattern/Command.php#L31-L50
train
hametuha/pattern
app/Hametuha/Pattern/Command.php
Command.tables
public function tables() { $table = new \cli\Table(); $rows = Model::$list; if ( ! $rows ) { \WP_CLI::error( 'No model is regsitered.' ); } $table->setHeaders( [ 'Table Name', 'Model Class' ] ); foreach ( $rows as $table_name => $class) { $table->addRow( [ $table_name, $class ] ); } $table->displ...
php
public function tables() { $table = new \cli\Table(); $rows = Model::$list; if ( ! $rows ) { \WP_CLI::error( 'No model is regsitered.' ); } $table->setHeaders( [ 'Table Name', 'Model Class' ] ); foreach ( $rows as $table_name => $class) { $table->addRow( [ $table_name, $class ] ); } $table->displ...
[ "public", "function", "tables", "(", ")", "{", "$", "table", "=", "new", "\\", "cli", "\\", "Table", "(", ")", ";", "$", "rows", "=", "Model", "::", "$", "list", ";", "if", "(", "!", "$", "rows", ")", "{", "\\", "WP_CLI", "::", "error", "(", ...
Get list of tables which generated by Hametuha\Pattern\Model
[ "Get", "list", "of", "tables", "which", "generated", "by", "Hametuha", "\\", "Pattern", "\\", "Model" ]
562d18f8e750d1c4e52c537839679807a0e3d055
https://github.com/hametuha/pattern/blob/562d18f8e750d1c4e52c537839679807a0e3d055/app/Hametuha/Pattern/Command.php#L55-L66
train
alphacomm/alpharpc
src/AlphaRPC/Client/ManagerList.php
ManagerList.add
public function add($manager) { if (!is_string($manager)) { throw new \InvalidArgumentException('ManagerList::add requires $manager to be a string.'); } $this->managerList[$manager] = $manager; $this->managerStatus[self::FLAG_AVAILABLE][$manager] = $manager; ret...
php
public function add($manager) { if (!is_string($manager)) { throw new \InvalidArgumentException('ManagerList::add requires $manager to be a string.'); } $this->managerList[$manager] = $manager; $this->managerStatus[self::FLAG_AVAILABLE][$manager] = $manager; ret...
[ "public", "function", "add", "(", "$", "manager", ")", "{", "if", "(", "!", "is_string", "(", "$", "manager", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'ManagerList::add requires $manager to be a string.'", ")", ";", "}", "$", "thi...
Adds a manager dsn to the list. @param string $manager @return ManagerList @throws \InvalidArgumentException
[ "Adds", "a", "manager", "dsn", "to", "the", "list", "." ]
cf162854500554c4ba8d39f2675de35a49c30ed0
https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/ManagerList.php#L71-L81
train
alphacomm/alpharpc
src/AlphaRPC/Client/ManagerList.php
ManagerList.toPrioritizedArray
public function toPrioritizedArray() { // Reset the available managers every $this->unavailableCheckAt requests. if (($this->resetCounter % $this->resetAt) == 0) { $this->resetAvailableManagers(); } $this->resetCounter++; $available =& $this->managerStatus[self::...
php
public function toPrioritizedArray() { // Reset the available managers every $this->unavailableCheckAt requests. if (($this->resetCounter % $this->resetAt) == 0) { $this->resetAvailableManagers(); } $this->resetCounter++; $available =& $this->managerStatus[self::...
[ "public", "function", "toPrioritizedArray", "(", ")", "{", "// Reset the available managers every $this->unavailableCheckAt requests.", "if", "(", "(", "$", "this", "->", "resetCounter", "%", "$", "this", "->", "resetAt", ")", "==", "0", ")", "{", "$", "this", "->...
Returns an array or manager dsns, sorted by priority. Available managers get priority over unavailable managers. Once every x calls all managers will be flagged as available. This makes sure managers that where unavailable for a period of time will receive jobs once they get up. @return array[]
[ "Returns", "an", "array", "or", "manager", "dsns", "sorted", "by", "priority", "." ]
cf162854500554c4ba8d39f2675de35a49c30ed0
https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/ManagerList.php#L106-L124
train
alphacomm/alpharpc
src/AlphaRPC/Client/ManagerList.php
ManagerList.resetAvailableManagers
protected function resetAvailableManagers() { $this->managerStatus[self::FLAG_AVAILABLE] = $this->managerList; $this->managerStatus[self::FLAG_UNAVAILABLE] = array(); }
php
protected function resetAvailableManagers() { $this->managerStatus[self::FLAG_AVAILABLE] = $this->managerList; $this->managerStatus[self::FLAG_UNAVAILABLE] = array(); }
[ "protected", "function", "resetAvailableManagers", "(", ")", "{", "$", "this", "->", "managerStatus", "[", "self", "::", "FLAG_AVAILABLE", "]", "=", "$", "this", "->", "managerList", ";", "$", "this", "->", "managerStatus", "[", "self", "::", "FLAG_UNAVAILABLE...
Makes all managers available.
[ "Makes", "all", "managers", "available", "." ]
cf162854500554c4ba8d39f2675de35a49c30ed0
https://github.com/alphacomm/alpharpc/blob/cf162854500554c4ba8d39f2675de35a49c30ed0/src/AlphaRPC/Client/ManagerList.php#L156-L160
train
RadialCorp/magento-core
src/app/code/community/Radial/Core/Helper/Api/Validator.php
Radial_Core_Helper_Api_Validator.returnClientErrorResponse
public function returnClientErrorResponse(Zend_Http_Response $response) { $status = $response->getStatus(); switch ($status) { case 401: $message = self::INVALID_API_KEY; break; case 403: $message = self::INVALID_STORE_ID; ...
php
public function returnClientErrorResponse(Zend_Http_Response $response) { $status = $response->getStatus(); switch ($status) { case 401: $message = self::INVALID_API_KEY; break; case 403: $message = self::INVALID_STORE_ID; ...
[ "public", "function", "returnClientErrorResponse", "(", "Zend_Http_Response", "$", "response", ")", "{", "$", "status", "=", "$", "response", "->", "getStatus", "(", ")", ";", "switch", "(", "$", "status", ")", "{", "case", "401", ":", "$", "message", "=",...
Return the response data for client errors - 4XX range errors. @param Zend_Http_Response $response @return array
[ "Return", "the", "response", "data", "for", "client", "errors", "-", "4XX", "range", "errors", "." ]
9bb5f218d9caf79eab8598f4f8447037a0cc6355
https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Core/Helper/Api/Validator.php#L58-L78
train
schpill/thin
src/Env.php
Env.load
public static function load($path, $file = '.env') { if (!is_string($file)) { $file = '.env'; } $filePath = rtrim($path, '/') . '/' . $file; if (!is_readable($filePath) || !is_file($filePath)) { throw new \InvalidArgumentException...
php
public static function load($path, $file = '.env') { if (!is_string($file)) { $file = '.env'; } $filePath = rtrim($path, '/') . '/' . $file; if (!is_readable($filePath) || !is_file($filePath)) { throw new \InvalidArgumentException...
[ "public", "static", "function", "load", "(", "$", "path", ",", "$", "file", "=", "'.env'", ")", "{", "if", "(", "!", "is_string", "(", "$", "file", ")", ")", "{", "$", "file", "=", "'.env'", ";", "}", "$", "filePath", "=", "rtrim", "(", "$", "p...
Load `.env` file in given directory
[ "Load", ".", "env", "file", "in", "given", "directory" ]
a9102d9d6f70e8b0f6be93153f70849f46489ee1
https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Env.php#L15-L53
train
schpill/thin
src/Env.php
Env.required
public static function required($environmentVariables, array $allowedValues = array()) { $environmentVariables = (array) $environmentVariables; $missingEnvironmentVariables = []; foreach ($environmentVariables as $environmentVariable) { $value = ...
php
public static function required($environmentVariables, array $allowedValues = array()) { $environmentVariables = (array) $environmentVariables; $missingEnvironmentVariables = []; foreach ($environmentVariables as $environmentVariable) { $value = ...
[ "public", "static", "function", "required", "(", "$", "environmentVariables", ",", "array", "$", "allowedValues", "=", "array", "(", ")", ")", "{", "$", "environmentVariables", "=", "(", "array", ")", "$", "environmentVariables", ";", "$", "missingEnvironmentVar...
Require specified ENV vars to be present, or throw Exception. You can also pass through an set of allowed values for the environment variable. @throws \RuntimeException @param mixed $environmentVariables the name of the environment variable or an array of names @param string[] $allowedValues @re...
[ "Require", "specified", "ENV", "vars", "to", "be", "present", "or", "throw", "Exception", ".", "You", "can", "also", "pass", "through", "an", "set", "of", "allowed", "values", "for", "the", "environment", "variable", "." ]
a9102d9d6f70e8b0f6be93153f70849f46489ee1
https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Env.php#L91-L119
train
schpill/thin
src/Env.php
Env.sanitiseVariableValue
protected static function sanitiseVariableValue($value) { $value = trim($value); if (!$value) { return ''; } if (strpbrk($value[0], '"\'') !== false) { // value starts with a quote $quote = $value[0]; $regexPatter...
php
protected static function sanitiseVariableValue($value) { $value = trim($value); if (!$value) { return ''; } if (strpbrk($value[0], '"\'') !== false) { // value starts with a quote $quote = $value[0]; $regexPatter...
[ "protected", "static", "function", "sanitiseVariableValue", "(", "$", "value", ")", "{", "$", "value", "=", "trim", "(", "$", "value", ")", ";", "if", "(", "!", "$", "value", ")", "{", "return", "''", ";", "}", "if", "(", "strpbrk", "(", "$", "valu...
Strips quotes from the environment variable value. @param $value @return string
[ "Strips", "quotes", "from", "the", "environment", "variable", "value", "." ]
a9102d9d6f70e8b0f6be93153f70849f46489ee1
https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Env.php#L165-L200
train
ScreamingDev/phpsemver
lib/PHPSemVer/Trigger/Functions/BodyChanged.php
BodyChanged.handle
public function handle($old, $new) { if ( ! $this->canHandle($old) || ! $this->canHandle($new)) { return null; } if ($this->equals($old, $new)) { return false; } $this->lastException = new FailedConstraint( sprintf( '%s() ...
php
public function handle($old, $new) { if ( ! $this->canHandle($old) || ! $this->canHandle($new)) { return null; } if ($this->equals($old, $new)) { return false; } $this->lastException = new FailedConstraint( sprintf( '%s() ...
[ "public", "function", "handle", "(", "$", "old", ",", "$", "new", ")", "{", "if", "(", "!", "$", "this", "->", "canHandle", "(", "$", "old", ")", "||", "!", "$", "this", "->", "canHandle", "(", "$", "new", ")", ")", "{", "return", "null", ";", ...
Check if body of function has changed. @param Function_ $old @param Function_ $new @return bool
[ "Check", "if", "body", "of", "function", "has", "changed", "." ]
11a4bc508f71dee73d4f5fee2e9d39e7984d3e15
https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Trigger/Functions/BodyChanged.php#L51-L69
train
ScreamingDev/phpsemver
lib/PHPSemVer/Trigger/Functions/BodyChanged.php
BodyChanged.equals
protected function equals($old, $new) { if (is_array($old)) { // compare arrays if (array_keys($old) != array_keys($new)) { return false; } foreach (array_keys($old) as $key) { if ( ! $this->equals($old[$key], $new[$key])) { ...
php
protected function equals($old, $new) { if (is_array($old)) { // compare arrays if (array_keys($old) != array_keys($new)) { return false; } foreach (array_keys($old) as $key) { if ( ! $this->equals($old[$key], $new[$key])) { ...
[ "protected", "function", "equals", "(", "$", "old", ",", "$", "new", ")", "{", "if", "(", "is_array", "(", "$", "old", ")", ")", "{", "// compare arrays", "if", "(", "array_keys", "(", "$", "old", ")", "!=", "array_keys", "(", "$", "new", ")", ")",...
Check if two Node trees are equal. @param Node $old @param Node $new @return bool
[ "Check", "if", "two", "Node", "trees", "are", "equal", "." ]
11a4bc508f71dee73d4f5fee2e9d39e7984d3e15
https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Trigger/Functions/BodyChanged.php#L84-L119
train
ElMijo/php-html-dom
src/PHPHtmlDom/Core/PHPHtmlDomLog.php
PHPHtmlDomLog.logError
final public function logError($msg_code,$data = array()) { self::write(self::compileMessage(self::$error_msg[$msg_code],$data), PEL_ERROR); }
php
final public function logError($msg_code,$data = array()) { self::write(self::compileMessage(self::$error_msg[$msg_code],$data), PEL_ERROR); }
[ "final", "public", "function", "logError", "(", "$", "msg_code", ",", "$", "data", "=", "array", "(", ")", ")", "{", "self", "::", "write", "(", "self", "::", "compileMessage", "(", "self", "::", "$", "error_msg", "[", "$", "msg_code", "]", ",", "$",...
Metodo que permite escribir un log de Error. @param string $msg_code Cadena de texto con el codigo del mensaje de error. @param array $data arreglo con los parametros necesarios para escribir el log. @return void
[ "Metodo", "que", "permite", "escribir", "un", "log", "de", "Error", "." ]
6f294e26f37571e100b885e32b76245c144da6e2
https://github.com/ElMijo/php-html-dom/blob/6f294e26f37571e100b885e32b76245c144da6e2/src/PHPHtmlDom/Core/PHPHtmlDomLog.php#L43-L46
train
ElMijo/php-html-dom
src/PHPHtmlDom/Core/PHPHtmlDomLog.php
PHPHtmlDomLog.logWarn
final public function logWarn($msg_code,$data = array()) { self::write(self::compileMessage(self::$warn_msg[$msg_code],$data), PEL_WARNING); }
php
final public function logWarn($msg_code,$data = array()) { self::write(self::compileMessage(self::$warn_msg[$msg_code],$data), PEL_WARNING); }
[ "final", "public", "function", "logWarn", "(", "$", "msg_code", ",", "$", "data", "=", "array", "(", ")", ")", "{", "self", "::", "write", "(", "self", "::", "compileMessage", "(", "self", "::", "$", "warn_msg", "[", "$", "msg_code", "]", ",", "$", ...
Metodo que permite escribir un log de Advertencia. @param string $msg_code Cadena de texto con el codigo del mensaje de advertencia. @param array $data arreglo con los parametros necesarios para escribir el log. @return void
[ "Metodo", "que", "permite", "escribir", "un", "log", "de", "Advertencia", "." ]
6f294e26f37571e100b885e32b76245c144da6e2
https://github.com/ElMijo/php-html-dom/blob/6f294e26f37571e100b885e32b76245c144da6e2/src/PHPHtmlDom/Core/PHPHtmlDomLog.php#L54-L57
train
andyburton/Sonic-Framework
src/Resource/User.php
User.session
public function session () { if (!($this->session instanceof Session)) { $this->session = Session::singleton ($this->sessionID); } return $this->session; }
php
public function session () { if (!($this->session instanceof Session)) { $this->session = Session::singleton ($this->sessionID); } return $this->session; }
[ "public", "function", "session", "(", ")", "{", "if", "(", "!", "(", "$", "this", "->", "session", "instanceof", "Session", ")", ")", "{", "$", "this", "->", "session", "=", "Session", "::", "singleton", "(", "$", "this", "->", "sessionID", ")", ";",...
Return user session @return \Sonic\Resource\Session
[ "Return", "user", "session" ]
a5999448a0abab4d542413002a780ede391e7374
https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/User.php#L295-L305
train
andyburton/Sonic-Framework
src/Resource/User.php
User.setSessionData
public function setSessionData () { $arr = $this->toArray (); $arr['login_timestamp'] = $this->loginTimestamp; $arr['last_action'] = $this->lastAction; $this->session ()->set (get_called_class (), serialize ($arr)); }
php
public function setSessionData () { $arr = $this->toArray (); $arr['login_timestamp'] = $this->loginTimestamp; $arr['last_action'] = $this->lastAction; $this->session ()->set (get_called_class (), serialize ($arr)); }
[ "public", "function", "setSessionData", "(", ")", "{", "$", "arr", "=", "$", "this", "->", "toArray", "(", ")", ";", "$", "arr", "[", "'login_timestamp'", "]", "=", "$", "this", "->", "loginTimestamp", ";", "$", "arr", "[", "'last_action'", "]", "=", ...
Set user data in a session @return void
[ "Set", "user", "data", "in", "a", "session" ]
a5999448a0abab4d542413002a780ede391e7374
https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/User.php#L353-L363
train
andyburton/Sonic-Framework
src/Resource/User.php
User.updateLastAction
public function updateLastAction () { $arr = $this->getSessionData (); $this->lastAction = time (); $arr['last_action'] = $this->lastAction; $this->session ()->set (get_called_class (), serialize ($arr)); }
php
public function updateLastAction () { $arr = $this->getSessionData (); $this->lastAction = time (); $arr['last_action'] = $this->lastAction; $this->session ()->set (get_called_class (), serialize ($arr)); }
[ "public", "function", "updateLastAction", "(", ")", "{", "$", "arr", "=", "$", "this", "->", "getSessionData", "(", ")", ";", "$", "this", "->", "lastAction", "=", "time", "(", ")", ";", "$", "arr", "[", "'last_action'", "]", "=", "$", "this", "->", ...
Update the last action time to the current time @return void
[ "Update", "the", "last", "action", "time", "to", "the", "current", "time" ]
a5999448a0abab4d542413002a780ede391e7374
https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/User.php#L371-L381
train
andyburton/Sonic-Framework
src/Resource/User.php
User.initSession
public function initSession () { // Get session $session = $this->getSessionData (); // Check session is valid if ($this->checkSession ($session) !== TRUE) { return $this->Logout ('invalid_session'); } // Load user from session $this->fromSessionData (); // Read user if (!$...
php
public function initSession () { // Get session $session = $this->getSessionData (); // Check session is valid if ($this->checkSession ($session) !== TRUE) { return $this->Logout ('invalid_session'); } // Load user from session $this->fromSessionData (); // Read user if (!$...
[ "public", "function", "initSession", "(", ")", "{", "// Get session", "$", "session", "=", "$", "this", "->", "getSessionData", "(", ")", ";", "// Check session is valid", "if", "(", "$", "this", "->", "checkSession", "(", "$", "session", ")", "!==", "TRUE",...
Initialise a user session and check it is valid @return string|boolean Error
[ "Initialise", "a", "user", "session", "and", "check", "it", "is", "valid" ]
a5999448a0abab4d542413002a780ede391e7374
https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/User.php#L389-L453
train
andyburton/Sonic-Framework
src/Resource/User.php
User.validSession
public function validSession () { // Get session $session = $this->getSessionData (); // Check session is valid if ($this->checkSession ($session) !== TRUE) { $this->loggedIn = FALSE; return FALSE; } // If the user is not active or the active status has changed if ($session['act...
php
public function validSession () { // Get session $session = $this->getSessionData (); // Check session is valid if ($this->checkSession ($session) !== TRUE) { $this->loggedIn = FALSE; return FALSE; } // If the user is not active or the active status has changed if ($session['act...
[ "public", "function", "validSession", "(", ")", "{", "// Get session", "$", "session", "=", "$", "this", "->", "getSessionData", "(", ")", ";", "// Check session is valid", "if", "(", "$", "this", "->", "checkSession", "(", "$", "session", ")", "!==", "TRUE"...
Whether the user has a valid session @return boolean
[ "Whether", "the", "user", "has", "a", "valid", "session" ]
a5999448a0abab4d542413002a780ede391e7374
https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/User.php#L461-L500
train
andyburton/Sonic-Framework
src/Resource/User.php
User.checkSession
public function checkSession ($session = FALSE) { // If there is no session, get it if ($session === FALSE) { $session = $this->getSessionData (); } // No id if (!Parser::_ak ($session, 'id', FALSE)) { return 'no_id'; } // No email if (!Parser::_ak ($session, 'email', FALSE)...
php
public function checkSession ($session = FALSE) { // If there is no session, get it if ($session === FALSE) { $session = $this->getSessionData (); } // No id if (!Parser::_ak ($session, 'id', FALSE)) { return 'no_id'; } // No email if (!Parser::_ak ($session, 'email', FALSE)...
[ "public", "function", "checkSession", "(", "$", "session", "=", "FALSE", ")", "{", "// If there is no session, get it", "if", "(", "$", "session", "===", "FALSE", ")", "{", "$", "session", "=", "$", "this", "->", "getSessionData", "(", ")", ";", "}", "// N...
Check that a session is valid @param array $session Session data to check @return string|boolean Error
[ "Check", "that", "a", "session", "is", "valid" ]
a5999448a0abab4d542413002a780ede391e7374
https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/User.php#L509-L558
train
andyburton/Sonic-Framework
src/Resource/User.php
User.Logout
public function Logout ($reason = FALSE) { // Set login status $this->loggedIn = FALSE; // Destroy session $this->session ()->Destroy (); // Remove session data $this->_sessionData = FALSE; // Create a new session $this->session ()->Create (); $this->session ()->Refresh (); ...
php
public function Logout ($reason = FALSE) { // Set login status $this->loggedIn = FALSE; // Destroy session $this->session ()->Destroy (); // Remove session data $this->_sessionData = FALSE; // Create a new session $this->session ()->Create (); $this->session ()->Refresh (); ...
[ "public", "function", "Logout", "(", "$", "reason", "=", "FALSE", ")", "{", "// Set login status", "$", "this", "->", "loggedIn", "=", "FALSE", ";", "// Destroy session", "$", "this", "->", "session", "(", ")", "->", "Destroy", "(", ")", ";", "// Remove se...
Logout the user return string Reason
[ "Logout", "the", "user", "return", "string", "Reason" ]
a5999448a0abab4d542413002a780ede391e7374
https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/User.php#L577-L610
train
andyburton/Sonic-Framework
src/Resource/User.php
User._Authenticate
public static function _Authenticate ($email, $password) { // Get user $user = static::_readFromEmail ($email); if (!$user) { return FALSE; } // Check password return $user->checkPassword ($password); }
php
public static function _Authenticate ($email, $password) { // Get user $user = static::_readFromEmail ($email); if (!$user) { return FALSE; } // Check password return $user->checkPassword ($password); }
[ "public", "static", "function", "_Authenticate", "(", "$", "email", ",", "$", "password", ")", "{", "// Get user", "$", "user", "=", "static", "::", "_readFromEmail", "(", "$", "email", ")", ";", "if", "(", "!", "$", "user", ")", "{", "return", "FALSE"...
Authenticate and attempt to login a user @param string $email User email address @param string $password User password @return boolean
[ "Authenticate", "and", "attempt", "to", "login", "a", "user" ]
a5999448a0abab4d542413002a780ede391e7374
https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/User.php#L666-L682
train
slickframework/form
src/Element/AbstractElement.php
AbstractElement.setValue
public function setValue($value) { $this->value = $value; if ($value instanceof ValueAwareInterface) { $this->value = $value->getFormValue(); } return $this; }
php
public function setValue($value) { $this->value = $value; if ($value instanceof ValueAwareInterface) { $this->value = $value->getFormValue(); } return $this; }
[ "public", "function", "setValue", "(", "$", "value", ")", "{", "$", "this", "->", "value", "=", "$", "value", ";", "if", "(", "$", "value", "instanceof", "ValueAwareInterface", ")", "{", "$", "this", "->", "value", "=", "$", "value", "->", "getFormValu...
Sets the value or content of the element @param mixed $value @return mixed
[ "Sets", "the", "value", "or", "content", "of", "the", "element" ]
e7d536b3bad49194e246ff93587da2589e31a003
https://github.com/slickframework/form/blob/e7d536b3bad49194e246ff93587da2589e31a003/src/Element/AbstractElement.php#L88-L95
train
slickframework/form
src/Element/AbstractElement.php
AbstractElement.getRenderer
protected function getRenderer() { if (null === $this->renderer) { $this->setRenderer(new $this->rendererClass()); } return $this->renderer; }
php
protected function getRenderer() { if (null === $this->renderer) { $this->setRenderer(new $this->rendererClass()); } return $this->renderer; }
[ "protected", "function", "getRenderer", "(", ")", "{", "if", "(", "null", "===", "$", "this", "->", "renderer", ")", "{", "$", "this", "->", "setRenderer", "(", "new", "$", "this", "->", "rendererClass", "(", ")", ")", ";", "}", "return", "$", "this"...
Gets the HTML renderer for this element @return RendererInterface
[ "Gets", "the", "HTML", "renderer", "for", "this", "element" ]
e7d536b3bad49194e246ff93587da2589e31a003
https://github.com/slickframework/form/blob/e7d536b3bad49194e246ff93587da2589e31a003/src/Element/AbstractElement.php#L125-L131
train
DBRisinajumi/d2company
models/CcmpCompany.php
CcmpCompany.getAllGroupCompanies
public static function getAllGroupCompanies($ccgr_id) { $sql = " SELECT ccmp_id, ccmp_name FROM ccxg_company_x_group INNER JOIN ccmp_company ON ccxg_ccmp_id = ccmp_id WHERE ccxg_ccgr_...
php
public static function getAllGroupCompanies($ccgr_id) { $sql = " SELECT ccmp_id, ccmp_name FROM ccxg_company_x_group INNER JOIN ccmp_company ON ccxg_ccmp_id = ccmp_id WHERE ccxg_ccgr_...
[ "public", "static", "function", "getAllGroupCompanies", "(", "$", "ccgr_id", ")", "{", "$", "sql", "=", "\"\n SELECT \n ccmp_id,\n ccmp_name \n FROM\n ccxg_company_x_group \n INNER JOIN ccmp_company \n ...
get all syscomanies array without access control @param int $ccgr_id @return array [ ['ccmp_id' => 1, ccmp_name=>'company name1'], ['ccmp_id' => 2, ccmp_name=>'company name2'], ]
[ "get", "all", "syscomanies", "array", "without", "access", "control" ]
20df0db96ac2c8e73471c4bab7d487b67ef4ed0a
https://github.com/DBRisinajumi/d2company/blob/20df0db96ac2c8e73471c4bab7d487b67ef4ed0a/models/CcmpCompany.php#L439-L455
train
SpoonX/SxMail
src/SxMail/SxMail.php
SxMail.setLayout
public function setLayout($layout = null) { if (null !== $layout && !is_string($layout) && !($layout instanceof ViewModel)) { throw new InvalidArgumentException( 'Invalid value supplied for setLayout.'. 'Expected null, string, or Zend\View\Model\ViewModel.' ...
php
public function setLayout($layout = null) { if (null !== $layout && !is_string($layout) && !($layout instanceof ViewModel)) { throw new InvalidArgumentException( 'Invalid value supplied for setLayout.'. 'Expected null, string, or Zend\View\Model\ViewModel.' ...
[ "public", "function", "setLayout", "(", "$", "layout", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "layout", "&&", "!", "is_string", "(", "$", "layout", ")", "&&", "!", "(", "$", "layout", "instanceof", "ViewModel", ")", ")", "{", "throw", ...
Set the layout. @param mixed $layout Either null (looks in config), ViewModel, or string. @throws \SxMail\Exception\InvalidArgumentException
[ "Set", "the", "layout", "." ]
b0663169cd246ba091f7c84785c69d051a652385
https://github.com/SpoonX/SxMail/blob/b0663169cd246ba091f7c84785c69d051a652385/src/SxMail/SxMail.php#L58-L86
train
SpoonX/SxMail
src/SxMail/SxMail.php
SxMail.manipulateBody
protected function manipulateBody($body, $mimeType = null) { // Make sure we have a string. if ($body instanceof ViewModel) { $body = $this->viewRenderer->render($body); $detectedMimeType = 'text/html'; } elseif (null === $body) { $detected...
php
protected function manipulateBody($body, $mimeType = null) { // Make sure we have a string. if ($body instanceof ViewModel) { $body = $this->viewRenderer->render($body); $detectedMimeType = 'text/html'; } elseif (null === $body) { $detected...
[ "protected", "function", "manipulateBody", "(", "$", "body", ",", "$", "mimeType", "=", "null", ")", "{", "// Make sure we have a string.", "if", "(", "$", "body", "instanceof", "ViewModel", ")", "{", "$", "body", "=", "$", "this", "->", "viewRenderer", "->"...
Manipulate the body based on configuration options. @param mixed $body @param string $mimeType @return string
[ "Manipulate", "the", "body", "based", "on", "configuration", "options", "." ]
b0663169cd246ba091f7c84785c69d051a652385
https://github.com/SpoonX/SxMail/blob/b0663169cd246ba091f7c84785c69d051a652385/src/SxMail/SxMail.php#L106-L161
train
SpoonX/SxMail
src/SxMail/SxMail.php
SxMail.renderTextBody
protected function renderTextBody($body) { $body = html_entity_decode( trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $body))), ENT_QUOTES ); if (empty($body)) { $body = 'To view this email, open it an email client that supports HTML....
php
protected function renderTextBody($body) { $body = html_entity_decode( trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s', '', $body))), ENT_QUOTES ); if (empty($body)) { $body = 'To view this email, open it an email client that supports HTML....
[ "protected", "function", "renderTextBody", "(", "$", "body", ")", "{", "$", "body", "=", "html_entity_decode", "(", "trim", "(", "strip_tags", "(", "preg_replace", "(", "'/<(head|title|style|script)[^>]*>.*?<\\/\\\\1>/s'", ",", "''", ",", "$", "body", ")", ")", ...
Strip html tags and render a text-only version. @param string $body @return string
[ "Strip", "html", "tags", "and", "render", "a", "text", "-", "only", "version", "." ]
b0663169cd246ba091f7c84785c69d051a652385
https://github.com/SpoonX/SxMail/blob/b0663169cd246ba091f7c84785c69d051a652385/src/SxMail/SxMail.php#L170-L181
train
SpoonX/SxMail
src/SxMail/SxMail.php
SxMail.compose
public function compose($body = null, $mimeType = null) { // Supported types are null, ViewModel and string. if (null !== $body && !is_string($body) && !($body instanceof ViewModel)) { throw new InvalidArgumentException( 'Invalid value supplied. Expected null, string or i...
php
public function compose($body = null, $mimeType = null) { // Supported types are null, ViewModel and string. if (null !== $body && !is_string($body) && !($body instanceof ViewModel)) { throw new InvalidArgumentException( 'Invalid value supplied. Expected null, string or i...
[ "public", "function", "compose", "(", "$", "body", "=", "null", ",", "$", "mimeType", "=", "null", ")", "{", "// Supported types are null, ViewModel and string.", "if", "(", "null", "!==", "$", "body", "&&", "!", "is_string", "(", "$", "body", ")", "&&", "...
Compose a new message. @param mixed $body Accepts instance of ViewModel, string and null. @param string $mimeType @return \Zend\Mail\Message @throws \SxMail\Exception\InvalidArgumentException
[ "Compose", "a", "new", "message", "." ]
b0663169cd246ba091f7c84785c69d051a652385
https://github.com/SpoonX/SxMail/blob/b0663169cd246ba091f7c84785c69d051a652385/src/SxMail/SxMail.php#L234-L256
train
interactivesolutions/honeycomb-scripts
src/app/commands/HCRoutes.php
HCRoutes.generateRoutes
private function generateRoutes($directory) { $dirPath = $directory . 'app/routes/'; if( ! file_exists($dirPath) ) return; // get all files recursively /** @var \Iterator $iterator */ $iterator = Finder::create() ->files() ->ignoreDotFil...
php
private function generateRoutes($directory) { $dirPath = $directory . 'app/routes/'; if( ! file_exists($dirPath) ) return; // get all files recursively /** @var \Iterator $iterator */ $iterator = Finder::create() ->files() ->ignoreDotFil...
[ "private", "function", "generateRoutes", "(", "$", "directory", ")", "{", "$", "dirPath", "=", "$", "directory", ".", "'app/routes/'", ";", "if", "(", "!", "file_exists", "(", "$", "dirPath", ")", ")", "return", ";", "// get all files recursively", "/** @var \...
Generating final routes file for package @param $directory
[ "Generating", "final", "routes", "file", "for", "package" ]
be2428ded5219dc612ecc51f43aa4dedff3d034d
https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/HCRoutes.php#L51-L81
train
makinacorpus/drupal-plusql
src/ConstraintRegistry.php
ConstraintRegistry.createInstance
protected function createInstance(Connection $connection, string $type): ConstraintInterface { $driver = $connection->driver(); if (!isset($this->registry[$driver][$type])) { throw new \InvalidArgumentException(sprintf("'%s' constraint is not supported by '%s' driver")); } ...
php
protected function createInstance(Connection $connection, string $type): ConstraintInterface { $driver = $connection->driver(); if (!isset($this->registry[$driver][$type])) { throw new \InvalidArgumentException(sprintf("'%s' constraint is not supported by '%s' driver")); } ...
[ "protected", "function", "createInstance", "(", "Connection", "$", "connection", ",", "string", "$", "type", ")", ":", "ConstraintInterface", "{", "$", "driver", "=", "$", "connection", "->", "driver", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "t...
Create instance for the given connection
[ "Create", "instance", "for", "the", "given", "connection" ]
7182d653a117d53b6bb3e3edd53f07af11ff5d43
https://github.com/makinacorpus/drupal-plusql/blob/7182d653a117d53b6bb3e3edd53f07af11ff5d43/src/ConstraintRegistry.php#L28-L46
train
makinacorpus/drupal-plusql
src/ConstraintRegistry.php
ConstraintRegistry.get
public function get(Connection $connection, string $type): ConstraintInterface { $driver = $connection->driver(); if (isset($this->instances[$driver][$type])) { return $this->instances[$driver][$type]; } return $this->instances[$driver][$type] = $this->createInstance($c...
php
public function get(Connection $connection, string $type): ConstraintInterface { $driver = $connection->driver(); if (isset($this->instances[$driver][$type])) { return $this->instances[$driver][$type]; } return $this->instances[$driver][$type] = $this->createInstance($c...
[ "public", "function", "get", "(", "Connection", "$", "connection", ",", "string", "$", "type", ")", ":", "ConstraintInterface", "{", "$", "driver", "=", "$", "connection", "->", "driver", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "inst...
Get constraint type handler for driver
[ "Get", "constraint", "type", "handler", "for", "driver" ]
7182d653a117d53b6bb3e3edd53f07af11ff5d43
https://github.com/makinacorpus/drupal-plusql/blob/7182d653a117d53b6bb3e3edd53f07af11ff5d43/src/ConstraintRegistry.php#L51-L60
train
makinacorpus/drupal-plusql
src/ConstraintRegistry.php
ConstraintRegistry.getAll
public function getAll(Connection $connection): array { foreach ($this->registry as $types) { foreach (array_keys($types) as $type) { $this->get($connection, $type); } } return $this->instances[$connection->driver()]; }
php
public function getAll(Connection $connection): array { foreach ($this->registry as $types) { foreach (array_keys($types) as $type) { $this->get($connection, $type); } } return $this->instances[$connection->driver()]; }
[ "public", "function", "getAll", "(", "Connection", "$", "connection", ")", ":", "array", "{", "foreach", "(", "$", "this", "->", "registry", "as", "$", "types", ")", "{", "foreach", "(", "array_keys", "(", "$", "types", ")", "as", "$", "type", ")", "...
Get all defined handlers @return ConstraintInterface[]
[ "Get", "all", "defined", "handlers" ]
7182d653a117d53b6bb3e3edd53f07af11ff5d43
https://github.com/makinacorpus/drupal-plusql/blob/7182d653a117d53b6bb3e3edd53f07af11ff5d43/src/ConstraintRegistry.php#L67-L76
train
pmdevelopment/tool-bundle
Twig/Vendor/PicqerBarcodeGeneratorExtension.php
PicqerBarcodeGeneratorExtension.getHtml128
public function getHtml128($string, $pixelPerByte = 2, $height = 30) { $generator = new BarcodeGeneratorHTML(); return $generator->getBarcode($string, BarcodeGeneratorHTML::TYPE_CODE_128, $pixelPerByte, $height); }
php
public function getHtml128($string, $pixelPerByte = 2, $height = 30) { $generator = new BarcodeGeneratorHTML(); return $generator->getBarcode($string, BarcodeGeneratorHTML::TYPE_CODE_128, $pixelPerByte, $height); }
[ "public", "function", "getHtml128", "(", "$", "string", ",", "$", "pixelPerByte", "=", "2", ",", "$", "height", "=", "30", ")", "{", "$", "generator", "=", "new", "BarcodeGeneratorHTML", "(", ")", ";", "return", "$", "generator", "->", "getBarcode", "(",...
Get HTML as CODE-128 @param string $string @return string
[ "Get", "HTML", "as", "CODE", "-", "128" ]
2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129
https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Twig/Vendor/PicqerBarcodeGeneratorExtension.php#L51-L56
train
pmdevelopment/tool-bundle
Twig/Vendor/PicqerBarcodeGeneratorExtension.php
PicqerBarcodeGeneratorExtension.getHtmlEan13
public function getHtmlEan13($string, $pixelPerByte = 2, $height = 30) { $generator = new BarcodeGeneratorHTML(); return $generator->getBarcode($string, BarcodeGeneratorHTML::TYPE_EAN_13, $pixelPerByte, $height); }
php
public function getHtmlEan13($string, $pixelPerByte = 2, $height = 30) { $generator = new BarcodeGeneratorHTML(); return $generator->getBarcode($string, BarcodeGeneratorHTML::TYPE_EAN_13, $pixelPerByte, $height); }
[ "public", "function", "getHtmlEan13", "(", "$", "string", ",", "$", "pixelPerByte", "=", "2", ",", "$", "height", "=", "30", ")", "{", "$", "generator", "=", "new", "BarcodeGeneratorHTML", "(", ")", ";", "return", "$", "generator", "->", "getBarcode", "(...
Get HTML as EAN-13 @param string $string @return string
[ "Get", "HTML", "as", "EAN", "-", "13" ]
2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129
https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Twig/Vendor/PicqerBarcodeGeneratorExtension.php#L65-L70
train
pmdevelopment/tool-bundle
Twig/Vendor/PicqerBarcodeGeneratorExtension.php
PicqerBarcodeGeneratorExtension.getHtmlUpcA
public function getHtmlUpcA($string, $pixelPerByte = 2, $height = 30) { $generator = new BarcodeGeneratorHTML(); return $generator->getBarcode($string, BarcodeGeneratorHTML::TYPE_UPC_A, $pixelPerByte, $height); }
php
public function getHtmlUpcA($string, $pixelPerByte = 2, $height = 30) { $generator = new BarcodeGeneratorHTML(); return $generator->getBarcode($string, BarcodeGeneratorHTML::TYPE_UPC_A, $pixelPerByte, $height); }
[ "public", "function", "getHtmlUpcA", "(", "$", "string", ",", "$", "pixelPerByte", "=", "2", ",", "$", "height", "=", "30", ")", "{", "$", "generator", "=", "new", "BarcodeGeneratorHTML", "(", ")", ";", "return", "$", "generator", "->", "getBarcode", "("...
Get HTML as UPC @param string $string @return string
[ "Get", "HTML", "as", "UPC" ]
2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129
https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Twig/Vendor/PicqerBarcodeGeneratorExtension.php#L79-L84
train
phPoirot/Client-OAuth2
mod/Authenticate/IdentifierHttpToken.php
IdentifierHttpToken._parseTokenFromRequest
private function _parseTokenFromRequest() { if ($this->_c_parsedToken) // From Cached return $this->_c_parsedToken; $this->_c_parsedToken = $r = $this->assertion->parseTokenStrFromRequest( new ServerRequestBridgeInPsr( $this->request() ) ); retu...
php
private function _parseTokenFromRequest() { if ($this->_c_parsedToken) // From Cached return $this->_c_parsedToken; $this->_c_parsedToken = $r = $this->assertion->parseTokenStrFromRequest( new ServerRequestBridgeInPsr( $this->request() ) ); retu...
[ "private", "function", "_parseTokenFromRequest", "(", ")", "{", "if", "(", "$", "this", "->", "_c_parsedToken", ")", "// From Cached", "return", "$", "this", "->", "_c_parsedToken", ";", "$", "this", "->", "_c_parsedToken", "=", "$", "r", "=", "$", "this", ...
Parse Token From Request @return null|string
[ "Parse", "Token", "From", "Request" ]
8745fd54afbbb185669b9e38b1241ecc8ffc7268
https://github.com/phPoirot/Client-OAuth2/blob/8745fd54afbbb185669b9e38b1241ecc8ffc7268/mod/Authenticate/IdentifierHttpToken.php#L141-L153
train
Synapse-Cmf/synapse-cmf
src/Synapse/Cmf/Framework/Media/File/Action/Dal/UploadAction.php
UploadAction.resolve
public function resolve() { if ($this->sourceFile instanceof UploadedFile) { $extension = $this->sourceFile->guessExtension(); $name = preg_filter('/^php(.+)/', '$1', $this->sourceFile->getBasename()); $this->originalName = $this->sourceFile->getClientOriginalName(); ...
php
public function resolve() { if ($this->sourceFile instanceof UploadedFile) { $extension = $this->sourceFile->guessExtension(); $name = preg_filter('/^php(.+)/', '$1', $this->sourceFile->getBasename()); $this->originalName = $this->sourceFile->getClientOriginalName(); ...
[ "public", "function", "resolve", "(", ")", "{", "if", "(", "$", "this", "->", "sourceFile", "instanceof", "UploadedFile", ")", "{", "$", "extension", "=", "$", "this", "->", "sourceFile", "->", "guessExtension", "(", ")", ";", "$", "name", "=", "preg_fil...
Override to handle upload before normal creation.
[ "Override", "to", "handle", "upload", "before", "normal", "creation", "." ]
d8122a4150a83d5607289724425cf35c56a5e880
https://github.com/Synapse-Cmf/synapse-cmf/blob/d8122a4150a83d5607289724425cf35c56a5e880/src/Synapse/Cmf/Framework/Media/File/Action/Dal/UploadAction.php#L21-L44
train
makinacorpus/drupal-plusql
src/ConstraintTrait.php
ConstraintTrait.getSqlName
public function getSqlName(string $table, string $name): string { return $table . '_' . $this->getType() . '_' . $name; }
php
public function getSqlName(string $table, string $name): string { return $table . '_' . $this->getType() . '_' . $name; }
[ "public", "function", "getSqlName", "(", "string", "$", "table", ",", "string", "$", "name", ")", ":", "string", "{", "return", "$", "table", ".", "'_'", ".", "$", "this", "->", "getType", "(", ")", ".", "'_'", ".", "$", "name", ";", "}" ]
Get SQL constraint name
[ "Get", "SQL", "constraint", "name" ]
7182d653a117d53b6bb3e3edd53f07af11ff5d43
https://github.com/makinacorpus/drupal-plusql/blob/7182d653a117d53b6bb3e3edd53f07af11ff5d43/src/ConstraintTrait.php#L43-L46
train
noizu/fragmented-keys
src/NoizuLabs/FragmentedKeys/Key/Standard.php
Standard.getKeyStr
public function getKeyStr($hash = true) { $key = $this->key . self::$INDEX_SEPERATOR . $this->groupId . self::$TAG_SEPERATOR . implode(self::$TAG_SEPERATOR, $this->gatherTags()); if($hash) { $key = md5($key); } return $key; }
php
public function getKeyStr($hash = true) { $key = $this->key . self::$INDEX_SEPERATOR . $this->groupId . self::$TAG_SEPERATOR . implode(self::$TAG_SEPERATOR, $this->gatherTags()); if($hash) { $key = md5($key); } return $key; }
[ "public", "function", "getKeyStr", "(", "$", "hash", "=", "true", ")", "{", "$", "key", "=", "$", "this", "->", "key", ".", "self", "::", "$", "INDEX_SEPERATOR", ".", "$", "this", "->", "groupId", ".", "self", "::", "$", "TAG_SEPERATOR", ".", "implod...
calculate composite key @param bool $hash use true to return md5 (memcache friendly) key or use false to return raw key for visual inspection. @return string
[ "calculate", "composite", "key" ]
5eccc8553ba11920d6d84e20e89b50c28d941b45
https://github.com/noizu/fragmented-keys/blob/5eccc8553ba11920d6d84e20e89b50c28d941b45/src/NoizuLabs/FragmentedKeys/Key/Standard.php#L44-L51
train
ekyna/AdminBundle
Pool/ConfigurationFactory.php
ConfigurationFactory.createConfiguration
public function createConfiguration($prefix, $resourceName, $resourceClass, array $templateList, $eventClass = null, $parentId = null) { return new Configuration( $prefix, $resourceName, $resourceClass, $templateList, $eventClass, $pare...
php
public function createConfiguration($prefix, $resourceName, $resourceClass, array $templateList, $eventClass = null, $parentId = null) { return new Configuration( $prefix, $resourceName, $resourceClass, $templateList, $eventClass, $pare...
[ "public", "function", "createConfiguration", "(", "$", "prefix", ",", "$", "resourceName", ",", "$", "resourceClass", ",", "array", "$", "templateList", ",", "$", "eventClass", "=", "null", ",", "$", "parentId", "=", "null", ")", "{", "return", "new", "Con...
Creates and register a configuration @param string $prefix @param string $resourceName @param string $resourceClass @param array $templateList @param string $eventClass @param string $parentId @return \Ekyna\Bundle\AdminBundle\Pool\Configuration
[ "Creates", "and", "register", "a", "configuration" ]
3f58e253ae9cf651add7f3d587caec80eaea459a
https://github.com/ekyna/AdminBundle/blob/3f58e253ae9cf651add7f3d587caec80eaea459a/Pool/ConfigurationFactory.php#L24-L34
train
anklimsk/cakephp-console-installer
Controller/CheckController.php
CheckController.index
public function index() { $isAppInstalled = $this->Installer->isAppInstalled(); $isAppReadyInstall = $this->InstallerCheck->isAppReadyToInstall(); $phpVesion = $this->InstallerCheck->checkPhpVersion(); $phpModules = $this->InstallerCheck->checkPhpExtensions(); $filesWritable = $this->InstallerCheck->checkFile...
php
public function index() { $isAppInstalled = $this->Installer->isAppInstalled(); $isAppReadyInstall = $this->InstallerCheck->isAppReadyToInstall(); $phpVesion = $this->InstallerCheck->checkPhpVersion(); $phpModules = $this->InstallerCheck->checkPhpExtensions(); $filesWritable = $this->InstallerCheck->checkFile...
[ "public", "function", "index", "(", ")", "{", "$", "isAppInstalled", "=", "$", "this", "->", "Installer", "->", "isAppInstalled", "(", ")", ";", "$", "isAppReadyInstall", "=", "$", "this", "->", "InstallerCheck", "->", "isAppReadyToInstall", "(", ")", ";", ...
Action `index`. Used to view state of installation for application. @return void
[ "Action", "index", ".", "Used", "to", "view", "state", "of", "installation", "for", "application", "." ]
76136550e856ff4f8fd3634b77633f86510f63e9
https://github.com/anklimsk/cakephp-console-installer/blob/76136550e856ff4f8fd3634b77633f86510f63e9/Controller/CheckController.php#L102-L118
train
infusephp/auth
src/Libs/ResetPassword.php
ResetPassword.getUserFromToken
public function getUserFromToken($token) { $expiration = U::unixToDb(time() - UserLink::$forgotLinkTimeframe); $link = UserLink::where('link', $token) ->where('type', UserLink::FORGOT_PASSWORD) ->where('created_at', $expiration, '>') ->first(); if (!$link...
php
public function getUserFromToken($token) { $expiration = U::unixToDb(time() - UserLink::$forgotLinkTimeframe); $link = UserLink::where('link', $token) ->where('type', UserLink::FORGOT_PASSWORD) ->where('created_at', $expiration, '>') ->first(); if (!$link...
[ "public", "function", "getUserFromToken", "(", "$", "token", ")", "{", "$", "expiration", "=", "U", "::", "unixToDb", "(", "time", "(", ")", "-", "UserLink", "::", "$", "forgotLinkTimeframe", ")", ";", "$", "link", "=", "UserLink", "::", "where", "(", ...
Looks up a user from a given forgot token. @param string $token @throws AuthException when the token is invalid. @return \Infuse\Auth\Interfaces\UserInterface
[ "Looks", "up", "a", "user", "from", "a", "given", "forgot", "token", "." ]
720280b4b2635572f331afe8d082e3e88cf54eb7
https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/ResetPassword.php#L47-L62
train
infusephp/auth
src/Libs/ResetPassword.php
ResetPassword.buildLink
public function buildLink($userId, $ip, $userAgent) { $link = new UserLink(); $link->user_id = $userId; $link->type = UserLink::FORGOT_PASSWORD; try { $link->save(); } catch (\Exception $e) { throw new \Exception("Could not create reset password link ...
php
public function buildLink($userId, $ip, $userAgent) { $link = new UserLink(); $link->user_id = $userId; $link->type = UserLink::FORGOT_PASSWORD; try { $link->save(); } catch (\Exception $e) { throw new \Exception("Could not create reset password link ...
[ "public", "function", "buildLink", "(", "$", "userId", ",", "$", "ip", ",", "$", "userAgent", ")", "{", "$", "link", "=", "new", "UserLink", "(", ")", ";", "$", "link", "->", "user_id", "=", "$", "userId", ";", "$", "link", "->", "type", "=", "Us...
Builds a reset password link. @param int $userId @param string $ip @param string $userAgent @return UserLink
[ "Builds", "a", "reset", "password", "link", "." ]
720280b4b2635572f331afe8d082e3e88cf54eb7
https://github.com/infusephp/auth/blob/720280b4b2635572f331afe8d082e3e88cf54eb7/src/Libs/ResetPassword.php#L155-L176
train
wdbo/webdocbook
src/WebDocBook/Helper.php
Helper.fetchArguments
public static function fetchArguments($_class = null, $_method = null, $args = null) { if (empty($_class) || empty($_method)) { return null; } $args_def = array(); if (!empty($args)) { $analyze = new ReflectionMethod($_class, $_method); foreach($an...
php
public static function fetchArguments($_class = null, $_method = null, $args = null) { if (empty($_class) || empty($_method)) { return null; } $args_def = array(); if (!empty($args)) { $analyze = new ReflectionMethod($_class, $_method); foreach($an...
[ "public", "static", "function", "fetchArguments", "(", "$", "_class", "=", "null", ",", "$", "_method", "=", "null", ",", "$", "args", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "_class", ")", "||", "empty", "(", "$", "_method", ")", ")",...
Launch a class's method fetching arguments @param string $_class The class name @param string $_method The class method name @param mixed $args A set of arguments to fetch @return mixed
[ "Launch", "a", "class", "s", "method", "fetching", "arguments" ]
7d4e806f674b6222c9a3e85bfed34e72bc9d584e
https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/Helper.php#L60-L75
train
rhosocial/helpers
BaseTimezone.php
BaseTimezone.generateList
public static function generateList($region = DateTimeZone::ALL) { $regions = array( DateTimeZone::AFRICA, DateTimeZone::AMERICA, DateTimeZone::ANTARCTICA, DateTimeZone::ASIA, DateTimeZone::ATLANTIC, DateTimeZone::AUSTRALIA, ...
php
public static function generateList($region = DateTimeZone::ALL) { $regions = array( DateTimeZone::AFRICA, DateTimeZone::AMERICA, DateTimeZone::ANTARCTICA, DateTimeZone::ASIA, DateTimeZone::ATLANTIC, DateTimeZone::AUSTRALIA, ...
[ "public", "static", "function", "generateList", "(", "$", "region", "=", "DateTimeZone", "::", "ALL", ")", "{", "$", "regions", "=", "array", "(", "DateTimeZone", "::", "AFRICA", ",", "DateTimeZone", "::", "AMERICA", ",", "DateTimeZone", "::", "ANTARCTICA", ...
Generate Time Zone List. @param int $region @return array
[ "Generate", "Time", "Zone", "List", "." ]
547ee6bca153bd35ed21d27606a40748bffcd726
https://github.com/rhosocial/helpers/blob/547ee6bca153bd35ed21d27606a40748bffcd726/BaseTimezone.php#L31-L73
train
slickframework/form
src/Renderer/TextArea.php
TextArea.render
public function render($context = []) { if ($this->getElement()->hasAttribute('value')) { $this->getElement()->getAttributes()->remove('value'); } return parent::render($context); }
php
public function render($context = []) { if ($this->getElement()->hasAttribute('value')) { $this->getElement()->getAttributes()->remove('value'); } return parent::render($context); }
[ "public", "function", "render", "(", "$", "context", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "getElement", "(", ")", "->", "hasAttribute", "(", "'value'", ")", ")", "{", "$", "this", "->", "getElement", "(", ")", "->", "getAttributes",...
Overrides to remove the unnecessary value attribute @param array $context @return string
[ "Overrides", "to", "remove", "the", "unnecessary", "value", "attribute" ]
e7d536b3bad49194e246ff93587da2589e31a003
https://github.com/slickframework/form/blob/e7d536b3bad49194e246ff93587da2589e31a003/src/Renderer/TextArea.php#L25-L31
train
as3io/modlr
src/Store/Cache.php
Cache.clearType
public function clearType($typeKey) { if (isset($this->models[$typeKey])) { unset($this->models[$typeKey]); } return $this; }
php
public function clearType($typeKey) { if (isset($this->models[$typeKey])) { unset($this->models[$typeKey]); } return $this; }
[ "public", "function", "clearType", "(", "$", "typeKey", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "models", "[", "$", "typeKey", "]", ")", ")", "{", "unset", "(", "$", "this", "->", "models", "[", "$", "typeKey", "]", ")", ";", "}", ...
Clears all models in the memory cache for a specific type. @param string $typeKey @return self
[ "Clears", "all", "models", "in", "the", "memory", "cache", "for", "a", "specific", "type", "." ]
7e684b88bb22a2e18397df9402075c6533084b16
https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Store/Cache.php#L53-L59
train
as3io/modlr
src/Store/Cache.php
Cache.push
public function push(Model $model) { $this->models[$model->getType()][$model->getId()] = $model; return $this; }
php
public function push(Model $model) { $this->models[$model->getType()][$model->getId()] = $model; return $this; }
[ "public", "function", "push", "(", "Model", "$", "model", ")", "{", "$", "this", "->", "models", "[", "$", "model", "->", "getType", "(", ")", "]", "[", "$", "model", "->", "getId", "(", ")", "]", "=", "$", "model", ";", "return", "$", "this", ...
Pushes a model into the memory cache. @param Model $model @return self
[ "Pushes", "a", "model", "into", "the", "memory", "cache", "." ]
7e684b88bb22a2e18397df9402075c6533084b16
https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Store/Cache.php#L78-L82
train
as3io/modlr
src/Store/Cache.php
Cache.remove
public function remove($typeKey, $identifier) { if (isset($this->models[$typeKey][$identifier])) { unset($this->models[$typeKey][$identifier]); } return $this; }
php
public function remove($typeKey, $identifier) { if (isset($this->models[$typeKey][$identifier])) { unset($this->models[$typeKey][$identifier]); } return $this; }
[ "public", "function", "remove", "(", "$", "typeKey", ",", "$", "identifier", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "models", "[", "$", "typeKey", "]", "[", "$", "identifier", "]", ")", ")", "{", "unset", "(", "$", "this", "->", "m...
Removes a model from the memory cache, based on type and identifier. @param string $typeKey @param string $identifier @return self
[ "Removes", "a", "model", "from", "the", "memory", "cache", "based", "on", "type", "and", "identifier", "." ]
7e684b88bb22a2e18397df9402075c6533084b16
https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Store/Cache.php#L91-L97
train
as3io/modlr
src/Store/Cache.php
Cache.get
public function get($typeKey, $identifier) { $map = $this->getAllForType($typeKey); if (isset($map[$identifier])) { return $map[$identifier]; } return null; }
php
public function get($typeKey, $identifier) { $map = $this->getAllForType($typeKey); if (isset($map[$identifier])) { return $map[$identifier]; } return null; }
[ "public", "function", "get", "(", "$", "typeKey", ",", "$", "identifier", ")", "{", "$", "map", "=", "$", "this", "->", "getAllForType", "(", "$", "typeKey", ")", ";", "if", "(", "isset", "(", "$", "map", "[", "$", "identifier", "]", ")", ")", "{...
Gets a model from the memory cache, based on type and identifier. @param string $typeKey @param string $identifier @return Model|null
[ "Gets", "a", "model", "from", "the", "memory", "cache", "based", "on", "type", "and", "identifier", "." ]
7e684b88bb22a2e18397df9402075c6533084b16
https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Store/Cache.php#L106-L113
train
CampaignChain/activity-ezplatform
Controller/EZPlatformScheduleHandler.php
EZPlatformScheduleHandler.createContent
public function createContent(Location $location = null, Campaign $campaign = null) { $connection = $this->getRestApiConnectionByLocation($location); $remoteContentTypes = $connection->getContentTypes(); foreach($remoteContentTypes as $remoteContentType){ $id = $location->getId(...
php
public function createContent(Location $location = null, Campaign $campaign = null) { $connection = $this->getRestApiConnectionByLocation($location); $remoteContentTypes = $connection->getContentTypes(); foreach($remoteContentTypes as $remoteContentType){ $id = $location->getId(...
[ "public", "function", "createContent", "(", "Location", "$", "location", "=", "null", ",", "Campaign", "$", "campaign", "=", "null", ")", "{", "$", "connection", "=", "$", "this", "->", "getRestApiConnectionByLocation", "(", "$", "location", ")", ";", "$", ...
When a new Activity is being created, this handler method will be called to retrieve a new Content object for the Activity. Called in these views: - new @param Location $location @param Campaign $campaign @return null
[ "When", "a", "new", "Activity", "is", "being", "created", "this", "handler", "method", "will", "be", "called", "to", "retrieve", "a", "new", "Content", "object", "for", "the", "Activity", "." ]
bf965121bda47d90bcdcf4ef1d651fd9ec42113e
https://github.com/CampaignChain/activity-ezplatform/blob/bf965121bda47d90bcdcf4ef1d651fd9ec42113e/Controller/EZPlatformScheduleHandler.php#L67-L79
train
uiii/tense
src/Console/BoxOutputFormatterStyle.php
BoxOutputFormatterStyle.setPadding
public function setPadding($padding = 0) { $padding = $this->parseSizes($padding); foreach ($padding as $side => $value) { if (! is_int($value) || $value < 0) { throw new InvalidArgumentException(sprintf( 'Invalid %s padding: "%s". Must be a positive integer value.', $side, $value )); } ...
php
public function setPadding($padding = 0) { $padding = $this->parseSizes($padding); foreach ($padding as $side => $value) { if (! is_int($value) || $value < 0) { throw new InvalidArgumentException(sprintf( 'Invalid %s padding: "%s". Must be a positive integer value.', $side, $value )); } ...
[ "public", "function", "setPadding", "(", "$", "padding", "=", "0", ")", "{", "$", "padding", "=", "$", "this", "->", "parseSizes", "(", "$", "padding", ")", ";", "foreach", "(", "$", "padding", "as", "$", "side", "=>", "$", "value", ")", "{", "if",...
Sets style padding. @param array|int $padding The padding value/s
[ "Sets", "style", "padding", "." ]
e5fb4d123f41dbf23796b445389b966c8de2bae1
https://github.com/uiii/tense/blob/e5fb4d123f41dbf23796b445389b966c8de2bae1/src/Console/BoxOutputFormatterStyle.php#L102-L115
train
uiii/tense
src/Console/BoxOutputFormatterStyle.php
BoxOutputFormatterStyle.setMargin
public function setMargin($margin = 0) { $margin = $this->parseSizes($margin); foreach ($margin as $side => $value) { if (! is_int($value) || $value < 0) { throw new InvalidArgumentException(sprintf( 'Invalid %s margin: "%s". Must be a positive integer value.', $side, $value )); } $this...
php
public function setMargin($margin = 0) { $margin = $this->parseSizes($margin); foreach ($margin as $side => $value) { if (! is_int($value) || $value < 0) { throw new InvalidArgumentException(sprintf( 'Invalid %s margin: "%s". Must be a positive integer value.', $side, $value )); } $this...
[ "public", "function", "setMargin", "(", "$", "margin", "=", "0", ")", "{", "$", "margin", "=", "$", "this", "->", "parseSizes", "(", "$", "margin", ")", ";", "foreach", "(", "$", "margin", "as", "$", "side", "=>", "$", "value", ")", "{", "if", "(...
Sets style margin. @param array|int $margin The margin value/s
[ "Sets", "style", "margin", "." ]
e5fb4d123f41dbf23796b445389b966c8de2bae1
https://github.com/uiii/tense/blob/e5fb4d123f41dbf23796b445389b966c8de2bae1/src/Console/BoxOutputFormatterStyle.php#L122-L135
train
wigedev/farm
src/Validator/Validator/Validator.php
Validator.quickValidate
public static function quickValidate(?string $value, array $constraints = []) { // Initialize the validator $validator = new static('quickValidate function', InputFieldTypes::PASSED, [], $value, null); // Add the constraints if (is_array($constraints) && count($constraints) > 0) { ...
php
public static function quickValidate(?string $value, array $constraints = []) { // Initialize the validator $validator = new static('quickValidate function', InputFieldTypes::PASSED, [], $value, null); // Add the constraints if (is_array($constraints) && count($constraints) > 0) { ...
[ "public", "static", "function", "quickValidate", "(", "?", "string", "$", "value", ",", "array", "$", "constraints", "=", "[", "]", ")", "{", "// Initialize the validator", "$", "validator", "=", "new", "static", "(", "'quickValidate function'", ",", "InputField...
Validates input as a one-off. Allows quick and dirty validation. Returns null if the value is not valid. TODO: Decide should this just return true/false if the value is/not valid? @param string $value The value to test @param array $constraints The definition of the constraints @return mixed The value if valid @throw...
[ "Validates", "input", "as", "a", "one", "-", "off", ".", "Allows", "quick", "and", "dirty", "validation", ".", "Returns", "null", "if", "the", "value", "is", "not", "valid", "." ]
7a1729ec78628b7e5435e4a42e42d547a07af851
https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Validator/Validator/Validator.php#L51-L73
train
wigedev/farm
src/Validator/Validator/Validator.php
Validator.addConstraint
public function addConstraint(Constraint $constraint) : void { $constraint->setValidator($this); array_push($this->constraints, $constraint); }
php
public function addConstraint(Constraint $constraint) : void { $constraint->setValidator($this); array_push($this->constraints, $constraint); }
[ "public", "function", "addConstraint", "(", "Constraint", "$", "constraint", ")", ":", "void", "{", "$", "constraint", "->", "setValidator", "(", "$", "this", ")", ";", "array_push", "(", "$", "this", "->", "constraints", ",", "$", "constraint", ")", ";", ...
Add a constraint to the validator @param Constraint $constraint
[ "Add", "a", "constraint", "to", "the", "validator" ]
7a1729ec78628b7e5435e4a42e42d547a07af851
https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Validator/Validator/Validator.php#L125-L129
train
wigedev/farm
src/Validator/Validator/Validator.php
Validator.reportError
public function reportError(string $error_message) : void { $error_message = sprintf($error_message, $this->field_name); if (null != $this->validation_set) { $this->validation_set->addValidationError(new ValidationError($this->field_name, $error_message)); } }
php
public function reportError(string $error_message) : void { $error_message = sprintf($error_message, $this->field_name); if (null != $this->validation_set) { $this->validation_set->addValidationError(new ValidationError($this->field_name, $error_message)); } }
[ "public", "function", "reportError", "(", "string", "$", "error_message", ")", ":", "void", "{", "$", "error_message", "=", "sprintf", "(", "$", "error_message", ",", "$", "this", "->", "field_name", ")", ";", "if", "(", "null", "!=", "$", "this", "->", ...
Report the error message to validation set @param string $error_message The error message to report
[ "Report", "the", "error", "message", "to", "validation", "set" ]
7a1729ec78628b7e5435e4a42e42d547a07af851
https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Validator/Validator/Validator.php#L164-L170
train
wigedev/farm
src/Validator/Validator/Validator.php
Validator.validate
public function validate() : void { $this->value = null; $value = $this->filter($this->raw_value); if (true === $this->checkValidity($value)) { $this->is_valid = true; } else { $this->is_valid = false; $this->reportError($this->error_message); ...
php
public function validate() : void { $this->value = null; $value = $this->filter($this->raw_value); if (true === $this->checkValidity($value)) { $this->is_valid = true; } else { $this->is_valid = false; $this->reportError($this->error_message); ...
[ "public", "function", "validate", "(", ")", ":", "void", "{", "$", "this", "->", "value", "=", "null", ";", "$", "value", "=", "$", "this", "->", "filter", "(", "$", "this", "->", "raw_value", ")", ";", "if", "(", "true", "===", "$", "this", "->"...
Do the validation. This process starts by filtering the value, then checks the validity, and finally checks the constraints.
[ "Do", "the", "validation", ".", "This", "process", "starts", "by", "filtering", "the", "value", "then", "checks", "the", "validity", "and", "finally", "checks", "the", "constraints", "." ]
7a1729ec78628b7e5435e4a42e42d547a07af851
https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/Validator/Validator/Validator.php#L223-L248
train
yii2lab/yii2-rbac
src/domain/repositories/traits/AssignmentTrait.php
AssignmentTrait.getAssignments
public function getAssignments($userId) { if(empty($userId)) { return []; } $roles = $this->allRoleNamesByUserId($userId); return AssignmentHelper::forge($userId, $roles); }
php
public function getAssignments($userId) { if(empty($userId)) { return []; } $roles = $this->allRoleNamesByUserId($userId); return AssignmentHelper::forge($userId, $roles); }
[ "public", "function", "getAssignments", "(", "$", "userId", ")", "{", "if", "(", "empty", "(", "$", "userId", ")", ")", "{", "return", "[", "]", ";", "}", "$", "roles", "=", "$", "this", "->", "allRoleNamesByUserId", "(", "$", "userId", ")", ";", "...
Returns all role assignment information for the specified user. @param string|int $userId the user ID (see [[\yii\web\User::id]]) @return Assignment[] the assignments indexed by role names. An empty array will be returned if there is no role assigned to the user.
[ "Returns", "all", "role", "assignment", "information", "for", "the", "specified", "user", "." ]
e72ac0359af660690c161451f864208b2d20919d
https://github.com/yii2lab/yii2-rbac/blob/e72ac0359af660690c161451f864208b2d20919d/src/domain/repositories/traits/AssignmentTrait.php#L114-L120
train
yii2lab/yii2-rbac
src/domain/repositories/traits/AssignmentTrait.php
AssignmentTrait.revoke
public function revoke($role, $userId) { $userId = $this->getId($userId); $entity = \App::$domain->account->login->oneById($userId); $this->model->deleteAll(['user_id' => $userId, 'item_name' => $role]); }
php
public function revoke($role, $userId) { $userId = $this->getId($userId); $entity = \App::$domain->account->login->oneById($userId); $this->model->deleteAll(['user_id' => $userId, 'item_name' => $role]); }
[ "public", "function", "revoke", "(", "$", "role", ",", "$", "userId", ")", "{", "$", "userId", "=", "$", "this", "->", "getId", "(", "$", "userId", ")", ";", "$", "entity", "=", "\\", "App", "::", "$", "domain", "->", "account", "->", "login", "-...
Revokes a role from a user. @param Role|Permission $role @param string|int $userId the user ID (see [[\yii\web\User::id]]) @return bool whether the revoking is successful
[ "Revokes", "a", "role", "from", "a", "user", "." ]
e72ac0359af660690c161451f864208b2d20919d
https://github.com/yii2lab/yii2-rbac/blob/e72ac0359af660690c161451f864208b2d20919d/src/domain/repositories/traits/AssignmentTrait.php#L151-L155
train
cyberspectrum/i18n-contao
src/Mapping/Terminal42ChangeLanguage/MapBuilder.php
MapBuilder.getPageMap
private function getPageMap(string $sourceLanguage, string $targetLanguage): PageMap { if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->pageMaps)) { return $this->pageMaps[$key] = new PageMap( $sourceLanguage, $targetLanguage, ...
php
private function getPageMap(string $sourceLanguage, string $targetLanguage): PageMap { if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->pageMaps)) { return $this->pageMaps[$key] = new PageMap( $sourceLanguage, $targetLanguage, ...
[ "private", "function", "getPageMap", "(", "string", "$", "sourceLanguage", ",", "string", "$", "targetLanguage", ")", ":", "PageMap", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", "=", "$", "sourceLanguage", ".", "'->'", ".", "$", "targetLanguage...
Retrieve pageMap. @param string $sourceLanguage The source language. @param string $targetLanguage The target language. @return PageMap
[ "Retrieve", "pageMap", "." ]
038cf6ea9c609a734d7476fba256bc4b0db236b7
https://github.com/cyberspectrum/i18n-contao/blob/038cf6ea9c609a734d7476fba256bc4b0db236b7/src/Mapping/Terminal42ChangeLanguage/MapBuilder.php#L133-L145
train
cyberspectrum/i18n-contao
src/Mapping/Terminal42ChangeLanguage/MapBuilder.php
MapBuilder.getArticleMap
private function getArticleMap(string $sourceLanguage, string $targetLanguage): ArticleMap { if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->articleMaps)) { return $this->articleMaps[$key] = new ArticleMap( $this->getPageMap($sourceLanguage, $targetL...
php
private function getArticleMap(string $sourceLanguage, string $targetLanguage): ArticleMap { if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->articleMaps)) { return $this->articleMaps[$key] = new ArticleMap( $this->getPageMap($sourceLanguage, $targetL...
[ "private", "function", "getArticleMap", "(", "string", "$", "sourceLanguage", ",", "string", "$", "targetLanguage", ")", ":", "ArticleMap", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", "=", "$", "sourceLanguage", ".", "'->'", ".", "$", "targetLa...
Retrieve article map. @param string $sourceLanguage The source language. @param string $targetLanguage The target language. @return ArticleMap
[ "Retrieve", "article", "map", "." ]
038cf6ea9c609a734d7476fba256bc4b0db236b7
https://github.com/cyberspectrum/i18n-contao/blob/038cf6ea9c609a734d7476fba256bc4b0db236b7/src/Mapping/Terminal42ChangeLanguage/MapBuilder.php#L155-L165
train
cyberspectrum/i18n-contao
src/Mapping/Terminal42ChangeLanguage/MapBuilder.php
MapBuilder.getArticleContentMap
private function getArticleContentMap(string $sourceLanguage, string $targetLanguage): ArticleContentMap { if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->articleContentMaps)) { return $this->articleContentMaps[$key] = new ArticleContentMap( $this->g...
php
private function getArticleContentMap(string $sourceLanguage, string $targetLanguage): ArticleContentMap { if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->articleContentMaps)) { return $this->articleContentMaps[$key] = new ArticleContentMap( $this->g...
[ "private", "function", "getArticleContentMap", "(", "string", "$", "sourceLanguage", ",", "string", "$", "targetLanguage", ")", ":", "ArticleContentMap", "{", "if", "(", "!", "array_key_exists", "(", "$", "key", "=", "$", "sourceLanguage", ".", "'->'", ".", "$...
Retrieve article content map. @param string $sourceLanguage The source language. @param string $targetLanguage The target language. @return ArticleContentMap
[ "Retrieve", "article", "content", "map", "." ]
038cf6ea9c609a734d7476fba256bc4b0db236b7
https://github.com/cyberspectrum/i18n-contao/blob/038cf6ea9c609a734d7476fba256bc4b0db236b7/src/Mapping/Terminal42ChangeLanguage/MapBuilder.php#L175-L185
train
3ev/wordpress-core
src/Tev/Field/Model/TaxonomyField.php
TaxonomyField.getValue
public function getValue() { $terms = $this->base['value']; if (is_array($terms)) { $ret = array(); foreach ($terms as $t) { $ret[] = $this->termFactory->create($t, $this->taxonomy()); } return $ret; } elseif (is_object($term...
php
public function getValue() { $terms = $this->base['value']; if (is_array($terms)) { $ret = array(); foreach ($terms as $t) { $ret[] = $this->termFactory->create($t, $this->taxonomy()); } return $ret; } elseif (is_object($term...
[ "public", "function", "getValue", "(", ")", "{", "$", "terms", "=", "$", "this", "->", "base", "[", "'value'", "]", ";", "if", "(", "is_array", "(", "$", "terms", ")", ")", "{", "$", "ret", "=", "array", "(", ")", ";", "foreach", "(", "$", "ter...
Get Term or array of Terms. @return \Tev\Term\Model\Term|\Tev\Term\Model\Term[]|null
[ "Get", "Term", "or", "array", "of", "Terms", "." ]
da674fbec5bf3d5bd2a2141680a4c141113eb6b0
https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Field/Model/TaxonomyField.php#L59-L80
train
3ev/wordpress-core
src/Tev/Field/Model/TaxonomyField.php
TaxonomyField.taxonomy
public function taxonomy() { if ($this->_taxonomy === null) { $this->_taxonomy = $this->taxonomyFactory->create($this->base['taxonomy']); } return $this->_taxonomy; }
php
public function taxonomy() { if ($this->_taxonomy === null) { $this->_taxonomy = $this->taxonomyFactory->create($this->base['taxonomy']); } return $this->_taxonomy; }
[ "public", "function", "taxonomy", "(", ")", "{", "if", "(", "$", "this", "->", "_taxonomy", "===", "null", ")", "{", "$", "this", "->", "_taxonomy", "=", "$", "this", "->", "taxonomyFactory", "->", "create", "(", "$", "this", "->", "base", "[", "'tax...
Get Term Taxonomy. @return \Tev\Taxonomy\Model\Taxonomy
[ "Get", "Term", "Taxonomy", "." ]
da674fbec5bf3d5bd2a2141680a4c141113eb6b0
https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Field/Model/TaxonomyField.php#L87-L94
train
as3io/symfony-data-importer
src/Import/Persister.php
Persister.getWriteMode
final public function getWriteMode() { switch ($this->getDataMode()) { case Configuration::DATA_MODE_WIPE: case Configuration::DATA_MODE_PROGRESSIVE: $this->setWriteMode(static::WRITE_MODE_INSERT); break; default: $this->set...
php
final public function getWriteMode() { switch ($this->getDataMode()) { case Configuration::DATA_MODE_WIPE: case Configuration::DATA_MODE_PROGRESSIVE: $this->setWriteMode(static::WRITE_MODE_INSERT); break; default: $this->set...
[ "final", "public", "function", "getWriteMode", "(", ")", "{", "switch", "(", "$", "this", "->", "getDataMode", "(", ")", ")", "{", "case", "Configuration", "::", "DATA_MODE_WIPE", ":", "case", "Configuration", "::", "DATA_MODE_PROGRESSIVE", ":", "$", "this", ...
Returns the current write mode @return string
[ "Returns", "the", "current", "write", "mode" ]
33383e38f20f6b7a4b83da619bd028ac84ced579
https://github.com/as3io/symfony-data-importer/blob/33383e38f20f6b7a4b83da619bd028ac84ced579/src/Import/Persister.php#L128-L139
train
as3io/symfony-data-importer
src/Import/Persister.php
Persister.batchUpdate
final public function batchUpdate($scn, array $criteria, array $update) { return $this->getCollectionForModel($scn)->update($criteria, $update, ['multiple' => true]); }
php
final public function batchUpdate($scn, array $criteria, array $update) { return $this->getCollectionForModel($scn)->update($criteria, $update, ['multiple' => true]); }
[ "final", "public", "function", "batchUpdate", "(", "$", "scn", ",", "array", "$", "criteria", ",", "array", "$", "update", ")", "{", "return", "$", "this", "->", "getCollectionForModel", "(", "$", "scn", ")", "->", "update", "(", "$", "criteria", ",", ...
Performs a batch update @param string $scn @param array $criteria The targeting parameters @param array $update The modifications to make to the targeted documents
[ "Performs", "a", "batch", "update" ]
33383e38f20f6b7a4b83da619bd028ac84ced579
https://github.com/as3io/symfony-data-importer/blob/33383e38f20f6b7a4b83da619bd028ac84ced579/src/Import/Persister.php#L197-L200
train
as3io/symfony-data-importer
src/Import/Persister.php
Persister.doUpsert
final protected function doUpsert($scn, array $kvs) { $upsertKey = isset($kvs['external']) ? 'external' : 'legacy'; $upsertNs = 'legacy' === $upsertKey ? 'source' : 'namespace'; $upsertId = 'legacy' === $upsertKey ? 'id' : 'identifier'; $update = ['$set' => $kvs]; if (!iss...
php
final protected function doUpsert($scn, array $kvs) { $upsertKey = isset($kvs['external']) ? 'external' : 'legacy'; $upsertNs = 'legacy' === $upsertKey ? 'source' : 'namespace'; $upsertId = 'legacy' === $upsertKey ? 'id' : 'identifier'; $update = ['$set' => $kvs]; if (!iss...
[ "final", "protected", "function", "doUpsert", "(", "$", "scn", ",", "array", "$", "kvs", ")", "{", "$", "upsertKey", "=", "isset", "(", "$", "kvs", "[", "'external'", "]", ")", "?", "'external'", ":", "'legacy'", ";", "$", "upsertNs", "=", "'legacy'", ...
Handles a single document upsert @param string $scn The model type @param array $kvs The model's keyValues. @return array The upserted modelValues
[ "Handles", "a", "single", "document", "upsert" ]
33383e38f20f6b7a4b83da619bd028ac84ced579
https://github.com/as3io/symfony-data-importer/blob/33383e38f20f6b7a4b83da619bd028ac84ced579/src/Import/Persister.php#L259-L293
train
as3io/symfony-data-importer
src/Import/Persister.php
Persister.setWriteMode
final protected function setWriteMode($mode) { if (!in_array($mode, [static::WRITE_MODE_INSERT, static::WRITE_MODE_UPSERT, static::WRITE_MODE_UPDATE])) { throw new \InvalidArgumentException(sprintf('Passed write mode "%s" is invalid!', $mode)); } $this->writeMode = $mode; }
php
final protected function setWriteMode($mode) { if (!in_array($mode, [static::WRITE_MODE_INSERT, static::WRITE_MODE_UPSERT, static::WRITE_MODE_UPDATE])) { throw new \InvalidArgumentException(sprintf('Passed write mode "%s" is invalid!', $mode)); } $this->writeMode = $mode; }
[ "final", "protected", "function", "setWriteMode", "(", "$", "mode", ")", "{", "if", "(", "!", "in_array", "(", "$", "mode", ",", "[", "static", "::", "WRITE_MODE_INSERT", ",", "static", "::", "WRITE_MODE_UPSERT", ",", "static", "::", "WRITE_MODE_UPDATE", "]"...
Sets the current write mode @param string $mode The write mode to use.
[ "Sets", "the", "current", "write", "mode" ]
33383e38f20f6b7a4b83da619bd028ac84ced579
https://github.com/as3io/symfony-data-importer/blob/33383e38f20f6b7a4b83da619bd028ac84ced579/src/Import/Persister.php#L311-L317
train
Phpillip/phpillip
src/EventListener/ContentConverterListener.php
ContentConverterListener.onKernelController
public function onKernelController(FilterControllerEvent $event) { $request = $event->getRequest(); $route = $this->routes->get($request->attributes->get('_route')); if ($route && $route->hasContent()) { $this->populateContent($route, $request); } }
php
public function onKernelController(FilterControllerEvent $event) { $request = $event->getRequest(); $route = $this->routes->get($request->attributes->get('_route')); if ($route && $route->hasContent()) { $this->populateContent($route, $request); } }
[ "public", "function", "onKernelController", "(", "FilterControllerEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "route", "=", "$", "this", "->", "routes", "->", "get", "(", "$", "request", "->"...
Handler Kernel Controller events @param FilterControllerEvent $event
[ "Handler", "Kernel", "Controller", "events" ]
c37afaafb536361e7e0b564659f1cd5b80b98be9
https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/EventListener/ContentConverterListener.php#L60-L68
train
tarsana/syntax
src/ObjectSyntax.php
ObjectSyntax.fields
public function fields($value = null) { if (null === $value) { return $this->fields; } $this->fields = $value; return $this; }
php
public function fields($value = null) { if (null === $value) { return $this->fields; } $this->fields = $value; return $this; }
[ "public", "function", "fields", "(", "$", "value", "=", "null", ")", "{", "if", "(", "null", "===", "$", "value", ")", "{", "return", "$", "this", "->", "fields", ";", "}", "$", "this", "->", "fields", "=", "$", "value", ";", "return", "$", "this...
Fields getter and setter. @param array $value @return mixed
[ "Fields", "getter", "and", "setter", "." ]
fd3f8a25e3be0e391c8fd486ccfcffe913ade534
https://github.com/tarsana/syntax/blob/fd3f8a25e3be0e391c8fd486ccfcffe913ade534/src/ObjectSyntax.php#L81-L88
train
tarsana/syntax
src/ObjectSyntax.php
ObjectSyntax.field
public function field(string $name, Syntax $value = null) { if ($value === null) { $names = explode('.', $name); $syntax = $this; foreach ($names as $field) { while (method_exists($syntax, 'syntax')) { $syntax = $syntax->syntax(); ...
php
public function field(string $name, Syntax $value = null) { if ($value === null) { $names = explode('.', $name); $syntax = $this; foreach ($names as $field) { while (method_exists($syntax, 'syntax')) { $syntax = $syntax->syntax(); ...
[ "public", "function", "field", "(", "string", "$", "name", ",", "Syntax", "$", "value", "=", "null", ")", "{", "if", "(", "$", "value", "===", "null", ")", "{", "$", "names", "=", "explode", "(", "'.'", ",", "$", "name", ")", ";", "$", "syntax", ...
Setter and getter of a specific field. @param string $name @param Tarsana\Syntax\Syntax|null $value @return Tarsana\Syntax\Syntax|self @throws InvalidArgumentException
[ "Setter", "and", "getter", "of", "a", "specific", "field", "." ]
fd3f8a25e3be0e391c8fd486ccfcffe913ade534
https://github.com/tarsana/syntax/blob/fd3f8a25e3be0e391c8fd486ccfcffe913ade534/src/ObjectSyntax.php#L99-L119
train
tarsana/syntax
src/ObjectSyntax.php
ObjectSyntax.clearValues
protected function clearValues() { $this->values = []; foreach ($this->fields as $name => $syntax) { $this->values[$name] = (object) [ 'value' => null, 'error' => static::MISSING_FIELD ]; } }
php
protected function clearValues() { $this->values = []; foreach ($this->fields as $name => $syntax) { $this->values[$name] = (object) [ 'value' => null, 'error' => static::MISSING_FIELD ]; } }
[ "protected", "function", "clearValues", "(", ")", "{", "$", "this", "->", "values", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "fields", "as", "$", "name", "=>", "$", "syntax", ")", "{", "$", "this", "->", "values", "[", "$", "name", ...
Clears the parsed values. @return void
[ "Clears", "the", "parsed", "values", "." ]
fd3f8a25e3be0e391c8fd486ccfcffe913ade534
https://github.com/tarsana/syntax/blob/fd3f8a25e3be0e391c8fd486ccfcffe913ade534/src/ObjectSyntax.php#L152-L161
train
tarsana/syntax
src/ObjectSyntax.php
ObjectSyntax.dump
public function dump($value) : string { $value = (array) $value; $result = []; $current = ''; $missingField = false; try { foreach ($this->fields as $name => $syntax) { $current = $name; if (!array_key_exists($name, $value)) { ...
php
public function dump($value) : string { $value = (array) $value; $result = []; $current = ''; $missingField = false; try { foreach ($this->fields as $name => $syntax) { $current = $name; if (!array_key_exists($name, $value)) { ...
[ "public", "function", "dump", "(", "$", "value", ")", ":", "string", "{", "$", "value", "=", "(", "array", ")", "$", "value", ";", "$", "result", "=", "[", "]", ";", "$", "current", "=", "''", ";", "$", "missingField", "=", "false", ";", "try", ...
Transforms an object to a string based on the fields or throws a DumpException. @param mixed $value @return string @throws Tarsana\Syntax\Exceptions\DumpException
[ "Transforms", "an", "object", "to", "a", "string", "based", "on", "the", "fields", "or", "throws", "a", "DumpException", "." ]
fd3f8a25e3be0e391c8fd486ccfcffe913ade534
https://github.com/tarsana/syntax/blob/fd3f8a25e3be0e391c8fd486ccfcffe913ade534/src/ObjectSyntax.php#L250-L273
train
valu-digital/valuso
src/ValuSo/Feature/OptionsTrait.php
OptionsTrait.setOptions
public function setOptions($options) { if (!is_array($options) && !$options instanceof \Traversable) { throw new \InvalidArgumentException(sprintf( 'Parameter provided to %s must be an array or Traversable', __METHOD__ )); } ...
php
public function setOptions($options) { if (!is_array($options) && !$options instanceof \Traversable) { throw new \InvalidArgumentException(sprintf( 'Parameter provided to %s must be an array or Traversable', __METHOD__ )); } ...
[ "public", "function", "setOptions", "(", "$", "options", ")", "{", "if", "(", "!", "is_array", "(", "$", "options", ")", "&&", "!", "$", "options", "instanceof", "\\", "Traversable", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "sprintf...
Set service options from array or traversable object @param array|Traversable $options @return \stdClass @ValuSo\Exclude
[ "Set", "service", "options", "from", "array", "or", "traversable", "object" ]
c96bed0f6bd21551822334fe6cfe913a7436dd17
https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Feature/OptionsTrait.php#L22-L36
train
valu-digital/valuso
src/ValuSo/Feature/OptionsTrait.php
OptionsTrait.getOptions
public function getOptions() { if(!$this->options){ if (isset($this->optionsClass)) { $this->options = new $this->optionsClass(array()); } else { $this->options = new Options(array()); } } return $this->options; }
php
public function getOptions() { if(!$this->options){ if (isset($this->optionsClass)) { $this->options = new $this->optionsClass(array()); } else { $this->options = new Options(array()); } } return $this->options; }
[ "public", "function", "getOptions", "(", ")", "{", "if", "(", "!", "$", "this", "->", "options", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "optionsClass", ")", ")", "{", "$", "this", "->", "options", "=", "new", "$", "this", "->", "op...
Retrieve service options @return \Zend\Stdlib\ParameterObjectInterface @ValuSo\Exclude
[ "Retrieve", "service", "options" ]
c96bed0f6bd21551822334fe6cfe913a7436dd17
https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Feature/OptionsTrait.php#L45-L56
train
valu-digital/valuso
src/ValuSo/Feature/OptionsTrait.php
OptionsTrait.getOption
public function getOption($key, $default = null) { if ($this->hasOption($key)) { return $this->getOptions()->__get($key); } return $default; }
php
public function getOption($key, $default = null) { if ($this->hasOption($key)) { return $this->getOptions()->__get($key); } return $default; }
[ "public", "function", "getOption", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "this", "->", "hasOption", "(", "$", "key", ")", ")", "{", "return", "$", "this", "->", "getOptions", "(", ")", "->", "__get", "(", "$...
Retrieve a single option @param string $key @return mixed @ValuSo\Exclude
[ "Retrieve", "a", "single", "option" ]
c96bed0f6bd21551822334fe6cfe913a7436dd17
https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Feature/OptionsTrait.php#L94-L101
train
valu-digital/valuso
src/ValuSo/Feature/OptionsTrait.php
OptionsTrait.setConfig
public function setConfig($config) { if(is_string($config)){ if (file_exists($config)) { $config = \Zend\Config\Factory::fromFile($config); } else { throw new \InvalidArgumentException( sprintf('Unable to read configurations from fi...
php
public function setConfig($config) { if(is_string($config)){ if (file_exists($config)) { $config = \Zend\Config\Factory::fromFile($config); } else { throw new \InvalidArgumentException( sprintf('Unable to read configurations from fi...
[ "public", "function", "setConfig", "(", "$", "config", ")", "{", "if", "(", "is_string", "(", "$", "config", ")", ")", "{", "if", "(", "file_exists", "(", "$", "config", ")", ")", "{", "$", "config", "=", "\\", "Zend", "\\", "Config", "\\", "Factor...
Set options as config file, array or traversable object @param string|array|\Traversable $config @ValuSo\Exclude
[ "Set", "options", "as", "config", "file", "array", "or", "traversable", "object" ]
c96bed0f6bd21551822334fe6cfe913a7436dd17
https://github.com/valu-digital/valuso/blob/c96bed0f6bd21551822334fe6cfe913a7436dd17/src/ValuSo/Feature/OptionsTrait.php#L124-L142
train
JDGrimes/wp-filesystem-mock
src/wp-mock-filesystem.php
WP_Mock_Filesystem.normalize_path
protected function normalize_path( $path ) { $path = str_replace( '\\', '/', $path ); $path = preg_replace( '|/+|','/', $path ); return rtrim( $path, '/' ); }
php
protected function normalize_path( $path ) { $path = str_replace( '\\', '/', $path ); $path = preg_replace( '|/+|','/', $path ); return rtrim( $path, '/' ); }
[ "protected", "function", "normalize_path", "(", "$", "path", ")", "{", "$", "path", "=", "str_replace", "(", "'\\\\'", ",", "'/'", ",", "$", "path", ")", ";", "$", "path", "=", "preg_replace", "(", "'|/+|'", ",", "'/'", ",", "$", "path", ")", ";", ...
Normalize a path. @since 0.1.0 @param string $path The path to normalize. @return string The normalized path.
[ "Normalize", "a", "path", "." ]
986df3bfeb1554ae19856537dfeb558037275c25
https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L53-L59
train
JDGrimes/wp-filesystem-mock
src/wp-mock-filesystem.php
WP_Mock_Filesystem.get_file
protected function get_file( $file ) { $path_parts = $this->parse_path( $file ); if ( '' === $path_parts[0] ) { $file = $this->root; unset( $path_parts[0] ); } else { $file = $this->cwd; } foreach ( $path_parts as $part ) { if ( '' === $part ) { continue; } if ( 'dir' !== $file->typ...
php
protected function get_file( $file ) { $path_parts = $this->parse_path( $file ); if ( '' === $path_parts[0] ) { $file = $this->root; unset( $path_parts[0] ); } else { $file = $this->cwd; } foreach ( $path_parts as $part ) { if ( '' === $part ) { continue; } if ( 'dir' !== $file->typ...
[ "protected", "function", "get_file", "(", "$", "file", ")", "{", "$", "path_parts", "=", "$", "this", "->", "parse_path", "(", "$", "file", ")", ";", "if", "(", "''", "===", "$", "path_parts", "[", "0", "]", ")", "{", "$", "file", "=", "$", "this...
Get the data for a file. @since 0.1.0 @param string $file The file to retrieve. @return object|false The file data, or false if it does't exist.
[ "Get", "the", "data", "for", "a", "file", "." ]
986df3bfeb1554ae19856537dfeb558037275c25
https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L84-L109
train
JDGrimes/wp-filesystem-mock
src/wp-mock-filesystem.php
WP_Mock_Filesystem.get_default_atts
protected function get_default_atts( $atts ) { if ( false === isset( $atts['type'] ) ) { $atts['type'] = 'file'; } if ( 'file' === $atts['type'] ) { $defaults = array( 'contents' => '', 'mode' => 0644, 'size' => 0, ); } elseif ( 'dir' === $atts['type'] ) { $defaults = array( 'contents' => new stdClas...
php
protected function get_default_atts( $atts ) { if ( false === isset( $atts['type'] ) ) { $atts['type'] = 'file'; } if ( 'file' === $atts['type'] ) { $defaults = array( 'contents' => '', 'mode' => 0644, 'size' => 0, ); } elseif ( 'dir' === $atts['type'] ) { $defaults = array( 'contents' => new stdClas...
[ "protected", "function", "get_default_atts", "(", "$", "atts", ")", "{", "if", "(", "false", "===", "isset", "(", "$", "atts", "[", "'type'", "]", ")", ")", "{", "$", "atts", "[", "'type'", "]", "=", "'file'", ";", "}", "if", "(", "'file'", "===", ...
Get the default attributes for a file. @since 0.1.0 @param string $atts @return object The attributes.
[ "Get", "the", "default", "attributes", "for", "a", "file", "." ]
986df3bfeb1554ae19856537dfeb558037275c25
https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L120-L150
train
JDGrimes/wp-filesystem-mock
src/wp-mock-filesystem.php
WP_Mock_Filesystem.add_file
public function add_file( $file, array $atts = array() ) { $parent = $this->get_file( dirname( $file ) ); $filename = basename( $file ); if ( false === $parent || true === isset( $parent->contents->$filename ) ) { return false; } $parent->contents->$filename = $this->get_default_atts( $atts ); return...
php
public function add_file( $file, array $atts = array() ) { $parent = $this->get_file( dirname( $file ) ); $filename = basename( $file ); if ( false === $parent || true === isset( $parent->contents->$filename ) ) { return false; } $parent->contents->$filename = $this->get_default_atts( $atts ); return...
[ "public", "function", "add_file", "(", "$", "file", ",", "array", "$", "atts", "=", "array", "(", ")", ")", "{", "$", "parent", "=", "$", "this", "->", "get_file", "(", "dirname", "(", "$", "file", ")", ")", ";", "$", "filename", "=", "basename", ...
Create a file or directory. @since 0.1.0 @param string $file The path of the file/directory to create. @param array $atts The attributes of the file/directory. @return bool True if the file was added, false otherwise.
[ "Create", "a", "file", "or", "directory", "." ]
986df3bfeb1554ae19856537dfeb558037275c25
https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L175-L187
train
JDGrimes/wp-filesystem-mock
src/wp-mock-filesystem.php
WP_Mock_Filesystem.mkdir_p
public function mkdir_p( $file, array $atts = array() ) { $dir_levels = $this->parse_path( $file ); $path = ''; $atts['type'] = 'dir'; foreach ( $dir_levels as $level ) { $path .= '/' . $level; if ( $this->exists( $path ) ) { continue; } if ( ! $this->add_file( $path, $atts ) ) { retur...
php
public function mkdir_p( $file, array $atts = array() ) { $dir_levels = $this->parse_path( $file ); $path = ''; $atts['type'] = 'dir'; foreach ( $dir_levels as $level ) { $path .= '/' . $level; if ( $this->exists( $path ) ) { continue; } if ( ! $this->add_file( $path, $atts ) ) { retur...
[ "public", "function", "mkdir_p", "(", "$", "file", ",", "array", "$", "atts", "=", "array", "(", ")", ")", "{", "$", "dir_levels", "=", "$", "this", "->", "parse_path", "(", "$", "file", ")", ";", "$", "path", "=", "''", ";", "$", "atts", "[", ...
Create a deep directory. @since 0.1.0 @param string $file The path of the file/directory to create. @param array $atts The attributes of the file/directory. @return bool True if the file was added, false otherwise.
[ "Create", "a", "deep", "directory", "." ]
986df3bfeb1554ae19856537dfeb558037275c25
https://github.com/JDGrimes/wp-filesystem-mock/blob/986df3bfeb1554ae19856537dfeb558037275c25/src/wp-mock-filesystem.php#L199-L220
train