repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
eghojansu/moe
src/Base.php
Base.until
function until($func,$args=NULL,$timeout=60) { if (!$args) $args=array(); $time=time(); $limit=max(0,min($timeout,$max=ini_get('max_execution_time')-1)); $out=''; $flag=FALSE; // Not for the weak of heart while ( // Still alive? !connection_aborted() && // Got time left? (time()-$time+1<$limit) && // Restart session $flag=@session_start() && // CAUTION: Callback will kill host if it never becomes truthy! !($out=$this->call($func,$args))) { session_commit(); ob_flush(); flush(); // Hush down sleep(1); } if ($flag) { session_commit(); ob_flush(); flush(); } return $out; }
php
function until($func,$args=NULL,$timeout=60) { if (!$args) $args=array(); $time=time(); $limit=max(0,min($timeout,$max=ini_get('max_execution_time')-1)); $out=''; $flag=FALSE; // Not for the weak of heart while ( // Still alive? !connection_aborted() && // Got time left? (time()-$time+1<$limit) && // Restart session $flag=@session_start() && // CAUTION: Callback will kill host if it never becomes truthy! !($out=$this->call($func,$args))) { session_commit(); ob_flush(); flush(); // Hush down sleep(1); } if ($flag) { session_commit(); ob_flush(); flush(); } return $out; }
[ "function", "until", "(", "$", "func", ",", "$", "args", "=", "NULL", ",", "$", "timeout", "=", "60", ")", "{", "if", "(", "!", "$", "args", ")", "$", "args", "=", "array", "(", ")", ";", "$", "time", "=", "time", "(", ")", ";", "$", "limit...
Loop until callback returns TRUE (for long polling) @return mixed @param $func callback @param $args array @param $timeout int
[ "Loop", "until", "callback", "returns", "TRUE", "(", "for", "long", "polling", ")" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1787-L1816
eghojansu/moe
src/Base.php
Base.grab
function grab($func,$args=NULL) { if (preg_match('/(.+)\h*(->|::)\h*(.+)/s',$func,$parts)) { // Convert string to executable PHP callback if (!class_exists($parts[1])) user_error(sprintf(self::E_Class,$parts[1]),E_USER_ERROR); if ($parts[2]=='->') { if (is_subclass_of($parts[1],'Prefab')) $parts[1]=call_user_func($parts[1].'::instance'); else { $ref=new ReflectionClass($parts[1]); $parts[1]=method_exists($parts[1],'__construct')? $ref->newinstanceargs($args): $ref->newinstance(); } } $func=array($parts[1],$parts[3]); } return $func; }
php
function grab($func,$args=NULL) { if (preg_match('/(.+)\h*(->|::)\h*(.+)/s',$func,$parts)) { // Convert string to executable PHP callback if (!class_exists($parts[1])) user_error(sprintf(self::E_Class,$parts[1]),E_USER_ERROR); if ($parts[2]=='->') { if (is_subclass_of($parts[1],'Prefab')) $parts[1]=call_user_func($parts[1].'::instance'); else { $ref=new ReflectionClass($parts[1]); $parts[1]=method_exists($parts[1],'__construct')? $ref->newinstanceargs($args): $ref->newinstance(); } } $func=array($parts[1],$parts[3]); } return $func; }
[ "function", "grab", "(", "$", "func", ",", "$", "args", "=", "NULL", ")", "{", "if", "(", "preg_match", "(", "'/(.+)\\h*(->|::)\\h*(.+)/s'", ",", "$", "func", ",", "$", "parts", ")", ")", "{", "// Convert string to executable PHP callback", "if", "(", "!", ...
Grab the real route handler behind the string expression @return string|array @param $func string @param $args array
[ "Grab", "the", "real", "route", "handler", "behind", "the", "string", "expression" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1838-L1856
eghojansu/moe
src/Base.php
Base.call
function call($func,$args=NULL,$hooks='') { if (!is_array($args)) $args=array($args); // Grab the real handler behind the string representation if (is_string($func)) $func=$this->grab($func,$args); // Execute function; abort if callback/hook returns FALSE if (!is_callable($func)) // No route handler if ($hooks=='beforeroute,afterroute') { $allowed=array(); if (is_array($func)) $allowed=array_intersect( array_map('strtoupper',get_class_methods($func[0])), explode('|',self::VERBS) ); header('Allow: '.implode(',',$allowed)); $this->error(405); } else user_error(sprintf(self::E_Method, is_string($func)?$func:$this->stringify($func)), E_USER_ERROR); $obj=FALSE; if (is_array($func)) { $hooks=$this->split($hooks); $obj=TRUE; } // Execute pre-route hook if any if ($obj && $hooks && in_array($hook='beforeroute',$hooks) && method_exists($func[0],$hook) && call_user_func_array(array($func[0],$hook),$args)===FALSE) return FALSE; // Execute callback $out=call_user_func_array($func,$args?:array()); if ($out===FALSE) return FALSE; // Execute post-route hook if any if ($obj && $hooks && in_array($hook='afterroute',$hooks) && method_exists($func[0],$hook) && call_user_func_array(array($func[0],$hook),$args)===FALSE) return FALSE; return $out; }
php
function call($func,$args=NULL,$hooks='') { if (!is_array($args)) $args=array($args); // Grab the real handler behind the string representation if (is_string($func)) $func=$this->grab($func,$args); // Execute function; abort if callback/hook returns FALSE if (!is_callable($func)) // No route handler if ($hooks=='beforeroute,afterroute') { $allowed=array(); if (is_array($func)) $allowed=array_intersect( array_map('strtoupper',get_class_methods($func[0])), explode('|',self::VERBS) ); header('Allow: '.implode(',',$allowed)); $this->error(405); } else user_error(sprintf(self::E_Method, is_string($func)?$func:$this->stringify($func)), E_USER_ERROR); $obj=FALSE; if (is_array($func)) { $hooks=$this->split($hooks); $obj=TRUE; } // Execute pre-route hook if any if ($obj && $hooks && in_array($hook='beforeroute',$hooks) && method_exists($func[0],$hook) && call_user_func_array(array($func[0],$hook),$args)===FALSE) return FALSE; // Execute callback $out=call_user_func_array($func,$args?:array()); if ($out===FALSE) return FALSE; // Execute post-route hook if any if ($obj && $hooks && in_array($hook='afterroute',$hooks) && method_exists($func[0],$hook) && call_user_func_array(array($func[0],$hook),$args)===FALSE) return FALSE; return $out; }
[ "function", "call", "(", "$", "func", ",", "$", "args", "=", "NULL", ",", "$", "hooks", "=", "''", ")", "{", "if", "(", "!", "is_array", "(", "$", "args", ")", ")", "$", "args", "=", "array", "(", "$", "args", ")", ";", "// Grab the real handler ...
Execute callback/hooks (supports 'class->method' format) @return mixed|FALSE @param $func callback @param $args mixed @param $hooks string
[ "Execute", "callback", "/", "hooks", "(", "supports", "class", "-", ">", "method", "format", ")" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1865-L1908
eghojansu/moe
src/Base.php
Base.config
function config($file) { preg_match_all( '/(?<=^|\n)(?:'. '\[(?<section>.+?)\]|'. '(?<lval>[^\h\r\n;].*?)\h*=\h*'. '(?<rval>(?:\\\\\h*\r?\n|.+?)*)'. ')(?=\r?\n|$)/', $this->read($file), $matches,PREG_SET_ORDER); if ($matches) { $sec='globals'; foreach ($matches as $match) { if ($match['section']) { $sec=$match['section']; if (preg_match('/^(?!(?:global|config|route|map|redirect)s\b)'. '((?:\.?\w)+)/i',$sec,$msec) && !$this->exists($msec[0])) $this->set($msec[0],NULL); } else { if (preg_match('/^(config|route|map|redirect)s\b/i', $sec,$cmd)) { call_user_func_array( array($this,$cmd[1]), array_merge(array($match['lval']), str_getcsv($match['rval']))); } else { $args=array_map( function($val) { if (is_numeric($val)) return $val+0; $val=ltrim($val); if (preg_match('/^\w+$/i',$val) && defined($val)) return constant($val); return trim(preg_replace( array('/\\\\"/','/\\\\\h*(\r?\n)/'), array('"','\1'),$val)); }, // Mark quoted strings with 0x00 whitespace str_getcsv(preg_replace('/(?<!\\\\)(")(.*?)\1/', "\\1\x00\\2\\1",$match['rval'])) ); preg_match('/^(?<section>[^:]+)(?:\:(?<func>.+))?/', $sec,$parts); $func=isset($parts['func'])?$parts['func']:NULL; $custom=(strtolower($parts['section'])!='globals'); if ($func) $args=array($this->call($func, count($args)>1?array($args):$args)); call_user_func_array( array($this,'set'), array_merge( array( ($custom?($parts['section'].'.'):''). $match['lval'] ), count($args)>1?array($args):$args ) ); } } } } return $this; }
php
function config($file) { preg_match_all( '/(?<=^|\n)(?:'. '\[(?<section>.+?)\]|'. '(?<lval>[^\h\r\n;].*?)\h*=\h*'. '(?<rval>(?:\\\\\h*\r?\n|.+?)*)'. ')(?=\r?\n|$)/', $this->read($file), $matches,PREG_SET_ORDER); if ($matches) { $sec='globals'; foreach ($matches as $match) { if ($match['section']) { $sec=$match['section']; if (preg_match('/^(?!(?:global|config|route|map|redirect)s\b)'. '((?:\.?\w)+)/i',$sec,$msec) && !$this->exists($msec[0])) $this->set($msec[0],NULL); } else { if (preg_match('/^(config|route|map|redirect)s\b/i', $sec,$cmd)) { call_user_func_array( array($this,$cmd[1]), array_merge(array($match['lval']), str_getcsv($match['rval']))); } else { $args=array_map( function($val) { if (is_numeric($val)) return $val+0; $val=ltrim($val); if (preg_match('/^\w+$/i',$val) && defined($val)) return constant($val); return trim(preg_replace( array('/\\\\"/','/\\\\\h*(\r?\n)/'), array('"','\1'),$val)); }, // Mark quoted strings with 0x00 whitespace str_getcsv(preg_replace('/(?<!\\\\)(")(.*?)\1/', "\\1\x00\\2\\1",$match['rval'])) ); preg_match('/^(?<section>[^:]+)(?:\:(?<func>.+))?/', $sec,$parts); $func=isset($parts['func'])?$parts['func']:NULL; $custom=(strtolower($parts['section'])!='globals'); if ($func) $args=array($this->call($func, count($args)>1?array($args):$args)); call_user_func_array( array($this,'set'), array_merge( array( ($custom?($parts['section'].'.'):''). $match['lval'] ), count($args)>1?array($args):$args ) ); } } } } return $this; }
[ "function", "config", "(", "$", "file", ")", "{", "preg_match_all", "(", "'/(?<=^|\\n)(?:'", ".", "'\\[(?<section>.+?)\\]|'", ".", "'(?<lval>[^\\h\\r\\n;].*?)\\h*=\\h*'", ".", "'(?<rval>(?:\\\\\\\\\\h*\\r?\\n|.+?)*)'", ".", "')(?=\\r?\\n|$)/'", ",", "$", "this", "->", "re...
Configure framework according to .ini-style file settings; If optional 2nd arg is provided, template strings are interpreted @return object @param $file string
[ "Configure", "framework", "according", "to", ".", "ini", "-", "style", "file", "settings", ";", "If", "optional", "2nd", "arg", "is", "provided", "template", "strings", "are", "interpreted" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L1943-L2008
eghojansu/moe
src/Base.php
Base.highlight
function highlight($text) { $out=''; $pre=FALSE; $text=trim($text); if (!preg_match('/^<\?php/',$text)) { $text='<?php '.$text; $pre=TRUE; } foreach (token_get_all($text) as $token) if ($pre) $pre=FALSE; else $out.='<span'. (is_array($token)? (' class="'. substr(strtolower(token_name($token[0])),2).'">'. $this->encode($token[1]).''): ('>'.$this->encode($token))). '</span>'; return $out?('<code>'.$out.'</code>'):$text; }
php
function highlight($text) { $out=''; $pre=FALSE; $text=trim($text); if (!preg_match('/^<\?php/',$text)) { $text='<?php '.$text; $pre=TRUE; } foreach (token_get_all($text) as $token) if ($pre) $pre=FALSE; else $out.='<span'. (is_array($token)? (' class="'. substr(strtolower(token_name($token[0])),2).'">'. $this->encode($token[1]).''): ('>'.$this->encode($token))). '</span>'; return $out?('<code>'.$out.'</code>'):$text; }
[ "function", "highlight", "(", "$", "text", ")", "{", "$", "out", "=", "''", ";", "$", "pre", "=", "FALSE", ";", "$", "text", "=", "trim", "(", "$", "text", ")", ";", "if", "(", "!", "preg_match", "(", "'/^<\\?php/'", ",", "$", "text", ")", ")",...
Apply syntax highlighting @return string @param $text string
[ "Apply", "syntax", "highlighting" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L2062-L2082
eghojansu/moe
src/Base.php
Base.unload
function unload($cwd) { chdir($cwd); if (!$error=error_get_last()) @session_commit(); $handler=$this->hive['UNLOAD']; if ((!$handler || $this->call($handler,$this)===FALSE) && $error && in_array($error['type'], array(E_ERROR,E_PARSE,E_CORE_ERROR,E_COMPILE_ERROR))) // Fatal error detected $this->error(500,sprintf(self::E_Fatal,$error['message']), array($error)); }
php
function unload($cwd) { chdir($cwd); if (!$error=error_get_last()) @session_commit(); $handler=$this->hive['UNLOAD']; if ((!$handler || $this->call($handler,$this)===FALSE) && $error && in_array($error['type'], array(E_ERROR,E_PARSE,E_CORE_ERROR,E_COMPILE_ERROR))) // Fatal error detected $this->error(500,sprintf(self::E_Fatal,$error['message']), array($error)); }
[ "function", "unload", "(", "$", "cwd", ")", "{", "chdir", "(", "$", "cwd", ")", ";", "if", "(", "!", "$", "error", "=", "error_get_last", "(", ")", ")", "@", "session_commit", "(", ")", ";", "$", "handler", "=", "$", "this", "->", "hive", "[", ...
Execute framework/application shutdown sequence @return NULL @param $cwd string
[ "Execute", "framework", "/", "application", "shutdown", "sequence" ]
train
https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Base.php#L2108-L2119
Eresus/EresusCMS
src/core/lib/sections.php
Sections.index
private function index($force = false) { if ($force || !$this->index) { $items = Eresus_CMS::getLegacyKernel()->db-> select($this->table, '', '`position`', '`id`,`owner`'); if ($items) { $this->index = array(); foreach ($items as $item) { $this->index[$item['owner']] []= $item['id']; } } } }
php
private function index($force = false) { if ($force || !$this->index) { $items = Eresus_CMS::getLegacyKernel()->db-> select($this->table, '', '`position`', '`id`,`owner`'); if ($items) { $this->index = array(); foreach ($items as $item) { $this->index[$item['owner']] []= $item['id']; } } } }
[ "private", "function", "index", "(", "$", "force", "=", "false", ")", "{", "if", "(", "$", "force", "||", "!", "$", "this", "->", "index", ")", "{", "$", "items", "=", "Eresus_CMS", "::", "getLegacyKernel", "(", ")", "->", "db", "->", "select", "("...
Создаёт индекс разделов @param bool $force Игнорировать закэшированные данные @return void
[ "Создаёт", "индекс", "разделов" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/sections.php#L86-L101
Eresus/EresusCMS
src/core/lib/sections.php
Sections.branchIds
private function branchIds($owner) { $result = array(); if (isset($this->index[$owner])) { $result = $this->index[$owner]; foreach ($result as $section) { $result = array_merge($result, $this->branchIds($section)); } } return $result; }
php
private function branchIds($owner) { $result = array(); if (isset($this->index[$owner])) { $result = $this->index[$owner]; foreach ($result as $section) { $result = array_merge($result, $this->branchIds($section)); } } return $result; }
[ "private", "function", "branchIds", "(", "$", "owner", ")", "{", "$", "result", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "index", "[", "$", "owner", "]", ")", ")", "{", "$", "result", "=", "$", "this", "->", "ind...
Создаёт список ID разделов определённой ветки @param int $owner ID корневого раздела ветки @return array Список ID разделов
[ "Создаёт", "список", "ID", "разделов", "определённой", "ветки" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/sections.php#L109-L121
Eresus/EresusCMS
src/core/lib/sections.php
Sections.branch
public function branch($owner, $access = GUEST, $flags = 0) { $result = array(); // Создаём индекс if (!$this->index) { $this->index(); } // Находим ID разделов ветки. $set = $this->branchIds($owner); if (count($set)) { $list = array(); /* Читаем из кэша */ for ($i=0; $i < count($set); $i++) { if (isset($this->cache[$set[$i]])) { $list[] = $this->cache[$set[$i]]; array_splice($set, $i, 1); $i--; } } if (count($set)) { $fieldset = '';//implode(',', array_diff($this->fields(), array('content'))); /* Читаем из БД */ $set = implode(',', $set); $items = Eresus_CMS::getLegacyKernel()->db->select($this->table, "FIND_IN_SET(`id`, '$set') AND `access` >= $access", 'position', $fieldset); for ($i=0; $i<count($items); $i++) { $this->cache[$items[$i]['id']] = $items[$i]; $list[] = $items[$i]; } } if ($flags) { for ($i=0; $i<count($list); $i++) { /* Фильтруем с учётом переданных флагов */ $filterByActivePassed = !($flags & SECTIONS_ACTIVE) || $list[$i]['active']; $filterByVisiblePassed = !($flags & SECTIONS_VISIBLE) || $list[$i]['visible']; if ($filterByActivePassed && $filterByVisiblePassed) { $result[] = $list[$i]; } } } else { $result = $list; } } return $result; }
php
public function branch($owner, $access = GUEST, $flags = 0) { $result = array(); // Создаём индекс if (!$this->index) { $this->index(); } // Находим ID разделов ветки. $set = $this->branchIds($owner); if (count($set)) { $list = array(); /* Читаем из кэша */ for ($i=0; $i < count($set); $i++) { if (isset($this->cache[$set[$i]])) { $list[] = $this->cache[$set[$i]]; array_splice($set, $i, 1); $i--; } } if (count($set)) { $fieldset = '';//implode(',', array_diff($this->fields(), array('content'))); /* Читаем из БД */ $set = implode(',', $set); $items = Eresus_CMS::getLegacyKernel()->db->select($this->table, "FIND_IN_SET(`id`, '$set') AND `access` >= $access", 'position', $fieldset); for ($i=0; $i<count($items); $i++) { $this->cache[$items[$i]['id']] = $items[$i]; $list[] = $items[$i]; } } if ($flags) { for ($i=0; $i<count($list); $i++) { /* Фильтруем с учётом переданных флагов */ $filterByActivePassed = !($flags & SECTIONS_ACTIVE) || $list[$i]['active']; $filterByVisiblePassed = !($flags & SECTIONS_VISIBLE) || $list[$i]['visible']; if ($filterByActivePassed && $filterByVisiblePassed) { $result[] = $list[$i]; } } } else { $result = $list; } } return $result; }
[ "public", "function", "branch", "(", "$", "owner", ",", "$", "access", "=", "GUEST", ",", "$", "flags", "=", "0", ")", "{", "$", "result", "=", "array", "(", ")", ";", "// Создаём индекс", "if", "(", "!", "$", "this", "->", "index", ")", "{", "$"...
Выбирает разделы определённой ветки @param int $owner Идентификатор корневого раздела ветки @param int $access Минимальный уровень доступа @param int $flags Флаги (см. SECTIONS_XXX) @return array Описания разделов
[ "Выбирает", "разделы", "определённой", "ветки" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/sections.php#L132-L189
Eresus/EresusCMS
src/core/lib/sections.php
Sections.children
public function children($owner, $access = GUEST, $flags = 0) { $items = $this->branch($owner, $access, $flags); $result = array(); for ($i=0; $i<count($items); $i++) { if ($items[$i]['owner'] == $owner) { $result[] = $items[$i]; } } return $result; }
php
public function children($owner, $access = GUEST, $flags = 0) { $items = $this->branch($owner, $access, $flags); $result = array(); for ($i=0; $i<count($items); $i++) { if ($items[$i]['owner'] == $owner) { $result[] = $items[$i]; } } return $result; }
[ "public", "function", "children", "(", "$", "owner", ",", "$", "access", "=", "GUEST", ",", "$", "flags", "=", "0", ")", "{", "$", "items", "=", "$", "this", "->", "branch", "(", "$", "owner", ",", "$", "access", ",", "$", "flags", ")", ";", "$...
Возвращает идентификаторы дочерних разделов указанного @param int $owner Идентификатор корневого раздела ветки @param int $access Минимальный уровень доступа @param int $flags Флаги (см. SECTIONS_XXX) @return array Идентификаторы разделов @since 2.10
[ "Возвращает", "идентификаторы", "дочерних", "разделов", "указанного" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/sections.php#L202-L214
Eresus/EresusCMS
src/core/lib/sections.php
Sections.parents
public function parents($id) { $this->index(); $result = array(); while ($id) { foreach ($this->index as $key => $value) { if (in_array($id, $value)) { $result[] = $id = $key; break; } } if (!$result) { return null; } } $result = array_reverse($result); return $result; }
php
public function parents($id) { $this->index(); $result = array(); while ($id) { foreach ($this->index as $key => $value) { if (in_array($id, $value)) { $result[] = $id = $key; break; } } if (!$result) { return null; } } $result = array_reverse($result); return $result; }
[ "public", "function", "parents", "(", "$", "id", ")", "{", "$", "this", "->", "index", "(", ")", ";", "$", "result", "=", "array", "(", ")", ";", "while", "(", "$", "id", ")", "{", "foreach", "(", "$", "this", "->", "index", "as", "$", "key", ...
Возвращает идентификаторы всех родительских разделов указанного @param int $id Идентификатор раздела @return array Идентификаторы разделов или NULL если раздела $id не существует
[ "Возвращает", "идентификаторы", "всех", "родительских", "разделов", "указанного" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/sections.php#L223-L244
Eresus/EresusCMS
src/core/lib/sections.php
Sections.add
public function add($item) { if (!$this->index) { $this->index(); } $result = false; /* При добавлении свойство id должно устанавливаться БД */ if (isset($item['id'])) { unset($item['id']); } /* Если не указан родитель - добавляем в корень */ if (!isset($item['owner'])) { $item['owner'] = 0; } $item['created'] = gettime('Y-m-d H:i:s'); $item['updated'] = $item['created']; $item['options'] = isset($item['options']) ? trim($item['options']) : ''; $item['options'] = empty($item['options']) ? '' : encodeOptions(text2array($item['options'], true)); if (!isset($item['position']) || !$item['position']) { $item['position'] = isset($this->index[$item['owner']]) ? count($this->index[$item['owner']]) : 0; } if (Eresus_CMS::getLegacyKernel()->db->insert($this->table, $item)) { $result = $this->get(Eresus_CMS::getLegacyKernel()->db->getInsertedId()); } return $result; }
php
public function add($item) { if (!$this->index) { $this->index(); } $result = false; /* При добавлении свойство id должно устанавливаться БД */ if (isset($item['id'])) { unset($item['id']); } /* Если не указан родитель - добавляем в корень */ if (!isset($item['owner'])) { $item['owner'] = 0; } $item['created'] = gettime('Y-m-d H:i:s'); $item['updated'] = $item['created']; $item['options'] = isset($item['options']) ? trim($item['options']) : ''; $item['options'] = empty($item['options']) ? '' : encodeOptions(text2array($item['options'], true)); if (!isset($item['position']) || !$item['position']) { $item['position'] = isset($this->index[$item['owner']]) ? count($this->index[$item['owner']]) : 0; } if (Eresus_CMS::getLegacyKernel()->db->insert($this->table, $item)) { $result = $this->get(Eresus_CMS::getLegacyKernel()->db->getInsertedId()); } return $result; }
[ "public", "function", "add", "(", "$", "item", ")", "{", "if", "(", "!", "$", "this", "->", "index", ")", "{", "$", "this", "->", "index", "(", ")", ";", "}", "$", "result", "=", "false", ";", "/* При добавлении свойство id должно устанавливаться БД */", ...
Добавляет раздел @param array $item Массив свойств раздела @return mixed Описание нового раздела или FALSE в случае неудачи
[ "Добавляет", "раздел" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/sections.php#L315-L349
Eresus/EresusCMS
src/core/lib/sections.php
Sections.update
public function update($item) { $item['updated'] = gettime('Y-m-d H:i:s'); $item['options'] = encodeOptions($item['options']); $item['title'] = Eresus_CMS::getLegacyKernel()->db->escape($item['title']); $item['caption'] = Eresus_CMS::getLegacyKernel()->db->escape($item['caption']); $item['description'] = Eresus_CMS::getLegacyKernel()->db->escape($item['description']); $item['hint'] = Eresus_CMS::getLegacyKernel()->db->escape($item['hint']); $item['keywords'] = Eresus_CMS::getLegacyKernel()->db->escape($item['keywords']); $item['content'] = Eresus_CMS::getLegacyKernel()->db->escape($item['content']); $item['options'] = Eresus_CMS::getLegacyKernel()->db->escape($item['options']); $result = Eresus_CMS::getLegacyKernel()->db->updateItem($this->table, $item, "`id`={$item['id']}"); return $result; }
php
public function update($item) { $item['updated'] = gettime('Y-m-d H:i:s'); $item['options'] = encodeOptions($item['options']); $item['title'] = Eresus_CMS::getLegacyKernel()->db->escape($item['title']); $item['caption'] = Eresus_CMS::getLegacyKernel()->db->escape($item['caption']); $item['description'] = Eresus_CMS::getLegacyKernel()->db->escape($item['description']); $item['hint'] = Eresus_CMS::getLegacyKernel()->db->escape($item['hint']); $item['keywords'] = Eresus_CMS::getLegacyKernel()->db->escape($item['keywords']); $item['content'] = Eresus_CMS::getLegacyKernel()->db->escape($item['content']); $item['options'] = Eresus_CMS::getLegacyKernel()->db->escape($item['options']); $result = Eresus_CMS::getLegacyKernel()->db->updateItem($this->table, $item, "`id`={$item['id']}"); return $result; }
[ "public", "function", "update", "(", "$", "item", ")", "{", "$", "item", "[", "'updated'", "]", "=", "gettime", "(", "'Y-m-d H:i:s'", ")", ";", "$", "item", "[", "'options'", "]", "=", "encodeOptions", "(", "$", "item", "[", "'options'", "]", ")", ";...
Изменяет раздел @param array $item Раздел @return mixed Описание нового раздела или false в случае неудачи
[ "Изменяет", "раздел" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/sections.php#L358-L371
Eresus/EresusCMS
src/core/lib/sections.php
Sections.delete
public function delete($id) { $children = $this->children($id); /* Удаляем подразделы */ for ($i = 0; $i < count($children); $i++) { $this->delete($children[$i]['id']); } /* Удаляем контент раздела */ $section = $this->get($id); $plugins = Eresus_Plugin_Registry::getInstance(); $plugin = $plugins->load($section['type']); //TODO https://github.com/Eresus/EresusCMS/issues/29 if (false !== $plugin) { if (method_exists($plugin, 'onSectionDelete')) { $plugin->onSectionDelete($id); } } Eresus_CMS::getLegacyKernel()->db->delete($this->table, "`id`=$id"); return true; // Оставлено для обратной совместимости }
php
public function delete($id) { $children = $this->children($id); /* Удаляем подразделы */ for ($i = 0; $i < count($children); $i++) { $this->delete($children[$i]['id']); } /* Удаляем контент раздела */ $section = $this->get($id); $plugins = Eresus_Plugin_Registry::getInstance(); $plugin = $plugins->load($section['type']); //TODO https://github.com/Eresus/EresusCMS/issues/29 if (false !== $plugin) { if (method_exists($plugin, 'onSectionDelete')) { $plugin->onSectionDelete($id); } } Eresus_CMS::getLegacyKernel()->db->delete($this->table, "`id`=$id"); return true; // Оставлено для обратной совместимости }
[ "public", "function", "delete", "(", "$", "id", ")", "{", "$", "children", "=", "$", "this", "->", "children", "(", "$", "id", ")", ";", "/* Удаляем подразделы */", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "count", "(", "$", "children", ...
Удаляет раздел и подразделы @param int $id Идентификатор раздела @return bool Результат операции
[ "Удаляет", "раздел", "и", "подразделы" ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/lib/sections.php#L380-L403
chrismou/phergie-irc-plugin-react-google
src/Provider/GoogleSearch.php
GoogleSearch.getApiRequestUrl
public function getApiRequestUrl(Event $event) { $params = $event->getCustomParams(); $query = trim(implode(" ", $params)); $querystringParams = [ 'v' => '1.0', 'q' => $query ]; return sprintf("%s?%s", $this->apiUrl, http_build_query($querystringParams)); }
php
public function getApiRequestUrl(Event $event) { $params = $event->getCustomParams(); $query = trim(implode(" ", $params)); $querystringParams = [ 'v' => '1.0', 'q' => $query ]; return sprintf("%s?%s", $this->apiUrl, http_build_query($querystringParams)); }
[ "public", "function", "getApiRequestUrl", "(", "Event", "$", "event", ")", "{", "$", "params", "=", "$", "event", "->", "getCustomParams", "(", ")", ";", "$", "query", "=", "trim", "(", "implode", "(", "\" \"", ",", "$", "params", ")", ")", ";", "$",...
Get the url for the API request @param \Phergie\Irc\Plugin\React\Command\CommandEvent $event @return string
[ "Get", "the", "url", "for", "the", "API", "request" ]
train
https://github.com/chrismou/phergie-irc-plugin-react-google/blob/4492bf1e25826a9cf7187afee0ec35deddefaf6f/src/Provider/GoogleSearch.php#L45-L56
chrismou/phergie-irc-plugin-react-google
src/Provider/GoogleSearch.php
GoogleSearch.getSuccessLines
public function getSuccessLines(Event $event, $apiResponse) { $json = json_decode($apiResponse); $json = $json->responseData; if (isset($json->cursor->estimatedResultCount) && $json->cursor->estimatedResultCount > 0) { $messages = []; $messages[] = sprintf( "%s [ %s ]", $json->results[0]->titleNoFormatting, $json->results[0]->url ); $messages[] = sprintf("More results: %s", $json->cursor->moreResultsUrl); } else { $messages = $this->getNoResultsLines($event, $apiResponse); } return $messages; }
php
public function getSuccessLines(Event $event, $apiResponse) { $json = json_decode($apiResponse); $json = $json->responseData; if (isset($json->cursor->estimatedResultCount) && $json->cursor->estimatedResultCount > 0) { $messages = []; $messages[] = sprintf( "%s [ %s ]", $json->results[0]->titleNoFormatting, $json->results[0]->url ); $messages[] = sprintf("More results: %s", $json->cursor->moreResultsUrl); } else { $messages = $this->getNoResultsLines($event, $apiResponse); } return $messages; }
[ "public", "function", "getSuccessLines", "(", "Event", "$", "event", ",", "$", "apiResponse", ")", "{", "$", "json", "=", "json_decode", "(", "$", "apiResponse", ")", ";", "$", "json", "=", "$", "json", "->", "responseData", ";", "if", "(", "isset", "(...
Returns an array of lines to send back to IRC when the http request is successful @param \Phergie\Irc\Plugin\React\Command\CommandEvent $event @param string $apiResponse @return array
[ "Returns", "an", "array", "of", "lines", "to", "send", "back", "to", "IRC", "when", "the", "http", "request", "is", "successful" ]
train
https://github.com/chrismou/phergie-irc-plugin-react-google/blob/4492bf1e25826a9cf7187afee0ec35deddefaf6f/src/Provider/GoogleSearch.php#L66-L84
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/multipart_related_parser.php
ezcMailMultipartRelatedParser.partDone
public function partDone( ezcMailPart $part ) { // TODO: support Content-Type: start= as specified by RFC 2387 if ( !$this->part->getMainPart() ) { $this->part->setMainPart( $part ); return; } $this->part->addRelatedPart( $part ); }
php
public function partDone( ezcMailPart $part ) { // TODO: support Content-Type: start= as specified by RFC 2387 if ( !$this->part->getMainPart() ) { $this->part->setMainPart( $part ); return; } $this->part->addRelatedPart( $part ); }
[ "public", "function", "partDone", "(", "ezcMailPart", "$", "part", ")", "{", "// TODO: support Content-Type: start= as specified by RFC 2387", "if", "(", "!", "$", "this", "->", "part", "->", "getMainPart", "(", ")", ")", "{", "$", "this", "->", "part", "->", ...
Adds the part $part to the list of multipart messages. This method is called automatically by ezcMailMultipartParser each time a part is parsed. @param ezcMailPart $part
[ "Adds", "the", "part", "$part", "to", "the", "list", "of", "multipart", "messages", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/multipart_related_parser.php#L46-L55
Eresus/EresusCMS
src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/multipart_related_parser.php
ezcMailMultipartRelatedParser.finishMultipart
public function finishMultipart() { $size = 0; if ( $this->part->getMainPart() ) { $size = $this->part->getMainPart()->size; } foreach ( $this->part->getRelatedParts() as $part ) { $size += $part->size; } $this->part->size = $size; return $this->part; }
php
public function finishMultipart() { $size = 0; if ( $this->part->getMainPart() ) { $size = $this->part->getMainPart()->size; } foreach ( $this->part->getRelatedParts() as $part ) { $size += $part->size; } $this->part->size = $size; return $this->part; }
[ "public", "function", "finishMultipart", "(", ")", "{", "$", "size", "=", "0", ";", "if", "(", "$", "this", "->", "part", "->", "getMainPart", "(", ")", ")", "{", "$", "size", "=", "$", "this", "->", "part", "->", "getMainPart", "(", ")", "->", "...
Returns the parts parsed for this multipart. @return ezcMailMultipartRelated
[ "Returns", "the", "parts", "parsed", "for", "this", "multipart", "." ]
train
https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/multipart_related_parser.php#L62-L75
video-games-records/TeamBundle
Controller/RequestController.php
RequestController.listAction
public function listAction() { /** @var \VideoGamesRecords\CoreBundle\Entity\Player $player */ $player = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Player')->find($this->getPlayer()->getIdPlayer()); if ($player->isLeader()) { $requests = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->getFromTeam($player->getTeam()->getIdTeam()); } else if ($player->getTeam() === null) { $requests = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->getFromPlayer($player->getIdPlayer()); } else { return; } return $this->render( 'VideoGamesRecordsTeamBundle:Request:list.html.twig', [ 'requests' => $requests, 'isLeader' => $player->isLeader(), ] ); }
php
public function listAction() { /** @var \VideoGamesRecords\CoreBundle\Entity\Player $player */ $player = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Player')->find($this->getPlayer()->getIdPlayer()); if ($player->isLeader()) { $requests = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->getFromTeam($player->getTeam()->getIdTeam()); } else if ($player->getTeam() === null) { $requests = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->getFromPlayer($player->getIdPlayer()); } else { return; } return $this->render( 'VideoGamesRecordsTeamBundle:Request:list.html.twig', [ 'requests' => $requests, 'isLeader' => $player->isLeader(), ] ); }
[ "public", "function", "listAction", "(", ")", "{", "/** @var \\VideoGamesRecords\\CoreBundle\\Entity\\Player $player */", "$", "player", "=", "$", "this", "->", "getDoctrine", "(", ")", "->", "getRepository", "(", "'VideoGamesRecordsCoreBundle:Player'", ")", "->", "find",...
@Route("/list", name="vgr_team_request_list") @Method({"GET","POST"}) @Cache(smaxage="10") @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')") @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response @throws \Exception
[ "@Route", "(", "/", "list", "name", "=", "vgr_team_request_list", ")", "@Method", "(", "{", "GET", "POST", "}", ")", "@Cache", "(", "smaxage", "=", "10", ")", "@Security", "(", "is_granted", "(", "IS_AUTHENTICATED_REMEMBERED", ")", ")" ]
train
https://github.com/video-games-records/TeamBundle/blob/4e5b73874bacb96f70ab16e74d54a1b6efc8e62f/Controller/RequestController.php#L31-L51
video-games-records/TeamBundle
Controller/RequestController.php
RequestController.joinAction
public function joinAction(Request $request, $idTeam = null) { $form = $this->createFormBuilder() ->setAction($this->generateUrl('vgr_team_request_join')) ->setMethod('POST') ->add('idTeam', HiddenType::class, array('data' => $idTeam)) ->add('save', SubmitType::class, array('label' => 'JOIN')) ->getForm(); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $data = $form->getData(); /** @var \VideoGamesRecords\TeamBundle\Entity\Team $team */ $team = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:Team')->find($data['idTeam']); /** @var \VideoGamesRecords\CoreBundle\Entity\Player $player */ $player = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Player')->find($this->getPlayer()->getIdPlayer()); if ($player->getTeam() !== null) { //----- Message $this->addFlash( 'notice', sprintf('Your have already joined the team %s, you may re login on the site to see changes', $player->getTeam()->getLibTeam()) ); return $this->redirectToRoute('vgr_account_index'); } $teamRequest = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->getFromPlayerAndTeam($this->getPlayer()->getIdPlayer(), $data['idTeam']); if ($teamRequest !== null) { //----- Message $this->addFlash( 'notice', sprintf('Your have already asked to join the team %s', $team->getLibTeam()) ); } else { $em = $this->getDoctrine()->getManager(); //----- Create request $teamRequest = new TeamRequest(); $teamRequest->setPlayer($em->getReference('VideoGamesRecords\CoreBundle\Entity\Player', $this->getPlayer()->getIdPlayer())); $teamRequest->setTeam($team); $em->persist($teamRequest); $em->flush(); //----- Message $this->addFlash( 'notice', sprintf('Your request to join team %s is sended to leader of the team', $team->getLibTeam()) ); } return $this->redirectToRoute('vgr_account_index'); } return $this->render( 'VideoGamesRecordsTeamBundle:Form:form.html.twig', [ 'form' => $form->createView(), ] ); }
php
public function joinAction(Request $request, $idTeam = null) { $form = $this->createFormBuilder() ->setAction($this->generateUrl('vgr_team_request_join')) ->setMethod('POST') ->add('idTeam', HiddenType::class, array('data' => $idTeam)) ->add('save', SubmitType::class, array('label' => 'JOIN')) ->getForm(); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $data = $form->getData(); /** @var \VideoGamesRecords\TeamBundle\Entity\Team $team */ $team = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:Team')->find($data['idTeam']); /** @var \VideoGamesRecords\CoreBundle\Entity\Player $player */ $player = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Player')->find($this->getPlayer()->getIdPlayer()); if ($player->getTeam() !== null) { //----- Message $this->addFlash( 'notice', sprintf('Your have already joined the team %s, you may re login on the site to see changes', $player->getTeam()->getLibTeam()) ); return $this->redirectToRoute('vgr_account_index'); } $teamRequest = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->getFromPlayerAndTeam($this->getPlayer()->getIdPlayer(), $data['idTeam']); if ($teamRequest !== null) { //----- Message $this->addFlash( 'notice', sprintf('Your have already asked to join the team %s', $team->getLibTeam()) ); } else { $em = $this->getDoctrine()->getManager(); //----- Create request $teamRequest = new TeamRequest(); $teamRequest->setPlayer($em->getReference('VideoGamesRecords\CoreBundle\Entity\Player', $this->getPlayer()->getIdPlayer())); $teamRequest->setTeam($team); $em->persist($teamRequest); $em->flush(); //----- Message $this->addFlash( 'notice', sprintf('Your request to join team %s is sended to leader of the team', $team->getLibTeam()) ); } return $this->redirectToRoute('vgr_account_index'); } return $this->render( 'VideoGamesRecordsTeamBundle:Form:form.html.twig', [ 'form' => $form->createView(), ] ); }
[ "public", "function", "joinAction", "(", "Request", "$", "request", ",", "$", "idTeam", "=", "null", ")", "{", "$", "form", "=", "$", "this", "->", "createFormBuilder", "(", ")", "->", "setAction", "(", "$", "this", "->", "generateUrl", "(", "'vgr_team_r...
@Route("/join", name="vgr_team_request_join") @Method({"GET","POST"}) @Cache(smaxage="10") @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')") @param Request $request @param integer $idTeam @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response @throws \Exception
[ "@Route", "(", "/", "join", "name", "=", "vgr_team_request_join", ")", "@Method", "(", "{", "GET", "POST", "}", ")", "@Cache", "(", "smaxage", "=", "10", ")", "@Security", "(", "is_granted", "(", "IS_AUTHENTICATED_REMEMBERED", ")", ")" ]
train
https://github.com/video-games-records/TeamBundle/blob/4e5b73874bacb96f70ab16e74d54a1b6efc8e62f/Controller/RequestController.php#L65-L126
video-games-records/TeamBundle
Controller/RequestController.php
RequestController.acceptAction
public function acceptAction(Request $request, $idRequest = null) { $form = $this->createFormBuilder() ->setAction($this->generateUrl('vgr_team_request_accept')) ->setMethod('POST') ->add('idRequest', HiddenType::class, array('data' => $idRequest)) ->add('save', SubmitType::class, array('label' => 'ACCEPT')) ->getForm(); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $data = $form->getData(); $em = $this->getDoctrine()->getManager(); /** @var \VideoGamesRecords\TeamBundle\Entity\TeamRequest $teamRequest */ $teamRequest = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->find($data['idRequest']); if ($teamRequest->getStatus() === TeamRequest::STATUS_ACTIVE) { $teamRequest->setStatus(TeamRequest::STATUS_ACCEPTED); /** @var \VideoGamesRecords\CoreBundle\Entity\Player $player */ $player = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Player')->find($teamRequest->getPlayer()->getIdPlayer()); $player->setTeam($teamRequest->getTeam()); $message = sprintf('Your changes were saved!!!'); //----- Cancel all active $requests for this player /** @var \VideoGamesRecords\TeamBundle\Entity\TeamRequest[] $toBeCanceledTeamRequests */ $toBeCanceledTeamRequests = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->getFromPlayer($player->getIdPlayer()); foreach ($toBeCanceledTeamRequests as $toBeCanceledTeamRequest) { $toBeCanceledTeamRequest->setStatus(TeamRequest::STATUS_CANCELED); } $em->flush(); } else { $message = sprintf('The player has already joined a team'); } //----- Message $this->addFlash('notice', $message); return $this->redirectToRoute('vgr_account_index'); } return $this->render( 'VideoGamesRecordsTeamBundle:Form:form.html.twig', [ 'form' => $form->createView(), ] ); }
php
public function acceptAction(Request $request, $idRequest = null) { $form = $this->createFormBuilder() ->setAction($this->generateUrl('vgr_team_request_accept')) ->setMethod('POST') ->add('idRequest', HiddenType::class, array('data' => $idRequest)) ->add('save', SubmitType::class, array('label' => 'ACCEPT')) ->getForm(); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $data = $form->getData(); $em = $this->getDoctrine()->getManager(); /** @var \VideoGamesRecords\TeamBundle\Entity\TeamRequest $teamRequest */ $teamRequest = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->find($data['idRequest']); if ($teamRequest->getStatus() === TeamRequest::STATUS_ACTIVE) { $teamRequest->setStatus(TeamRequest::STATUS_ACCEPTED); /** @var \VideoGamesRecords\CoreBundle\Entity\Player $player */ $player = $this->getDoctrine()->getRepository('VideoGamesRecordsCoreBundle:Player')->find($teamRequest->getPlayer()->getIdPlayer()); $player->setTeam($teamRequest->getTeam()); $message = sprintf('Your changes were saved!!!'); //----- Cancel all active $requests for this player /** @var \VideoGamesRecords\TeamBundle\Entity\TeamRequest[] $toBeCanceledTeamRequests */ $toBeCanceledTeamRequests = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->getFromPlayer($player->getIdPlayer()); foreach ($toBeCanceledTeamRequests as $toBeCanceledTeamRequest) { $toBeCanceledTeamRequest->setStatus(TeamRequest::STATUS_CANCELED); } $em->flush(); } else { $message = sprintf('The player has already joined a team'); } //----- Message $this->addFlash('notice', $message); return $this->redirectToRoute('vgr_account_index'); } return $this->render( 'VideoGamesRecordsTeamBundle:Form:form.html.twig', [ 'form' => $form->createView(), ] ); }
[ "public", "function", "acceptAction", "(", "Request", "$", "request", ",", "$", "idRequest", "=", "null", ")", "{", "$", "form", "=", "$", "this", "->", "createFormBuilder", "(", ")", "->", "setAction", "(", "$", "this", "->", "generateUrl", "(", "'vgr_t...
@Route("/accept", name="vgr_team_request_accept") @Method({"GET","POST"}) @Cache(smaxage="10") @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')") @param Request $request @param integer $idRequest @return \Symfony\Component\HttpFoundation\Response @throws \Exception
[ "@Route", "(", "/", "accept", "name", "=", "vgr_team_request_accept", ")", "@Method", "(", "{", "GET", "POST", "}", ")", "@Cache", "(", "smaxage", "=", "10", ")", "@Security", "(", "is_granted", "(", "IS_AUTHENTICATED_REMEMBERED", ")", ")" ]
train
https://github.com/video-games-records/TeamBundle/blob/4e5b73874bacb96f70ab16e74d54a1b6efc8e62f/Controller/RequestController.php#L189-L238
video-games-records/TeamBundle
Controller/RequestController.php
RequestController.refuseAction
public function refuseAction(Request $request, $idRequest = null) { $form = $this->createFormBuilder() ->setAction($this->generateUrl('vgr_team_request_refuse')) ->setMethod('POST') ->add('idRequest', HiddenType::class, array('data' => $idRequest)) ->add('save', SubmitType::class, array('label' => 'REFUSE')) ->getForm(); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $data = $form->getData(); $em = $this->getDoctrine()->getManager(); /** @var \VideoGamesRecords\TeamBundle\Entity\TeamRequest $request */ $request = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->find($data['idRequest']); $request->setStatus(TeamRequest::STATUS_REFUSED); $em->flush(); //----- Message $this->addFlash( 'notice', sprintf('Your changes were saved!!!') ); return $this->redirectToRoute('vgr_account_index'); } return $this->render( 'VideoGamesRecordsTeamBundle:Form:form.html.twig', [ 'form' => $form->createView(), ] ); }
php
public function refuseAction(Request $request, $idRequest = null) { $form = $this->createFormBuilder() ->setAction($this->generateUrl('vgr_team_request_refuse')) ->setMethod('POST') ->add('idRequest', HiddenType::class, array('data' => $idRequest)) ->add('save', SubmitType::class, array('label' => 'REFUSE')) ->getForm(); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $data = $form->getData(); $em = $this->getDoctrine()->getManager(); /** @var \VideoGamesRecords\TeamBundle\Entity\TeamRequest $request */ $request = $this->getDoctrine()->getRepository('VideoGamesRecordsTeamBundle:TeamRequest')->find($data['idRequest']); $request->setStatus(TeamRequest::STATUS_REFUSED); $em->flush(); //----- Message $this->addFlash( 'notice', sprintf('Your changes were saved!!!') ); return $this->redirectToRoute('vgr_account_index'); } return $this->render( 'VideoGamesRecordsTeamBundle:Form:form.html.twig', [ 'form' => $form->createView(), ] ); }
[ "public", "function", "refuseAction", "(", "Request", "$", "request", ",", "$", "idRequest", "=", "null", ")", "{", "$", "form", "=", "$", "this", "->", "createFormBuilder", "(", ")", "->", "setAction", "(", "$", "this", "->", "generateUrl", "(", "'vgr_t...
@Route("/refuse", name="vgr_team_request_refuse") @Method({"GET","POST"}) @Cache(smaxage="10") @Security("is_granted('IS_AUTHENTICATED_REMEMBERED')") @param Request $request @param integer $idRequest @return \Symfony\Component\HttpFoundation\Response @throws \Exception
[ "@Route", "(", "/", "refuse", "name", "=", "vgr_team_request_refuse", ")", "@Method", "(", "{", "GET", "POST", "}", ")", "@Cache", "(", "smaxage", "=", "10", ")", "@Security", "(", "is_granted", "(", "IS_AUTHENTICATED_REMEMBERED", ")", ")" ]
train
https://github.com/video-games-records/TeamBundle/blob/4e5b73874bacb96f70ab16e74d54a1b6efc8e62f/Controller/RequestController.php#L252-L287
grozzzny/catalog
models/TraitModel.php
TraitModel.hasValidator
public function hasValidator($validators, $attribute) { $validators = is_array($validators) ? $validators : [$validators]; foreach ($this->rules() as $rule){ $attributes = is_array($rule[0]) ? $rule[0] : [$rule[0]]; if(in_array($attribute, $attributes) && in_array($rule[1], $validators)){ return true; } } return false; }
php
public function hasValidator($validators, $attribute) { $validators = is_array($validators) ? $validators : [$validators]; foreach ($this->rules() as $rule){ $attributes = is_array($rule[0]) ? $rule[0] : [$rule[0]]; if(in_array($attribute, $attributes) && in_array($rule[1], $validators)){ return true; } } return false; }
[ "public", "function", "hasValidator", "(", "$", "validators", ",", "$", "attribute", ")", "{", "$", "validators", "=", "is_array", "(", "$", "validators", ")", "?", "$", "validators", ":", "[", "$", "validators", "]", ";", "foreach", "(", "$", "this", ...
Проверяет, имеется ли данный валидатор у атрибута или нет @param $validators @param $attribute @return bool
[ "Проверяет", "имеется", "ли", "данный", "валидатор", "у", "атрибута", "или", "нет" ]
train
https://github.com/grozzzny/catalog/blob/ff1cac10a5f3a89f3ef2767f9ede6b2d74e1849a/models/TraitModel.php#L17-L29
LeaseCloud/leasecloud-php-sdk
src/Tariff.php
Tariff.monthlyCost
public static function monthlyCost($price, $months, $tariffs) { $tariff = static::tariff($months, $tariffs); if (!is_null($tariff)) { return round($price * ($tariff / 100)); } // If we're still here, it means that we don't have any tariff // matching the number of months specified. Return null. return null; }
php
public static function monthlyCost($price, $months, $tariffs) { $tariff = static::tariff($months, $tariffs); if (!is_null($tariff)) { return round($price * ($tariff / 100)); } // If we're still here, it means that we don't have any tariff // matching the number of months specified. Return null. return null; }
[ "public", "static", "function", "monthlyCost", "(", "$", "price", ",", "$", "months", ",", "$", "tariffs", ")", "{", "$", "tariff", "=", "static", "::", "tariff", "(", "$", "months", ",", "$", "tariffs", ")", ";", "if", "(", "!", "is_null", "(", "$...
Return the monthly cost for an item at $price leased for $months given the $tariffs in use for the LeaseCloud account @param double $price The price of the object @param integer $months The agreement length @param array $tariffs The tariffs array, from the TariffObject->tariffs as returned by Tariff:retrieve @return integer|null The monthly cost for the end user
[ "Return", "the", "monthly", "cost", "for", "an", "item", "at", "$price", "leased", "for", "$months", "given", "the", "$tariffs", "in", "use", "for", "the", "LeaseCloud", "account" ]
train
https://github.com/LeaseCloud/leasecloud-php-sdk/blob/091b073dd4f79ba915a68c0ed151bd9bfa61e7ca/src/Tariff.php#L33-L44
LeaseCloud/leasecloud-php-sdk
src/Tariff.php
Tariff.tariff
public static function tariff($months, $tariffs) { foreach ($tariffs as $tariff) { if ($months == $tariff->months) { return (double)($tariff->tariff); } } return null; }
php
public static function tariff($months, $tariffs) { foreach ($tariffs as $tariff) { if ($months == $tariff->months) { return (double)($tariff->tariff); } } return null; }
[ "public", "static", "function", "tariff", "(", "$", "months", ",", "$", "tariffs", ")", "{", "foreach", "(", "$", "tariffs", "as", "$", "tariff", ")", "{", "if", "(", "$", "months", "==", "$", "tariff", "->", "months", ")", "{", "return", "(", "dou...
Return the $tariff for a contract at $months length given the tarrifs in use for the LeaseCloud account @param $months @param $tariffs @return double|null The tariff, or null if no tariff was found
[ "Return", "the", "$tariff", "for", "a", "contract", "at", "$months", "length", "given", "the", "tarrifs", "in", "use", "for", "the", "LeaseCloud", "account" ]
train
https://github.com/LeaseCloud/leasecloud-php-sdk/blob/091b073dd4f79ba915a68c0ed151bd9bfa61e7ca/src/Tariff.php#L55-L64
frdl/webfan
.ApplicationComposer/lib/frdl/Flow/Element.php
Element.removeEventListener
public function removeEventListener($event, $listener){ if (!$this->events[$event]) return $this; $indexOf = 0; foreach ($this->Iterator('Array') as $EventListener) { if($EventListener === $listener) { array_splice($this->events[$event], $indexOf, 1); $indexOf--; } $indexOf++; } return $this; }
php
public function removeEventListener($event, $listener){ if (!$this->events[$event]) return $this; $indexOf = 0; foreach ($this->Iterator('Array') as $EventListener) { if($EventListener === $listener) { array_splice($this->events[$event], $indexOf, 1); $indexOf--; } $indexOf++; } return $this; }
[ "public", "function", "removeEventListener", "(", "$", "event", ",", "$", "listener", ")", "{", "if", "(", "!", "$", "this", "->", "events", "[", "$", "event", "]", ")", "return", "$", "this", ";", "$", "indexOf", "=", "0", ";", "foreach", "(", "$"...
/* Event "Trait"
[ "/", "*", "Event", "Trait" ]
train
https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/frdl/Flow/Element.php#L254-L267
novaway/open-graph
src/OpenGraph.php
OpenGraph.add
public function add($namespace, $tag, $content) { if (is_array($content)) { foreach ($content as $data) { $this->add($namespace, $tag, $data); } return $this; } $this->tags[] = new OpenGraphTag($namespace, $tag, $content); return $this; }
php
public function add($namespace, $tag, $content) { if (is_array($content)) { foreach ($content as $data) { $this->add($namespace, $tag, $data); } return $this; } $this->tags[] = new OpenGraphTag($namespace, $tag, $content); return $this; }
[ "public", "function", "add", "(", "$", "namespace", ",", "$", "tag", ",", "$", "content", ")", "{", "if", "(", "is_array", "(", "$", "content", ")", ")", "{", "foreach", "(", "$", "content", "as", "$", "data", ")", "{", "$", "this", "->", "add", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/novaway/open-graph/blob/19817bee4b91cf26ca3fe44883ad58b32328e464/src/OpenGraph.php#L132-L145
simialbi/yii2-simialbi-base
web/AssetBundle.php
AssetBundle.init
public function init() { if ($this->sourcePath === '__AUTO_SET__') { $reflector = new \ReflectionClass(static::className()); $dir = rtrim(dirname($reflector->getFileName()), '\\/').DIRECTORY_SEPARATOR.'assets'; $this->sourcePath = $dir; } parent::init(); }
php
public function init() { if ($this->sourcePath === '__AUTO_SET__') { $reflector = new \ReflectionClass(static::className()); $dir = rtrim(dirname($reflector->getFileName()), '\\/').DIRECTORY_SEPARATOR.'assets'; $this->sourcePath = $dir; } parent::init(); }
[ "public", "function", "init", "(", ")", "{", "if", "(", "$", "this", "->", "sourcePath", "===", "'__AUTO_SET__'", ")", "{", "$", "reflector", "=", "new", "\\", "ReflectionClass", "(", "static", "::", "className", "(", ")", ")", ";", "$", "dir", "=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/simialbi/yii2-simialbi-base/blob/f68d3ee64f52c6dfb0aa31ffc14f5ced5aabdbb7/web/AssetBundle.php#L25-L33
mikebarlow/html-helper
src/Integrations/PlatesPHP.php
PlatesPHP.register
public function register(Engine $engine) { $this->engine = $engine; $this->engine->registerFunction('html', array($this, 'getHtmlHelper')); }
php
public function register(Engine $engine) { $this->engine = $engine; $this->engine->registerFunction('html', array($this, 'getHtmlHelper')); }
[ "public", "function", "register", "(", "Engine", "$", "engine", ")", "{", "$", "this", "->", "engine", "=", "$", "engine", ";", "$", "this", "->", "engine", "->", "registerFunction", "(", "'html'", ",", "array", "(", "$", "this", ",", "'getHtmlHelper'", ...
Register extension function. @return null
[ "Register", "extension", "function", "." ]
train
https://github.com/mikebarlow/html-helper/blob/d9d9dc3e92ba3ecd75f3a2e5a5bc2d23f38b5f65/src/Integrations/PlatesPHP.php#L15-L19
mikebarlow/html-helper
src/Integrations/PlatesPHP.php
PlatesPHP.getHtmlHelper
public function getHtmlHelper() { $this->HtmlHelper->Form->getDataService()->template = $this->template; $this->HtmlHelper->getRouterService()->template = $this->template; $this->HtmlHelper->getAssetsService()->template = $this->template; return $this->HtmlHelper; }
php
public function getHtmlHelper() { $this->HtmlHelper->Form->getDataService()->template = $this->template; $this->HtmlHelper->getRouterService()->template = $this->template; $this->HtmlHelper->getAssetsService()->template = $this->template; return $this->HtmlHelper; }
[ "public", "function", "getHtmlHelper", "(", ")", "{", "$", "this", "->", "HtmlHelper", "->", "Form", "->", "getDataService", "(", ")", "->", "template", "=", "$", "this", "->", "template", ";", "$", "this", "->", "HtmlHelper", "->", "getRouterService", "("...
return the instance of the html helper @return object $htmlHelper Instance of the html helper
[ "return", "the", "instance", "of", "the", "html", "helper" ]
train
https://github.com/mikebarlow/html-helper/blob/d9d9dc3e92ba3ecd75f3a2e5a5bc2d23f38b5f65/src/Integrations/PlatesPHP.php#L36-L42
alevilar/ristorantino-vendor
Risto/Controller/PagesController.php
PagesController.display
public function display() { $path = func_get_args(); $count = count($path); if (!$count) { return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); try { $this->render(implode('/', $path)); } catch (MissingViewException $e) { if (Configure::read('debug')) { throw $e; } throw new NotFoundException(); } }
php
public function display() { $path = func_get_args(); $count = count($path); if (!$count) { return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; if (!empty($path[0])) { $page = $path[0]; } if (!empty($path[1])) { $subpage = $path[1]; } if (!empty($path[$count - 1])) { $title_for_layout = Inflector::humanize($path[$count - 1]); } $this->set(compact('page', 'subpage', 'title_for_layout')); try { $this->render(implode('/', $path)); } catch (MissingViewException $e) { if (Configure::read('debug')) { throw $e; } throw new NotFoundException(); } }
[ "public", "function", "display", "(", ")", "{", "$", "path", "=", "func_get_args", "(", ")", ";", "$", "count", "=", "count", "(", "$", "path", ")", ";", "if", "(", "!", "$", "count", ")", "{", "return", "$", "this", "->", "redirect", "(", "'/'",...
Displays a view @param mixed What page to display @return void @throws NotFoundException When the view file could not be found or MissingViewException in debug mode.
[ "Displays", "a", "view" ]
train
https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Risto/Controller/PagesController.php#L49-L76
eXistenZNL/PermCheck
src/PermCheck.php
PermCheck.run
public function run() { $this->loader->parse(); $files = $this->filesystem->getFiles(); // Now we check all the files against the config while ($files->valid()) { /* @var SplFileInfo $file */ $file = $files->current(); // Skip symlinks as they are always 0777 if ($file->isLink()) { $files->next(); continue; } $filename = $this->getRelativeFilename($file); // Skip excluded files, of course. if ($this->isExcluded($filename)) { $files->next(); continue; } $fileShouldBeExecutable = $this->shouldBeExecutable($filename); if (!$fileShouldBeExecutable && $file->isExecutable()) { $this->messageBag->addMessage($file->getPathname(), 'minx'); $files->next(); continue; } if ($fileShouldBeExecutable && !$file->isExecutable()) { $this->messageBag->addMessage($file->getPathname(), 'plusx'); $files->next(); continue; } $files->next(); } }
php
public function run() { $this->loader->parse(); $files = $this->filesystem->getFiles(); // Now we check all the files against the config while ($files->valid()) { /* @var SplFileInfo $file */ $file = $files->current(); // Skip symlinks as they are always 0777 if ($file->isLink()) { $files->next(); continue; } $filename = $this->getRelativeFilename($file); // Skip excluded files, of course. if ($this->isExcluded($filename)) { $files->next(); continue; } $fileShouldBeExecutable = $this->shouldBeExecutable($filename); if (!$fileShouldBeExecutable && $file->isExecutable()) { $this->messageBag->addMessage($file->getPathname(), 'minx'); $files->next(); continue; } if ($fileShouldBeExecutable && !$file->isExecutable()) { $this->messageBag->addMessage($file->getPathname(), 'plusx'); $files->next(); continue; } $files->next(); } }
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "loader", "->", "parse", "(", ")", ";", "$", "files", "=", "$", "this", "->", "filesystem", "->", "getFiles", "(", ")", ";", "// Now we check all the files against the config", "while", "(", "$...
Run the permission check and return any errors @return void
[ "Run", "the", "permission", "check", "and", "return", "any", "errors" ]
train
https://github.com/eXistenZNL/PermCheck/blob/f22f2936350f6b440222fb6ea37dfc382fc4550e/src/PermCheck.php#L95-L134
eXistenZNL/PermCheck
src/PermCheck.php
PermCheck.isExcluded
protected function isExcluded($filename) { foreach ($this->config->getExcludedFiles() as $excludedFile) { if ($filename === $excludedFile) { return true; } } foreach ($this->config->getExcludedDirs() as $excludedDir) { if (strpos($filename, $excludedDir) === 0) { return true; } } return false; }
php
protected function isExcluded($filename) { foreach ($this->config->getExcludedFiles() as $excludedFile) { if ($filename === $excludedFile) { return true; } } foreach ($this->config->getExcludedDirs() as $excludedDir) { if (strpos($filename, $excludedDir) === 0) { return true; } } return false; }
[ "protected", "function", "isExcluded", "(", "$", "filename", ")", "{", "foreach", "(", "$", "this", "->", "config", "->", "getExcludedFiles", "(", ")", "as", "$", "excludedFile", ")", "{", "if", "(", "$", "filename", "===", "$", "excludedFile", ")", "{",...
Check whether the given file should be excluded. @param string $filename The filename to check. @return boolean
[ "Check", "whether", "the", "given", "file", "should", "be", "excluded", "." ]
train
https://github.com/eXistenZNL/PermCheck/blob/f22f2936350f6b440222fb6ea37dfc382fc4550e/src/PermCheck.php#L143-L156
eXistenZNL/PermCheck
src/PermCheck.php
PermCheck.shouldBeExecutable
protected function shouldBeExecutable($filename) { foreach ($this->config->getExecutableFiles() as $exFile) { if ($filename === $exFile) { return true; } } return false; }
php
protected function shouldBeExecutable($filename) { foreach ($this->config->getExecutableFiles() as $exFile) { if ($filename === $exFile) { return true; } } return false; }
[ "protected", "function", "shouldBeExecutable", "(", "$", "filename", ")", "{", "foreach", "(", "$", "this", "->", "config", "->", "getExecutableFiles", "(", ")", "as", "$", "exFile", ")", "{", "if", "(", "$", "filename", "===", "$", "exFile", ")", "{", ...
Check whether the given file should be executable. @param string $filename The filename to check. @return boolean
[ "Check", "whether", "the", "given", "file", "should", "be", "executable", "." ]
train
https://github.com/eXistenZNL/PermCheck/blob/f22f2936350f6b440222fb6ea37dfc382fc4550e/src/PermCheck.php#L165-L173
eXistenZNL/PermCheck
src/PermCheck.php
PermCheck.getRelativeFilename
protected function getRelativeFilename(SplFileInfo $file) { $filename = $file->getPathname(); $regex = sprintf('#^(%s)/(.+)#', $this->directory); $matches = array(); preg_match( $regex, $filename, $matches ); return $matches[2]; }
php
protected function getRelativeFilename(SplFileInfo $file) { $filename = $file->getPathname(); $regex = sprintf('#^(%s)/(.+)#', $this->directory); $matches = array(); preg_match( $regex, $filename, $matches ); return $matches[2]; }
[ "protected", "function", "getRelativeFilename", "(", "SplFileInfo", "$", "file", ")", "{", "$", "filename", "=", "$", "file", "->", "getPathname", "(", ")", ";", "$", "regex", "=", "sprintf", "(", "'#^(%s)/(.+)#'", ",", "$", "this", "->", "directory", ")",...
Get the relative name of the given file. @param SplFileInfo $file The file to get the relative name for. @return string
[ "Get", "the", "relative", "name", "of", "the", "given", "file", "." ]
train
https://github.com/eXistenZNL/PermCheck/blob/f22f2936350f6b440222fb6ea37dfc382fc4550e/src/PermCheck.php#L182-L195
PHPPowertools/HTML5
src/PowerTools/HTML5/Serializer/Traverser.php
HTML5_Serializer_Traverser.walk
public function walk() { if ($this->dom instanceof \DOMDocument) { $this->rules->document($this->dom); } elseif ($this->dom instanceof \DOMDocumentFragment) { // Document fragments are a special case. Only the children need to // be serialized. if ($this->dom->hasChildNodes()) { $this->children($this->dom->childNodes); } } // If NodeList, loop elseif ($this->dom instanceof \DOMNodeList) { // If this is a NodeList of DOMDocuments this will not work. $this->children($this->dom); } // Else assume this is a DOMNode-like datastructure. else { $this->node($this->dom); } return $this->out; }
php
public function walk() { if ($this->dom instanceof \DOMDocument) { $this->rules->document($this->dom); } elseif ($this->dom instanceof \DOMDocumentFragment) { // Document fragments are a special case. Only the children need to // be serialized. if ($this->dom->hasChildNodes()) { $this->children($this->dom->childNodes); } } // If NodeList, loop elseif ($this->dom instanceof \DOMNodeList) { // If this is a NodeList of DOMDocuments this will not work. $this->children($this->dom); } // Else assume this is a DOMNode-like datastructure. else { $this->node($this->dom); } return $this->out; }
[ "public", "function", "walk", "(", ")", "{", "if", "(", "$", "this", "->", "dom", "instanceof", "\\", "DOMDocument", ")", "{", "$", "this", "->", "rules", "->", "document", "(", "$", "this", "->", "dom", ")", ";", "}", "elseif", "(", "$", "this", ...
Tell the traverser to walk the DOM. @return resource $out Returns the output stream.
[ "Tell", "the", "traverser", "to", "walk", "the", "DOM", "." ]
train
https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Serializer/Traverser.php#L142-L161
PHPPowertools/HTML5
src/PowerTools/HTML5/Serializer/Traverser.php
HTML5_Serializer_Traverser.node
public function node(\DOMNode $node) { // A listing of types is at http://php.net/manual/en/dom.constants.php switch ($node->nodeType) { case XML_ELEMENT_NODE: $this->rules->element($node); break; case XML_TEXT_NODE: $this->rules->text($node); break; case XML_CDATA_SECTION_NODE: $this->rules->cdata($node); break; // FIXME: It appears that the parser doesn't do PI's. case XML_PI_NODE: $this->rules->processorInstruction($node); break; case XML_COMMENT_NODE: $this->rules->comment($node); break; // Currently we don't support embedding DTDs. default: print '<!-- Skipped -->'; break; } }
php
public function node(\DOMNode $node) { // A listing of types is at http://php.net/manual/en/dom.constants.php switch ($node->nodeType) { case XML_ELEMENT_NODE: $this->rules->element($node); break; case XML_TEXT_NODE: $this->rules->text($node); break; case XML_CDATA_SECTION_NODE: $this->rules->cdata($node); break; // FIXME: It appears that the parser doesn't do PI's. case XML_PI_NODE: $this->rules->processorInstruction($node); break; case XML_COMMENT_NODE: $this->rules->comment($node); break; // Currently we don't support embedding DTDs. default: print '<!-- Skipped -->'; break; } }
[ "public", "function", "node", "(", "\\", "DOMNode", "$", "node", ")", "{", "// A listing of types is at http://php.net/manual/en/dom.constants.php", "switch", "(", "$", "node", "->", "nodeType", ")", "{", "case", "XML_ELEMENT_NODE", ":", "$", "this", "->", "rules", ...
Process a node in the DOM. @param mixed $node A node implementing \DOMNode.
[ "Process", "a", "node", "in", "the", "DOM", "." ]
train
https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Serializer/Traverser.php#L169-L193
PHPPowertools/HTML5
src/PowerTools/HTML5/Serializer/Traverser.php
HTML5_Serializer_Traverser.isLocalElement
public function isLocalElement($element) { $uri = $element->namespaceURI; if (empty($uri)) { return false; } return isset(static::$local_ns[$uri]); }
php
public function isLocalElement($element) { $uri = $element->namespaceURI; if (empty($uri)) { return false; } return isset(static::$local_ns[$uri]); }
[ "public", "function", "isLocalElement", "(", "$", "element", ")", "{", "$", "uri", "=", "$", "element", "->", "namespaceURI", ";", "if", "(", "empty", "(", "$", "uri", ")", ")", "{", "return", "false", ";", "}", "return", "isset", "(", "static", "::"...
Is an element local? @param mixed $element An element that implement \DOMNode. @return bool True if local and false otherwise.
[ "Is", "an", "element", "local?" ]
train
https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Serializer/Traverser.php#L215-L222
HedronDev/hedron
src/Parser/GitPull.php
GitPull.parse
public function parse(GitPostReceiveHandler $handler, CommandStackInterface $commandStack) { $configuration = $this->getConfiguration(); $environment = $this->getEnvironment(); $clientDir = $this->getGitDirectoryPath(); if ($this->getFileSystem()->exists($clientDir)) { $commandStack->addCommand("unset GIT_DIR"); $commandStack->addCommand("git -C $clientDir pull"); } else { $commandStack->addCommand("git clone --branch {$configuration->getBranch()} {$environment->getGitRepository()} $clientDir"); } $commandStack->execute(); }
php
public function parse(GitPostReceiveHandler $handler, CommandStackInterface $commandStack) { $configuration = $this->getConfiguration(); $environment = $this->getEnvironment(); $clientDir = $this->getGitDirectoryPath(); if ($this->getFileSystem()->exists($clientDir)) { $commandStack->addCommand("unset GIT_DIR"); $commandStack->addCommand("git -C $clientDir pull"); } else { $commandStack->addCommand("git clone --branch {$configuration->getBranch()} {$environment->getGitRepository()} $clientDir"); } $commandStack->execute(); }
[ "public", "function", "parse", "(", "GitPostReceiveHandler", "$", "handler", ",", "CommandStackInterface", "$", "commandStack", ")", "{", "$", "configuration", "=", "$", "this", "->", "getConfiguration", "(", ")", ";", "$", "environment", "=", "$", "this", "->...
{@inheritdoc}
[ "{" ]
train
https://github.com/HedronDev/hedron/blob/3b4adec4912f2d7c0b7e7262dc36515fbc2e8e00/src/Parser/GitPull.php#L18-L30
HedronDev/hedron
src/Parser/GitPull.php
GitPull.destroy
public function destroy(GitPostReceiveHandler $handler, CommandStackInterface $commandStack) { $dir = $this->getGitDirectoryPath(); $commandStack->addCommand("rm -Rf $dir"); $commandStack->execute(); }
php
public function destroy(GitPostReceiveHandler $handler, CommandStackInterface $commandStack) { $dir = $this->getGitDirectoryPath(); $commandStack->addCommand("rm -Rf $dir"); $commandStack->execute(); }
[ "public", "function", "destroy", "(", "GitPostReceiveHandler", "$", "handler", ",", "CommandStackInterface", "$", "commandStack", ")", "{", "$", "dir", "=", "$", "this", "->", "getGitDirectoryPath", "(", ")", ";", "$", "commandStack", "->", "addCommand", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/HedronDev/hedron/blob/3b4adec4912f2d7c0b7e7262dc36515fbc2e8e00/src/Parser/GitPull.php#L35-L39
WScore/Validation
src/Dio.php
Dio.evaluateAll
private function evaluateAll() { if($this->isEvaluated) { return; } foreach($this->rules as $key => $rule) { $this->evaluateAndGet($key); } }
php
private function evaluateAll() { if($this->isEvaluated) { return; } foreach($this->rules as $key => $rule) { $this->evaluateAndGet($key); } }
[ "private", "function", "evaluateAll", "(", ")", "{", "if", "(", "$", "this", "->", "isEvaluated", ")", "{", "return", ";", "}", "foreach", "(", "$", "this", "->", "rules", "as", "$", "key", "=>", "$", "rule", ")", "{", "$", "this", "->", "evaluateA...
evaluate all the rules and saves the into $this->found.
[ "evaluate", "all", "the", "rules", "and", "saves", "the", "into", "$this", "-", ">", "found", "." ]
train
https://github.com/WScore/Validation/blob/25c0dca37d624bb0bb22f8e79ba54db2f69e0950/src/Dio.php#L109-L117
WScore/Validation
src/Dio.php
Dio.get
public function get($key) { $valTO = $this->evaluate($key); if ($valTO->fails()) { return false; } return $valTO->getValidValue(); }
php
public function get($key) { $valTO = $this->evaluate($key); if ($valTO->fails()) { return false; } return $valTO->getValidValue(); }
[ "public", "function", "get", "(", "$", "key", ")", "{", "$", "valTO", "=", "$", "this", "->", "evaluate", "(", "$", "key", ")", ";", "if", "(", "$", "valTO", "->", "fails", "(", ")", ")", "{", "return", "false", ";", "}", "return", "$", "valTO"...
sets rules for the $key, and returns the evaluated value. returns false if invalidated. @param string $key @return bool|mixed
[ "sets", "rules", "for", "the", "$key", "and", "returns", "the", "evaluated", "value", ".", "returns", "false", "if", "invalidated", "." ]
train
https://github.com/WScore/Validation/blob/25c0dca37d624bb0bb22f8e79ba54db2f69e0950/src/Dio.php#L128-L136
WScore/Validation
src/Dio.php
Dio.evaluateAndGet
private function evaluateAndGet($key) { $valTO = $this->evaluate($key); $this->setValue($key, $valTO); if ($valTO->fails()) { $this->err_num++; } }
php
private function evaluateAndGet($key) { $valTO = $this->evaluate($key); $this->setValue($key, $valTO); if ($valTO->fails()) { $this->err_num++; } }
[ "private", "function", "evaluateAndGet", "(", "$", "key", ")", "{", "$", "valTO", "=", "$", "this", "->", "evaluate", "(", "$", "key", ")", ";", "$", "this", "->", "setValue", "(", "$", "key", ",", "$", "valTO", ")", ";", "if", "(", "$", "valTO",...
evaluate for $key and stores results in $this->found and $this->messages. @param string $key
[ "evaluate", "for", "$key", "and", "stores", "results", "in", "$this", "-", ">", "found", "and", "$this", "-", ">", "messages", "." ]
train
https://github.com/WScore/Validation/blob/25c0dca37d624bb0bb22f8e79ba54db2f69e0950/src/Dio.php#L143-L151
WScore/Validation
src/Dio.php
Dio.find
public function find($key, $rules = []) { if (Utils\Helper::arrGet($rules, 'multiple')) { // check for multiple case i.e. Y-m-d. return Utils\HelperMultiple::prepare($key, $this->source, $rules['multiple']); } $value = Helper::arrGet($this->source, $key); if (is_array($value)) { return Utils\Helper::arrGet($rules, 'array') ? $value : ''; } return (string) $value; }
php
public function find($key, $rules = []) { if (Utils\Helper::arrGet($rules, 'multiple')) { // check for multiple case i.e. Y-m-d. return Utils\HelperMultiple::prepare($key, $this->source, $rules['multiple']); } $value = Helper::arrGet($this->source, $key); if (is_array($value)) { return Utils\Helper::arrGet($rules, 'array') ? $value : ''; } return (string) $value; }
[ "public", "function", "find", "(", "$", "key", ",", "$", "rules", "=", "[", "]", ")", "{", "if", "(", "Utils", "\\", "Helper", "::", "arrGet", "(", "$", "rules", ",", "'multiple'", ")", ")", "{", "// check for multiple case i.e. Y-m-d.", "return", "Utils...
finds a value with $key in the source data. @param string $key @param array|Rules $rules @return string|array
[ "finds", "a", "value", "with", "$key", "in", "the", "source", "data", "." ]
train
https://github.com/WScore/Validation/blob/25c0dca37d624bb0bb22f8e79ba54db2f69e0950/src/Dio.php#L252-L266
WScore/Validation
src/Dio.php
Dio.setupRules
private function setupRules($rules) { // prepares filter for requiredIf $rules = Utils\HelperRequiredIf::prepare($this, $rules); // prepares filter for sameWith. $rules = Utils\HelperSameWith::prepare($this, $rules); return $rules; }
php
private function setupRules($rules) { // prepares filter for requiredIf $rules = Utils\HelperRequiredIf::prepare($this, $rules); // prepares filter for sameWith. $rules = Utils\HelperSameWith::prepare($this, $rules); return $rules; }
[ "private", "function", "setupRules", "(", "$", "rules", ")", "{", "// prepares filter for requiredIf", "$", "rules", "=", "Utils", "\\", "HelperRequiredIf", "::", "prepare", "(", "$", "this", ",", "$", "rules", ")", ";", "// prepares filter for sameWith.", "$", ...
set up rules; - add required rule based on requiredIf rule. - add sameAs rule based on sameWith rule. @param array|Rules $rules @return array|Rules
[ "set", "up", "rules", ";", "-", "add", "required", "rule", "based", "on", "requiredIf", "rule", ".", "-", "add", "sameAs", "rule", "based", "on", "sameWith", "rule", "." ]
train
https://github.com/WScore/Validation/blob/25c0dca37d624bb0bb22f8e79ba54db2f69e0950/src/Dio.php#L276-L285
heidelpay/PhpDoc
src/phpDocumentor/Plugin/Core/Descriptor/Validator/Constraints/Functions/IsArgumentInDocBlockValidator.php
IsArgumentInDocBlockValidator.existsParamTagWithArgument
private function existsParamTagWithArgument($parameters, ArgumentDescriptor $argument) { foreach ($parameters as $parameter) { if ($argument->getName() == $parameter->getVariableName()) { return true; } } return false; }
php
private function existsParamTagWithArgument($parameters, ArgumentDescriptor $argument) { foreach ($parameters as $parameter) { if ($argument->getName() == $parameter->getVariableName()) { return true; } } return false; }
[ "private", "function", "existsParamTagWithArgument", "(", "$", "parameters", ",", "ArgumentDescriptor", "$", "argument", ")", "{", "foreach", "(", "$", "parameters", "as", "$", "parameter", ")", "{", "if", "(", "$", "argument", "->", "getName", "(", ")", "==...
Returns whether the list of param tags features the given argument. @param ParamDescriptor[]|Collection $parameters @param ArgumentDescriptor $argument @return boolean
[ "Returns", "whether", "the", "list", "of", "param", "tags", "features", "the", "given", "argument", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Plugin/Core/Descriptor/Validator/Constraints/Functions/IsArgumentInDocBlockValidator.php#L62-L71
verdet23/SphinxSearchBundle
Command/SearchSphinxIndexerRotateCommand.php
SearchSphinxIndexerRotateCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $index = $input->getArgument('index'); /** @var $indexer \Verdet\SphinxSearchBundle\Services\Indexer\Indexer */ $indexer = $this->getContainer()->get('search.sphinxsearch.indexer'); if ($index == 'all') { try { $output->writeln('Start rotate "<info>all</info>" indexes'); $indexer->rotateAll(); $output->writeln('Rotation complete'); } catch (\RuntimeException $e) { $output->writeln('Error occurred during rotation:'); $output->writeln($e->getMessage()); } } else { if ($indexer->checkIndex($index)) { try { $output->writeln(sprintf('Start rotate "<info>%s</info>" index', $index)); $indexer->rotate($index); $output->writeln('Rotation complete'); } catch (\RuntimeException $e) { $output->writeln('Error occurred during rotation:'); $output->writeln($e->getMessage()); } } else { $output->writeln('Index not configured'); } } }
php
protected function execute(InputInterface $input, OutputInterface $output) { $index = $input->getArgument('index'); /** @var $indexer \Verdet\SphinxSearchBundle\Services\Indexer\Indexer */ $indexer = $this->getContainer()->get('search.sphinxsearch.indexer'); if ($index == 'all') { try { $output->writeln('Start rotate "<info>all</info>" indexes'); $indexer->rotateAll(); $output->writeln('Rotation complete'); } catch (\RuntimeException $e) { $output->writeln('Error occurred during rotation:'); $output->writeln($e->getMessage()); } } else { if ($indexer->checkIndex($index)) { try { $output->writeln(sprintf('Start rotate "<info>%s</info>" index', $index)); $indexer->rotate($index); $output->writeln('Rotation complete'); } catch (\RuntimeException $e) { $output->writeln('Error occurred during rotation:'); $output->writeln($e->getMessage()); } } else { $output->writeln('Index not configured'); } } }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "index", "=", "$", "input", "->", "getArgument", "(", "'index'", ")", ";", "/** @var $indexer \\Verdet\\SphinxSearchBundle\\Services\\Indexer...
{@inheritDoc}
[ "{" ]
train
https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/Command/SearchSphinxIndexerRotateCommand.php#L39-L69
heidelpay/PhpDoc
src/phpDocumentor/Parser/Command/Project/ParseCommand.php
ParseCommand.configure
protected function configure() { // minimization of the following expression $VALUE_OPTIONAL_ARRAY = InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY; $this->setAliases(array('parse')) ->setDescription($this->__('PPCPP-DESCRIPTION')) ->setHelp($this->__('PPCPP-HELPTEXT')) ->addOption('filename', 'f', $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-FILENAME')) ->addOption('directory', 'd', $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-DIRECTORY')) ->addOption('target', 't', InputOption::VALUE_OPTIONAL, $this->__('PPCPP:OPT-TARGET')) ->addOption('encoding', null, InputOption::VALUE_OPTIONAL, $this->__('PPCPP:OPT-ENCODING')) ->addOption('extensions', 'e', $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-EXTENSIONS')) ->addOption('ignore', 'i', $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-IGNORE')) ->addOption('ignore-tags', null, $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-IGNORETAGS')) ->addOption('hidden', null, InputOption::VALUE_NONE, $this->__('PPCPP:OPT-HIDDEN')) ->addOption('ignore-symlinks', null, InputOption::VALUE_NONE, $this->__('PPCPP:OPT-IGNORESYMLINKS')) ->addOption('markers', 'm', $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-MARKERS'), array('TODO', 'FIXME')) ->addOption('title', null, InputOption::VALUE_OPTIONAL, $this->__('PPCPP:OPT-TITLE')) ->addOption('force', null, InputOption::VALUE_NONE, $this->__('PPCPP:OPT-FORCE')) ->addOption('validate', null, InputOption::VALUE_NONE, $this->__('PPCPP:OPT-VALIDATE')) ->addOption('visibility', null, $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-VISIBILITY')) ->addOption('sourcecode', null, InputOption::VALUE_NONE, $this->__('PPCPP:OPT-SOURCECODE')) ->addOption('progressbar', 'p', InputOption::VALUE_NONE, $this->__('PPCPP:OPT-PROGRESSBAR')) ->addOption('parseprivate', null, InputOption::VALUE_NONE, 'PPCPP:OPT-PARSEPRIVATE') ->addOption( 'defaultpackagename', null, InputOption::VALUE_OPTIONAL, $this->__('PPCPP:OPT-DEFAULTPACKAGENAME'), 'Default' ); parent::configure(); }
php
protected function configure() { // minimization of the following expression $VALUE_OPTIONAL_ARRAY = InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY; $this->setAliases(array('parse')) ->setDescription($this->__('PPCPP-DESCRIPTION')) ->setHelp($this->__('PPCPP-HELPTEXT')) ->addOption('filename', 'f', $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-FILENAME')) ->addOption('directory', 'd', $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-DIRECTORY')) ->addOption('target', 't', InputOption::VALUE_OPTIONAL, $this->__('PPCPP:OPT-TARGET')) ->addOption('encoding', null, InputOption::VALUE_OPTIONAL, $this->__('PPCPP:OPT-ENCODING')) ->addOption('extensions', 'e', $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-EXTENSIONS')) ->addOption('ignore', 'i', $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-IGNORE')) ->addOption('ignore-tags', null, $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-IGNORETAGS')) ->addOption('hidden', null, InputOption::VALUE_NONE, $this->__('PPCPP:OPT-HIDDEN')) ->addOption('ignore-symlinks', null, InputOption::VALUE_NONE, $this->__('PPCPP:OPT-IGNORESYMLINKS')) ->addOption('markers', 'm', $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-MARKERS'), array('TODO', 'FIXME')) ->addOption('title', null, InputOption::VALUE_OPTIONAL, $this->__('PPCPP:OPT-TITLE')) ->addOption('force', null, InputOption::VALUE_NONE, $this->__('PPCPP:OPT-FORCE')) ->addOption('validate', null, InputOption::VALUE_NONE, $this->__('PPCPP:OPT-VALIDATE')) ->addOption('visibility', null, $VALUE_OPTIONAL_ARRAY, $this->__('PPCPP:OPT-VISIBILITY')) ->addOption('sourcecode', null, InputOption::VALUE_NONE, $this->__('PPCPP:OPT-SOURCECODE')) ->addOption('progressbar', 'p', InputOption::VALUE_NONE, $this->__('PPCPP:OPT-PROGRESSBAR')) ->addOption('parseprivate', null, InputOption::VALUE_NONE, 'PPCPP:OPT-PARSEPRIVATE') ->addOption( 'defaultpackagename', null, InputOption::VALUE_OPTIONAL, $this->__('PPCPP:OPT-DEFAULTPACKAGENAME'), 'Default' ); parent::configure(); }
[ "protected", "function", "configure", "(", ")", "{", "// minimization of the following expression", "$", "VALUE_OPTIONAL_ARRAY", "=", "InputOption", "::", "VALUE_OPTIONAL", "|", "InputOption", "::", "VALUE_IS_ARRAY", ";", "$", "this", "->", "setAliases", "(", "array", ...
Initializes this command and sets the name, description, options and arguments. @return void
[ "Initializes", "this", "command", "and", "sets", "the", "name", "description", "options", "and", "arguments", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Parser/Command/Project/ParseCommand.php#L96-L130
heidelpay/PhpDoc
src/phpDocumentor/Parser/Command/Project/ParseCommand.php
ParseCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { /** @var ConfigurationHelper $configurationHelper */ $configurationHelper = $this->getHelper('phpdocumentor_configuration'); $target = $configurationHelper->getOption($input, 'target', 'parser/target'); if (strpos($target, '/tmp/') === 0) { $target = str_replace('/tmp/', sys_get_temp_dir() . DIRECTORY_SEPARATOR, $target); } $fileSystem = new Filesystem(); if (! $fileSystem->isAbsolutePath($target)) { $target = getcwd().DIRECTORY_SEPARATOR.$target; } if (!file_exists($target)) { mkdir($target, 0777, true); } if (!is_dir($target)) { throw new \Exception($this->__('PPCPP:EXC-BADTARGET')); } $this->getCache()->getOptions()->setCacheDir($target); $builder = $this->getBuilder(); $builder->createProjectDescriptor(); $projectDescriptor = $builder->getProjectDescriptor(); $output->write($this->__('PPCPP:LOG-COLLECTING')); $files = $this->getFileCollection($input); /** @var Finder $exampleFinder */ $exampleFinder = $this->getContainer()->offsetGet('parser.example.finder'); $exampleFinder->setSourceDirectory($files->getProjectRoot()); $exampleFinder->setExampleDirectories($configurationHelper->getConfigValueFromPath('files/examples')); $output->writeln($this->__('PPCPP:LOG-OK')); /** @var ProgressHelper $progress */ $progress = $this->getProgressBar($input); if (!$progress) { $this->getHelper('phpdocumentor_logger')->connectOutputToLogging($output, $this); } $output->write($this->__('PPCPP:LOG-INITIALIZING')); $this->populateParser($input, $files); if ($progress) { $progress->start($output, $files->count()); } try { $output->writeln($this->__('PPCPP:LOG-OK')); $output->writeln($this->__('PPCPP:LOG-PARSING')); $mapper = new ProjectDescriptorMapper($this->getCache()); $mapper->garbageCollect($files); $mapper->populate($projectDescriptor); $visibility = (array) $configurationHelper->getOption($input, 'visibility', 'parser/visibility'); $visibilities = array(); foreach ($visibility as $item) { $visibilities = $visibilities + explode(',', $item); } $visibility = null; foreach ($visibilities as $item) { switch ($item) { case 'public': $visibility |= ProjectDescriptor\Settings::VISIBILITY_PUBLIC; break; case 'protected': $visibility |= ProjectDescriptor\Settings::VISIBILITY_PROTECTED; break; case 'private': $visibility |= ProjectDescriptor\Settings::VISIBILITY_PRIVATE; break; } } if ($visibility === null) { $visibility = ProjectDescriptor\Settings::VISIBILITY_DEFAULT; } if ($input->getOption('parseprivate')) { $visibility = $visibility | ProjectDescriptor\Settings::VISIBILITY_INTERNAL; } $projectDescriptor->getSettings()->setVisibility($visibility); $this->getParser()->parse($builder, $files); } catch (FilesNotFoundException $e) { throw new \Exception($this->__('PPCPP:EXC-NOFILES')); } catch (\Exception $e) { throw new \Exception($e->getMessage(), 0, $e); } if ($progress) { $progress->finish(); } $projectDescriptor->setPartials($this->getService('partials')); $output->write($this->__('PPCPP:LOG-STORECACHE', (array) $this->getCache()->getOptions()->getCacheDir())); $projectDescriptor->getSettings()->clearModifiedFlag(); $mapper->save($projectDescriptor); $output->writeln($this->__('PPCPP:LOG-OK')); return 0; }
php
protected function execute(InputInterface $input, OutputInterface $output) { /** @var ConfigurationHelper $configurationHelper */ $configurationHelper = $this->getHelper('phpdocumentor_configuration'); $target = $configurationHelper->getOption($input, 'target', 'parser/target'); if (strpos($target, '/tmp/') === 0) { $target = str_replace('/tmp/', sys_get_temp_dir() . DIRECTORY_SEPARATOR, $target); } $fileSystem = new Filesystem(); if (! $fileSystem->isAbsolutePath($target)) { $target = getcwd().DIRECTORY_SEPARATOR.$target; } if (!file_exists($target)) { mkdir($target, 0777, true); } if (!is_dir($target)) { throw new \Exception($this->__('PPCPP:EXC-BADTARGET')); } $this->getCache()->getOptions()->setCacheDir($target); $builder = $this->getBuilder(); $builder->createProjectDescriptor(); $projectDescriptor = $builder->getProjectDescriptor(); $output->write($this->__('PPCPP:LOG-COLLECTING')); $files = $this->getFileCollection($input); /** @var Finder $exampleFinder */ $exampleFinder = $this->getContainer()->offsetGet('parser.example.finder'); $exampleFinder->setSourceDirectory($files->getProjectRoot()); $exampleFinder->setExampleDirectories($configurationHelper->getConfigValueFromPath('files/examples')); $output->writeln($this->__('PPCPP:LOG-OK')); /** @var ProgressHelper $progress */ $progress = $this->getProgressBar($input); if (!$progress) { $this->getHelper('phpdocumentor_logger')->connectOutputToLogging($output, $this); } $output->write($this->__('PPCPP:LOG-INITIALIZING')); $this->populateParser($input, $files); if ($progress) { $progress->start($output, $files->count()); } try { $output->writeln($this->__('PPCPP:LOG-OK')); $output->writeln($this->__('PPCPP:LOG-PARSING')); $mapper = new ProjectDescriptorMapper($this->getCache()); $mapper->garbageCollect($files); $mapper->populate($projectDescriptor); $visibility = (array) $configurationHelper->getOption($input, 'visibility', 'parser/visibility'); $visibilities = array(); foreach ($visibility as $item) { $visibilities = $visibilities + explode(',', $item); } $visibility = null; foreach ($visibilities as $item) { switch ($item) { case 'public': $visibility |= ProjectDescriptor\Settings::VISIBILITY_PUBLIC; break; case 'protected': $visibility |= ProjectDescriptor\Settings::VISIBILITY_PROTECTED; break; case 'private': $visibility |= ProjectDescriptor\Settings::VISIBILITY_PRIVATE; break; } } if ($visibility === null) { $visibility = ProjectDescriptor\Settings::VISIBILITY_DEFAULT; } if ($input->getOption('parseprivate')) { $visibility = $visibility | ProjectDescriptor\Settings::VISIBILITY_INTERNAL; } $projectDescriptor->getSettings()->setVisibility($visibility); $this->getParser()->parse($builder, $files); } catch (FilesNotFoundException $e) { throw new \Exception($this->__('PPCPP:EXC-NOFILES')); } catch (\Exception $e) { throw new \Exception($e->getMessage(), 0, $e); } if ($progress) { $progress->finish(); } $projectDescriptor->setPartials($this->getService('partials')); $output->write($this->__('PPCPP:LOG-STORECACHE', (array) $this->getCache()->getOptions()->getCacheDir())); $projectDescriptor->getSettings()->clearModifiedFlag(); $mapper->save($projectDescriptor); $output->writeln($this->__('PPCPP:LOG-OK')); return 0; }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "/** @var ConfigurationHelper $configurationHelper */", "$", "configurationHelper", "=", "$", "this", "->", "getHelper", "(", "'phpdocumentor_configur...
Executes the business logic involved with this command. @param InputInterface $input @param OutputInterface $output @throws \Exception if the target location is not a folder. @return integer
[ "Executes", "the", "business", "logic", "involved", "with", "this", "command", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Parser/Command/Project/ParseCommand.php#L142-L244
heidelpay/PhpDoc
src/phpDocumentor/Parser/Command/Project/ParseCommand.php
ParseCommand.getFileCollection
protected function getFileCollection($input) { /** @var ConfigurationHelper $configurationHelper */ $configurationHelper = $this->getHelper('phpdocumentor_configuration'); $this->files->setAllowedExtensions( $configurationHelper->getOption( $input, 'extensions', 'parser/extensions', array('php', 'php3', 'phtml'), true ) ); $this->files->setIgnorePatterns($configurationHelper->getOption($input, 'ignore', 'files/ignore', array(), true)); $ignoreHidden = $configurationHelper->getOption($input, 'hidden', 'files/ignore-hidden', 'off'); $this->files->setIgnoreHidden($ignoreHidden !== 'off' && $ignoreHidden === false); $this->files->setFollowSymlinks( $configurationHelper->getOption($input, 'ignore-symlinks', 'files/ignore-symlinks', 'off') == 'on' ); $file_options = (array) $configurationHelper->getOption($input, 'filename', 'files/files', array(), true); $added_files = array(); foreach ($file_options as $glob) { if (!is_string($glob)) { continue; } $matches = glob($glob); if (is_array($matches)) { foreach ($matches as $file) { if (!empty($file)) { $file = realpath($file); if (!empty($file)) { $added_files[] = $file; } } } } } $this->files->addFiles($added_files); $directory_options = $configurationHelper->getOption($input, 'directory', 'files/directories', array(), true); $added_directories = array(); foreach ($directory_options as $glob) { if (!is_string($glob)) { continue; } $matches = glob($glob, GLOB_ONLYDIR); if (is_array($matches)) { foreach ($matches as $dir) { if (!empty($dir)) { $dir = realpath($dir); if (!empty($dir)) { $added_directories[] = $dir; } } } } } $this->files->addDirectories($added_directories); return $this->files; }
php
protected function getFileCollection($input) { /** @var ConfigurationHelper $configurationHelper */ $configurationHelper = $this->getHelper('phpdocumentor_configuration'); $this->files->setAllowedExtensions( $configurationHelper->getOption( $input, 'extensions', 'parser/extensions', array('php', 'php3', 'phtml'), true ) ); $this->files->setIgnorePatterns($configurationHelper->getOption($input, 'ignore', 'files/ignore', array(), true)); $ignoreHidden = $configurationHelper->getOption($input, 'hidden', 'files/ignore-hidden', 'off'); $this->files->setIgnoreHidden($ignoreHidden !== 'off' && $ignoreHidden === false); $this->files->setFollowSymlinks( $configurationHelper->getOption($input, 'ignore-symlinks', 'files/ignore-symlinks', 'off') == 'on' ); $file_options = (array) $configurationHelper->getOption($input, 'filename', 'files/files', array(), true); $added_files = array(); foreach ($file_options as $glob) { if (!is_string($glob)) { continue; } $matches = glob($glob); if (is_array($matches)) { foreach ($matches as $file) { if (!empty($file)) { $file = realpath($file); if (!empty($file)) { $added_files[] = $file; } } } } } $this->files->addFiles($added_files); $directory_options = $configurationHelper->getOption($input, 'directory', 'files/directories', array(), true); $added_directories = array(); foreach ($directory_options as $glob) { if (!is_string($glob)) { continue; } $matches = glob($glob, GLOB_ONLYDIR); if (is_array($matches)) { foreach ($matches as $dir) { if (!empty($dir)) { $dir = realpath($dir); if (!empty($dir)) { $added_directories[] = $dir; } } } } } $this->files->addDirectories($added_directories); return $this->files; }
[ "protected", "function", "getFileCollection", "(", "$", "input", ")", "{", "/** @var ConfigurationHelper $configurationHelper */", "$", "configurationHelper", "=", "$", "this", "->", "getHelper", "(", "'phpdocumentor_configuration'", ")", ";", "$", "this", "->", "files"...
Returns the collection of files based on the input and configuration. @param InputInterface $input @return Collection
[ "Returns", "the", "collection", "of", "files", "based", "on", "the", "input", "and", "configuration", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Parser/Command/Project/ParseCommand.php#L273-L337
heidelpay/PhpDoc
src/phpDocumentor/Parser/Command/Project/ParseCommand.php
ParseCommand.getProgressBar
protected function getProgressBar(InputInterface $input) { $progress = parent::getProgressBar($input); if (!$progress) { return null; } $this->getService('event_dispatcher')->addListener( 'parser.file.pre', function (PreFileEvent $event) use ($progress) { $progress->advance(); } ); return $progress; }
php
protected function getProgressBar(InputInterface $input) { $progress = parent::getProgressBar($input); if (!$progress) { return null; } $this->getService('event_dispatcher')->addListener( 'parser.file.pre', function (PreFileEvent $event) use ($progress) { $progress->advance(); } ); return $progress; }
[ "protected", "function", "getProgressBar", "(", "InputInterface", "$", "input", ")", "{", "$", "progress", "=", "parent", "::", "getProgressBar", "(", "$", "input", ")", ";", "if", "(", "!", "$", "progress", ")", "{", "return", "null", ";", "}", "$", "...
Adds the parser.file.pre event to the advance the progressbar. @param InputInterface $input @return \Symfony\Component\Console\Helper\HelperInterface|null
[ "Adds", "the", "parser", ".", "file", ".", "pre", "event", "to", "the", "advance", "the", "progressbar", "." ]
train
https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Parser/Command/Project/ParseCommand.php#L346-L361
zhouyl/mellivora
Mellivora/Database/Query/Grammars/PostgresGrammar.php
PostgresGrammar.compileUpdateColumns
protected function compileUpdateColumns($values) { // When gathering the columns for an update statement, we'll wrap each of the // columns and convert it to a parameter value. Then we will concatenate a // list of the columns that can be added into this update query clauses. return collect($values)->map(function ($value, $key) { return $this->wrap($key) . ' = ' . $this->parameter($value); })->implode(', '); }
php
protected function compileUpdateColumns($values) { // When gathering the columns for an update statement, we'll wrap each of the // columns and convert it to a parameter value. Then we will concatenate a // list of the columns that can be added into this update query clauses. return collect($values)->map(function ($value, $key) { return $this->wrap($key) . ' = ' . $this->parameter($value); })->implode(', '); }
[ "protected", "function", "compileUpdateColumns", "(", "$", "values", ")", "{", "// When gathering the columns for an update statement, we'll wrap each of the", "// columns and convert it to a parameter value. Then we will concatenate a", "// list of the columns that can be added into this update...
Compile the columns for the update statement. @param array $values @return string
[ "Compile", "the", "columns", "for", "the", "update", "statement", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Grammars/PostgresGrammar.php#L120-L128
zhouyl/mellivora
Mellivora/Database/Query/Grammars/PostgresGrammar.php
PostgresGrammar.compileUpdateWheres
protected function compileUpdateWheres(Builder $query) { $baseWheres = $this->compileWheres($query); if (!isset($query->joins)) { return $baseWheres; } // Once we compile the join constraints, we will either use them as the where // clause or append them to the existing base where clauses. If we need to // strip the leading boolean we will do so when using as the only where. $joinWheres = $this->compileUpdateJoinWheres($query); if (trim($baseWheres) === '') { return 'where ' . $this->removeLeadingBoolean($joinWheres); } return $baseWheres . ' ' . $joinWheres; }
php
protected function compileUpdateWheres(Builder $query) { $baseWheres = $this->compileWheres($query); if (!isset($query->joins)) { return $baseWheres; } // Once we compile the join constraints, we will either use them as the where // clause or append them to the existing base where clauses. If we need to // strip the leading boolean we will do so when using as the only where. $joinWheres = $this->compileUpdateJoinWheres($query); if (trim($baseWheres) === '') { return 'where ' . $this->removeLeadingBoolean($joinWheres); } return $baseWheres . ' ' . $joinWheres; }
[ "protected", "function", "compileUpdateWheres", "(", "Builder", "$", "query", ")", "{", "$", "baseWheres", "=", "$", "this", "->", "compileWheres", "(", "$", "query", ")", ";", "if", "(", "!", "isset", "(", "$", "query", "->", "joins", ")", ")", "{", ...
Compile the additional where clauses for updates with joins. @param \Mellivora\Database\Query\Builder $query @return string
[ "Compile", "the", "additional", "where", "clauses", "for", "updates", "with", "joins", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Grammars/PostgresGrammar.php#L162-L180
zhouyl/mellivora
Mellivora/Database/Query/Grammars/PostgresGrammar.php
PostgresGrammar.compileUpdateJoinWheres
protected function compileUpdateJoinWheres(Builder $query) { $joinWheres = []; // Here we will just loop through all of the join constraints and compile them // all out then implode them. This should give us "where" like syntax after // everything has been built and then we will join it to the real wheres. foreach ($query->joins as $join) { foreach ($join->wheres as $where) { $method = "where{$where['type']}"; $joinWheres[] = $where['boolean'] . ' ' . $this->{$method}($query, $where); } } return implode(' ', $joinWheres); }
php
protected function compileUpdateJoinWheres(Builder $query) { $joinWheres = []; // Here we will just loop through all of the join constraints and compile them // all out then implode them. This should give us "where" like syntax after // everything has been built and then we will join it to the real wheres. foreach ($query->joins as $join) { foreach ($join->wheres as $where) { $method = "where{$where['type']}"; $joinWheres[] = $where['boolean'] . ' ' . $this->{$method}($query, $where); } } return implode(' ', $joinWheres); }
[ "protected", "function", "compileUpdateJoinWheres", "(", "Builder", "$", "query", ")", "{", "$", "joinWheres", "=", "[", "]", ";", "// Here we will just loop through all of the join constraints and compile them", "// all out then implode them. This should give us \"where\" like synta...
Compile the "join" clause where clauses for an update. @param \Mellivora\Database\Query\Builder $query @return string
[ "Compile", "the", "join", "clause", "where", "clauses", "for", "an", "update", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Grammars/PostgresGrammar.php#L189-L205
zhouyl/mellivora
Mellivora/Database/Query/Grammars/PostgresGrammar.php
PostgresGrammar.wrapValue
protected function wrapValue($value) { if ($value === '*') { return $value; } // If the given value is a JSON selector we will wrap it differently than a // traditional value. We will need to split this path and wrap each part // wrapped, etc. Otherwise, we will simply wrap the value as a string. if (Str::contains($value, '->')) { return $this->wrapJsonSelector($value); } return '"' . str_replace('"', '""', $value) . '"'; }
php
protected function wrapValue($value) { if ($value === '*') { return $value; } // If the given value is a JSON selector we will wrap it differently than a // traditional value. We will need to split this path and wrap each part // wrapped, etc. Otherwise, we will simply wrap the value as a string. if (Str::contains($value, '->')) { return $this->wrapJsonSelector($value); } return '"' . str_replace('"', '""', $value) . '"'; }
[ "protected", "function", "wrapValue", "(", "$", "value", ")", "{", "if", "(", "$", "value", "===", "'*'", ")", "{", "return", "$", "value", ";", "}", "// If the given value is a JSON selector we will wrap it differently than a", "// traditional value. We will need to spli...
Wrap a single string in keyword identifiers. @param string $value @return string
[ "Wrap", "a", "single", "string", "in", "keyword", "identifiers", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Grammars/PostgresGrammar.php#L246-L260
zhouyl/mellivora
Mellivora/Database/Query/Grammars/PostgresGrammar.php
PostgresGrammar.wrapJsonSelector
protected function wrapJsonSelector($value) { $path = explode('->', $value); $field = $this->wrapValue(array_shift($path)); $wrappedPath = $this->wrapJsonPathAttributes($path); $attribute = array_pop($wrappedPath); if (!empty($wrappedPath)) { return $field . '->' . implode('->', $wrappedPath) . '->>' . $attribute; } return $field . '->>' . $attribute; }
php
protected function wrapJsonSelector($value) { $path = explode('->', $value); $field = $this->wrapValue(array_shift($path)); $wrappedPath = $this->wrapJsonPathAttributes($path); $attribute = array_pop($wrappedPath); if (!empty($wrappedPath)) { return $field . '->' . implode('->', $wrappedPath) . '->>' . $attribute; } return $field . '->>' . $attribute; }
[ "protected", "function", "wrapJsonSelector", "(", "$", "value", ")", "{", "$", "path", "=", "explode", "(", "'->'", ",", "$", "value", ")", ";", "$", "field", "=", "$", "this", "->", "wrapValue", "(", "array_shift", "(", "$", "path", ")", ")", ";", ...
Wrap the given JSON selector. @param string $value @return string
[ "Wrap", "the", "given", "JSON", "selector", "." ]
train
https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Query/Grammars/PostgresGrammar.php#L269-L284
xiewulong/yii2-fileupload
oss/libs/guzzle/plugin/Guzzle/Plugin/Backoff/BackoffPlugin.php
BackoffPlugin.onRequestSent
public function onRequestSent(Event $event) { $request = $event['request']; $response = $event['response']; $exception = $event['exception']; $params = $request->getParams(); $retries = (int) $params->get(self::RETRY_PARAM); $delay = $this->strategy->getBackoffPeriod($retries, $request, $response, $exception); if ($delay !== false) { // Calculate how long to wait until the request should be retried $params->set(self::RETRY_PARAM, ++$retries) ->set(self::DELAY_PARAM, microtime(true) + $delay); // Send the request again $request->setState(RequestInterface::STATE_TRANSFER); $this->dispatch(self::RETRY_EVENT, array( 'request' => $request, 'response' => $response, 'handle' => $exception ? $exception->getCurlHandle() : null, 'retries' => $retries, 'delay' => $delay )); } }
php
public function onRequestSent(Event $event) { $request = $event['request']; $response = $event['response']; $exception = $event['exception']; $params = $request->getParams(); $retries = (int) $params->get(self::RETRY_PARAM); $delay = $this->strategy->getBackoffPeriod($retries, $request, $response, $exception); if ($delay !== false) { // Calculate how long to wait until the request should be retried $params->set(self::RETRY_PARAM, ++$retries) ->set(self::DELAY_PARAM, microtime(true) + $delay); // Send the request again $request->setState(RequestInterface::STATE_TRANSFER); $this->dispatch(self::RETRY_EVENT, array( 'request' => $request, 'response' => $response, 'handle' => $exception ? $exception->getCurlHandle() : null, 'retries' => $retries, 'delay' => $delay )); } }
[ "public", "function", "onRequestSent", "(", "Event", "$", "event", ")", "{", "$", "request", "=", "$", "event", "[", "'request'", "]", ";", "$", "response", "=", "$", "event", "[", "'response'", "]", ";", "$", "exception", "=", "$", "event", "[", "'e...
Called when a request has been sent and isn't finished processing @param Event $event
[ "Called", "when", "a", "request", "has", "been", "sent", "and", "isn", "t", "finished", "processing" ]
train
https://github.com/xiewulong/yii2-fileupload/blob/3e75b17a4a18dd8466e3f57c63136de03470ca82/oss/libs/guzzle/plugin/Guzzle/Plugin/Backoff/BackoffPlugin.php#L76-L100
verdet23/SphinxSearchBundle
DependencyInjection/SphinxSearchExtension.php
SphinxSearchExtension.load
public function load(array $configs, ContainerBuilder $container) { $processor = new Processor(); $configuration = new Configuration(); $config = $processor->processConfiguration($configuration, $configs); $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('sphinxsearch.xml'); /** * Indexer. */ $container->setParameter('search.sphinxsearch.indexer.sudo', $config['indexer']['sudo']); $container->setParameter('search.sphinxsearch.indexer.bin', $config['indexer']['bin']); $container->setParameter('search.sphinxsearch.indexer.config', $config['indexer']['config']); /** * Indexes. */ $container->setParameter('search.sphinxsearch.indexes', $config['indexes']); /** * Searchd. */ if (isset($config['searchd'])) { $container->setParameter('search.sphinxsearch.searchd.host', $config['searchd']['host']); $container->setParameter('search.sphinxsearch.searchd.port', (int) $config['searchd']['port']); $container->setParameter('search.sphinxsearch.searchd.socket', $config['searchd']['socket']); } }
php
public function load(array $configs, ContainerBuilder $container) { $processor = new Processor(); $configuration = new Configuration(); $config = $processor->processConfiguration($configuration, $configs); $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('sphinxsearch.xml'); /** * Indexer. */ $container->setParameter('search.sphinxsearch.indexer.sudo', $config['indexer']['sudo']); $container->setParameter('search.sphinxsearch.indexer.bin', $config['indexer']['bin']); $container->setParameter('search.sphinxsearch.indexer.config', $config['indexer']['config']); /** * Indexes. */ $container->setParameter('search.sphinxsearch.indexes', $config['indexes']); /** * Searchd. */ if (isset($config['searchd'])) { $container->setParameter('search.sphinxsearch.searchd.host', $config['searchd']['host']); $container->setParameter('search.sphinxsearch.searchd.port', (int) $config['searchd']['port']); $container->setParameter('search.sphinxsearch.searchd.socket', $config['searchd']['socket']); } }
[ "public", "function", "load", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "processor", "=", "new", "Processor", "(", ")", ";", "$", "configuration", "=", "new", "Configuration", "(", ")", ";", "$", "config", "=...
{@inheritDoc}
[ "{" ]
train
https://github.com/verdet23/SphinxSearchBundle/blob/6452cc3a5fab83647b6c08574164249fb8f03b05/DependencyInjection/SphinxSearchExtension.php#L19-L50
expectation-php/expect
src/config/ConfigurationLoader.php
ConfigurationLoader.createPackages
private function createPackages(array $packages) { $matcherPackages = []; foreach ($packages as $package) { $reflection = new ReflectionClass($package); if ($reflection->implementsInterface(self::PACKAGE_REGISTRAR) === false) { throw NotAvailableException::createForPackage(self::PACKAGE_REGISTRAR); } $matcherPackages[] = $reflection->newInstance(); } return $matcherPackages; }
php
private function createPackages(array $packages) { $matcherPackages = []; foreach ($packages as $package) { $reflection = new ReflectionClass($package); if ($reflection->implementsInterface(self::PACKAGE_REGISTRAR) === false) { throw NotAvailableException::createForPackage(self::PACKAGE_REGISTRAR); } $matcherPackages[] = $reflection->newInstance(); } return $matcherPackages; }
[ "private", "function", "createPackages", "(", "array", "$", "packages", ")", "{", "$", "matcherPackages", "=", "[", "]", ";", "foreach", "(", "$", "packages", "as", "$", "package", ")", "{", "$", "reflection", "=", "new", "ReflectionClass", "(", "$", "pa...
Create a few new package registrars @param array $packages @return \expect\PackageRegistrar[]
[ "Create", "a", "few", "new", "package", "registrars" ]
train
https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/config/ConfigurationLoader.php#L62-L76
expectation-php/expect
src/config/ConfigurationLoader.php
ConfigurationLoader.createReporter
private function createReporter($reporter) { $reflection = new ReflectionClass($reporter); if ($reflection->implementsInterface(self::REPORTER) === false) { throw NotAvailableException::createForReporter(self::REPORTER); } return $reflection->newInstance(); }
php
private function createReporter($reporter) { $reflection = new ReflectionClass($reporter); if ($reflection->implementsInterface(self::REPORTER) === false) { throw NotAvailableException::createForReporter(self::REPORTER); } return $reflection->newInstance(); }
[ "private", "function", "createReporter", "(", "$", "reporter", ")", "{", "$", "reflection", "=", "new", "ReflectionClass", "(", "$", "reporter", ")", ";", "if", "(", "$", "reflection", "->", "implementsInterface", "(", "self", "::", "REPORTER", ")", "===", ...
Create a new result reporter @param string $reporter @return \expect\ResultReporter
[ "Create", "a", "new", "result", "reporter" ]
train
https://github.com/expectation-php/expect/blob/1a32c5af37f3dc8dabe4e8eedeeb21aea16ce139/src/config/ConfigurationLoader.php#L85-L94
digipolisgent/robo-digipolis-package
src/ThemeClean.php
ThemeClean.run
public function run() { // Clean bower cache before removing node_modules. $result = false; if (file_exists($this->dir . '/bower.json')) { $bower = $this->findExecutable('bower'); if (defined('PHP_WINDOWS_VERSION_BUILD')) { $bower = $this->findExecutable('node') . ' ' . (strpos($bower, 'call ') === 0 ? substr($bower, 5) : $bower); } $this->processes[] = new Process( $this->receiveCommand($bower . ' cache clean'), $this->dir, null, null, null ); $result = parent::run(); $this->processes = []; } if (file_exists($this->dir . '/Gemfile')) { $this->processes[] = new Process( $this->receiveCommand('rm -rf vendor/bundle'), $this->dir, null, null, null ); $this->processes[] = new Process( $this->receiveCommand('rm -rf .bundle'), $this->dir, null, null, null ); } if (file_exists($this->dir . '/package.json')) { $this->processes[] = new Process( $this->receiveCommand('rm -rf node_modules'), $this->dir, null, null, null ); } if (file_exists($this->dir . '/Gruntfile.js') || file_exists($this->dir . '/gulpfile.js')) { $this->processes[] = new Process( $this->receiveCommand('rm -rf .sass-cache'), $this->dir, null, null, null ); } $endresult = parent::run(); return ($result && $result->getExitCode() > $endresult->getExitCode()) ? $result : $endresult; }
php
public function run() { // Clean bower cache before removing node_modules. $result = false; if (file_exists($this->dir . '/bower.json')) { $bower = $this->findExecutable('bower'); if (defined('PHP_WINDOWS_VERSION_BUILD')) { $bower = $this->findExecutable('node') . ' ' . (strpos($bower, 'call ') === 0 ? substr($bower, 5) : $bower); } $this->processes[] = new Process( $this->receiveCommand($bower . ' cache clean'), $this->dir, null, null, null ); $result = parent::run(); $this->processes = []; } if (file_exists($this->dir . '/Gemfile')) { $this->processes[] = new Process( $this->receiveCommand('rm -rf vendor/bundle'), $this->dir, null, null, null ); $this->processes[] = new Process( $this->receiveCommand('rm -rf .bundle'), $this->dir, null, null, null ); } if (file_exists($this->dir . '/package.json')) { $this->processes[] = new Process( $this->receiveCommand('rm -rf node_modules'), $this->dir, null, null, null ); } if (file_exists($this->dir . '/Gruntfile.js') || file_exists($this->dir . '/gulpfile.js')) { $this->processes[] = new Process( $this->receiveCommand('rm -rf .sass-cache'), $this->dir, null, null, null ); } $endresult = parent::run(); return ($result && $result->getExitCode() > $endresult->getExitCode()) ? $result : $endresult; }
[ "public", "function", "run", "(", ")", "{", "// Clean bower cache before removing node_modules.", "$", "result", "=", "false", ";", "if", "(", "file_exists", "(", "$", "this", "->", "dir", ".", "'/bower.json'", ")", ")", "{", "$", "bower", "=", "$", "this", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/digipolisgent/robo-digipolis-package/blob/6f206f32d910992d27b2a1b4dda1c5e7d8259b75/src/ThemeClean.php#L34-L95
activecollab/controller
src/Response/ViewResponse.php
ViewResponse.render
public function render(Psr7ResponseInterface $response) { if ($this->getContentType() && $this->getEncoding()) { $response = $response->withHeader('Content-Type', $this->getContentType() . ';charset=' . $this->getEncoding()); } $response->getBody()->write($this->template_engine->fetch($this->template, $this->data)); return $response; }
php
public function render(Psr7ResponseInterface $response) { if ($this->getContentType() && $this->getEncoding()) { $response = $response->withHeader('Content-Type', $this->getContentType() . ';charset=' . $this->getEncoding()); } $response->getBody()->write($this->template_engine->fetch($this->template, $this->data)); return $response; }
[ "public", "function", "render", "(", "Psr7ResponseInterface", "$", "response", ")", "{", "if", "(", "$", "this", "->", "getContentType", "(", ")", "&&", "$", "this", "->", "getEncoding", "(", ")", ")", "{", "$", "response", "=", "$", "response", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/activecollab/controller/blob/51d24f3f203f7f5ae56edde2e35b5ef2d9293caa/src/Response/ViewResponse.php#L63-L72
impensavel/essence
src/CSV.php
CSV.prepare
protected function prepare($input, array $config) { if ($input instanceof SplFileInfo) { try { ini_set('auto_detect_line_endings', $config['auto_eol']); $data = $input->openFile('r'); $data->setFlags(SplFileObject::READ_CSV | SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE); $data->setCsvControl($config['delimiter'], $config['enclosure'], $config['escape']); $data->rewind(); return $data; } catch (RuntimeException $e) { throw new EssenceException('Could not open "'.$input->getPathname().'" for parsing', 0, $e); } } if (is_string($input)) { $lines = preg_split('/\R/', $input, null, PREG_SPLIT_NO_EMPTY); $data = array(); foreach ($lines as $line) { $data[] = str_getcsv($line, $config['delimiter'], $config['enclosure'], $config['escape']); } return $data; } if (is_resource($input)) { $type = get_resource_type($input); if ($type != 'stream') { throw new EssenceException('Invalid resource type: '.$type); } $string = stream_get_contents($input); if ($string === false) { throw new EssenceException('Failed to read input from stream'); } return $this->prepare($string, $config); } throw new EssenceException('Invalid input type: '.gettype($input)); }
php
protected function prepare($input, array $config) { if ($input instanceof SplFileInfo) { try { ini_set('auto_detect_line_endings', $config['auto_eol']); $data = $input->openFile('r'); $data->setFlags(SplFileObject::READ_CSV | SplFileObject::READ_AHEAD | SplFileObject::SKIP_EMPTY | SplFileObject::DROP_NEW_LINE); $data->setCsvControl($config['delimiter'], $config['enclosure'], $config['escape']); $data->rewind(); return $data; } catch (RuntimeException $e) { throw new EssenceException('Could not open "'.$input->getPathname().'" for parsing', 0, $e); } } if (is_string($input)) { $lines = preg_split('/\R/', $input, null, PREG_SPLIT_NO_EMPTY); $data = array(); foreach ($lines as $line) { $data[] = str_getcsv($line, $config['delimiter'], $config['enclosure'], $config['escape']); } return $data; } if (is_resource($input)) { $type = get_resource_type($input); if ($type != 'stream') { throw new EssenceException('Invalid resource type: '.$type); } $string = stream_get_contents($input); if ($string === false) { throw new EssenceException('Failed to read input from stream'); } return $this->prepare($string, $config); } throw new EssenceException('Invalid input type: '.gettype($input)); }
[ "protected", "function", "prepare", "(", "$", "input", ",", "array", "$", "config", ")", "{", "if", "(", "$", "input", "instanceof", "SplFileInfo", ")", "{", "try", "{", "ini_set", "(", "'auto_detect_line_endings'", ",", "$", "config", "[", "'auto_eol'", "...
Prepare data for extraction @param mixed $input Input data @param array $config Configuration settings @throws EssenceException @return array|SplFileObject
[ "Prepare", "data", "for", "extraction" ]
train
https://github.com/impensavel/essence/blob/e74969e55ac889e8c2cab9a915f82e93a72e629e/src/CSV.php#L40-L87
impensavel/essence
src/CSV.php
CSV.extract
public function extract($input, array $config = array(), &$data = null) { $config = array_merge(array( 'delimiter' => ',', 'enclosure' => '"', 'escape' => '\\', 'start_line' => 0, 'exceptions' => true, // Throw exception on invalid columns 'auto_eol' => false, // Auto detect end of lines ), $config); $elements = $this->prepare($input, $config); foreach ($elements as $line => $element) { // Skip until we reach the starting line if ($line < $config['start_line']) { continue; } // Current element properties $properties = array(); foreach ($this->maps['default'] as $key => $column) { if (isset($element[$column])) { $properties[$key] = $element[$column]; continue; } // Halt extraction on invalid column if ($config['exceptions']) { throw new EssenceException('Invalid column '.$column.' @ line '.$line.' for property "'.$key.'"'); } } // Execute element data handler $arguments = array( $line, $properties, &$data, ); call_user_func_array($this->handlers['default'], $arguments); } return true; }
php
public function extract($input, array $config = array(), &$data = null) { $config = array_merge(array( 'delimiter' => ',', 'enclosure' => '"', 'escape' => '\\', 'start_line' => 0, 'exceptions' => true, // Throw exception on invalid columns 'auto_eol' => false, // Auto detect end of lines ), $config); $elements = $this->prepare($input, $config); foreach ($elements as $line => $element) { // Skip until we reach the starting line if ($line < $config['start_line']) { continue; } // Current element properties $properties = array(); foreach ($this->maps['default'] as $key => $column) { if (isset($element[$column])) { $properties[$key] = $element[$column]; continue; } // Halt extraction on invalid column if ($config['exceptions']) { throw new EssenceException('Invalid column '.$column.' @ line '.$line.' for property "'.$key.'"'); } } // Execute element data handler $arguments = array( $line, $properties, &$data, ); call_user_func_array($this->handlers['default'], $arguments); } return true; }
[ "public", "function", "extract", "(", "$", "input", ",", "array", "$", "config", "=", "array", "(", ")", ",", "&", "$", "data", "=", "null", ")", "{", "$", "config", "=", "array_merge", "(", "array", "(", "'delimiter'", "=>", "','", ",", "'enclosure'...
{@inheritdoc}
[ "{" ]
train
https://github.com/impensavel/essence/blob/e74969e55ac889e8c2cab9a915f82e93a72e629e/src/CSV.php#L92-L138
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.getObject
protected function getObject($path) { $location = $this->applyPathPrefix($path); return $this->container->getObject($location); }
php
protected function getObject($path) { $location = $this->applyPathPrefix($path); return $this->container->getObject($location); }
[ "protected", "function", "getObject", "(", "$", "path", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "return", "$", "this", "->", "container", "->", "getObject", "(", "$", "location", ")", ";", "}" ]
Get an object. @param string $path @return DataObject
[ "Get", "an", "object", "." ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L60-L65
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.write
public function write($path, $contents, Config $config) { $location = $this->applyPathPrefix($path); $headers = []; if ($config && $config->has('headers')) { $headers = $config->get('headers'); } $response = $this->container->uploadObject($location, $contents, $headers); return $this->normalizeObject($response); }
php
public function write($path, $contents, Config $config) { $location = $this->applyPathPrefix($path); $headers = []; if ($config && $config->has('headers')) { $headers = $config->get('headers'); } $response = $this->container->uploadObject($location, $contents, $headers); return $this->normalizeObject($response); }
[ "public", "function", "write", "(", "$", "path", ",", "$", "contents", ",", "Config", "$", "config", ")", "{", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "path", ")", ";", "$", "headers", "=", "[", "]", ";", "if", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L70-L82
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.update
public function update($path, $contents, Config $config) { $object = $this->getObject($path); $object->setContent($contents); $object->setEtag(null); $response = $object->update(); if (! $response->getLastModified()) { return false; } return $this->normalizeObject($response); }
php
public function update($path, $contents, Config $config) { $object = $this->getObject($path); $object->setContent($contents); $object->setEtag(null); $response = $object->update(); if (! $response->getLastModified()) { return false; } return $this->normalizeObject($response); }
[ "public", "function", "update", "(", "$", "path", ",", "$", "contents", ",", "Config", "$", "config", ")", "{", "$", "object", "=", "$", "this", "->", "getObject", "(", "$", "path", ")", ";", "$", "object", "->", "setContent", "(", "$", "contents", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L87-L99
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.rename
public function rename($path, $newpath) { $object = $this->getObject($path); $newlocation = $this->applyPathPrefix($newpath); $destination = '/'.$this->container->getName().'/'.ltrim($newlocation, '/'); $response = $object->copy($destination); if ($response->getStatusCode() !== 201) { return false; } $object->delete(); return true; }
php
public function rename($path, $newpath) { $object = $this->getObject($path); $newlocation = $this->applyPathPrefix($newpath); $destination = '/'.$this->container->getName().'/'.ltrim($newlocation, '/'); $response = $object->copy($destination); if ($response->getStatusCode() !== 201) { return false; } $object->delete(); return true; }
[ "public", "function", "rename", "(", "$", "path", ",", "$", "newpath", ")", "{", "$", "object", "=", "$", "this", "->", "getObject", "(", "$", "path", ")", ";", "$", "newlocation", "=", "$", "this", "->", "applyPathPrefix", "(", "$", "newpath", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L104-L118
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.delete
public function delete($path) { try { $object = $this->getObject($path); } catch (ObjectNotFoundException $exception) { return false; } $response = $object->delete(); if ($response->getStatusCode() !== 204) { return false; } return true; }
php
public function delete($path) { try { $object = $this->getObject($path); } catch (ObjectNotFoundException $exception) { return false; } $response = $object->delete(); if ($response->getStatusCode() !== 204) { return false; } return true; }
[ "public", "function", "delete", "(", "$", "path", ")", "{", "try", "{", "$", "object", "=", "$", "this", "->", "getObject", "(", "$", "path", ")", ";", "}", "catch", "(", "ObjectNotFoundException", "$", "exception", ")", "{", "return", "false", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L123-L138
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.deleteDir
public function deleteDir($dirname) { $paths = []; $prefix = '/'.$this->container->getName().'/'; $location = $this->applyPathPrefix($dirname); $objects = $this->container->objectList(['prefix' => $location]); foreach ($objects as $object) { $paths[] = $prefix.ltrim($object->getName(), '/'); } $service = $this->container->getService(); $response = $service->bulkDelete($paths); if ($response->getStatusCode() === 200) { return true; } return false; }
php
public function deleteDir($dirname) { $paths = []; $prefix = '/'.$this->container->getName().'/'; $location = $this->applyPathPrefix($dirname); $objects = $this->container->objectList(['prefix' => $location]); foreach ($objects as $object) { $paths[] = $prefix.ltrim($object->getName(), '/'); } $service = $this->container->getService(); $response = $service->bulkDelete($paths); if ($response->getStatusCode() === 200) { return true; } return false; }
[ "public", "function", "deleteDir", "(", "$", "dirname", ")", "{", "$", "paths", "=", "[", "]", ";", "$", "prefix", "=", "'/'", ".", "$", "this", "->", "container", "->", "getName", "(", ")", ".", "'/'", ";", "$", "location", "=", "$", "this", "->...
{@inheritdoc}
[ "{" ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L143-L162
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.has
public function has($path) { try { $object = $this->getObject($path); } catch (ClientErrorResponseException $e) { return false; } catch (ObjectNotFoundException $e) { return false; } return $this->normalizeObject($object); }
php
public function has($path) { try { $object = $this->getObject($path); } catch (ClientErrorResponseException $e) { return false; } catch (ObjectNotFoundException $e) { return false; } return $this->normalizeObject($object); }
[ "public", "function", "has", "(", "$", "path", ")", "{", "try", "{", "$", "object", "=", "$", "this", "->", "getObject", "(", "$", "path", ")", ";", "}", "catch", "(", "ClientErrorResponseException", "$", "e", ")", "{", "return", "false", ";", "}", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L191-L202
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.read
public function read($path) { $object = $this->getObject($path); $data = $this->normalizeObject($object); $data['contents'] = (string) $object->getContent(); return $data; }
php
public function read($path) { $object = $this->getObject($path); $data = $this->normalizeObject($object); $data['contents'] = (string) $object->getContent(); return $data; }
[ "public", "function", "read", "(", "$", "path", ")", "{", "$", "object", "=", "$", "this", "->", "getObject", "(", "$", "path", ")", ";", "$", "data", "=", "$", "this", "->", "normalizeObject", "(", "$", "object", ")", ";", "$", "data", "[", "'co...
{@inheritdoc}
[ "{" ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L207-L214
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.readStream
public function readStream($path) { $object = $this->getObject($path); $data = $this->normalizeObject($object); $responseBody = $object->getContent(); $data['stream'] = $responseBody->getStream(); $responseBody->detachStream(); return $data; }
php
public function readStream($path) { $object = $this->getObject($path); $data = $this->normalizeObject($object); $responseBody = $object->getContent(); $data['stream'] = $responseBody->getStream(); $responseBody->detachStream(); return $data; }
[ "public", "function", "readStream", "(", "$", "path", ")", "{", "$", "object", "=", "$", "this", "->", "getObject", "(", "$", "path", ")", ";", "$", "data", "=", "$", "this", "->", "normalizeObject", "(", "$", "object", ")", ";", "$", "responseBody",...
{@inheritdoc}
[ "{" ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L219-L228
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.listContents
public function listContents($directory = '', $recursive = false) { $response = []; $marker = null; $location = $this->applyPathPrefix($directory); while (true) { $objectList = $this->container->objectList(['prefix' => $location, 'marker' => $marker]); if ($objectList->count() === 0) { break; } $response = array_merge($response, iterator_to_array($objectList)); $marker = end($response)->getName(); } return Util::emulateDirectories(array_map([$this, 'normalizeObject'], $response)); }
php
public function listContents($directory = '', $recursive = false) { $response = []; $marker = null; $location = $this->applyPathPrefix($directory); while (true) { $objectList = $this->container->objectList(['prefix' => $location, 'marker' => $marker]); if ($objectList->count() === 0) { break; } $response = array_merge($response, iterator_to_array($objectList)); $marker = end($response)->getName(); } return Util::emulateDirectories(array_map([$this, 'normalizeObject'], $response)); }
[ "public", "function", "listContents", "(", "$", "directory", "=", "''", ",", "$", "recursive", "=", "false", ")", "{", "$", "response", "=", "[", "]", ";", "$", "marker", "=", "null", ";", "$", "location", "=", "$", "this", "->", "applyPathPrefix", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L233-L251
engineor/flysystem-runabove
src/RunaboveAdapter.php
RunaboveAdapter.normalizeObject
protected function normalizeObject(DataObject $object) { $name = $object->getName(); $name = $this->removePathPrefix($name); $mimetype = explode('; ', $object->getContentType()); return [ 'type' => 'file', 'dirname' => Util::dirname($name), 'path' => $name, 'timestamp' => strtotime($object->getLastModified()), 'mimetype' => reset($mimetype), 'size' => $object->getContentLength(), ]; }
php
protected function normalizeObject(DataObject $object) { $name = $object->getName(); $name = $this->removePathPrefix($name); $mimetype = explode('; ', $object->getContentType()); return [ 'type' => 'file', 'dirname' => Util::dirname($name), 'path' => $name, 'timestamp' => strtotime($object->getLastModified()), 'mimetype' => reset($mimetype), 'size' => $object->getContentLength(), ]; }
[ "protected", "function", "normalizeObject", "(", "DataObject", "$", "object", ")", "{", "$", "name", "=", "$", "object", "->", "getName", "(", ")", ";", "$", "name", "=", "$", "this", "->", "removePathPrefix", "(", "$", "name", ")", ";", "$", "mimetype...
{@inheritdoc}
[ "{" ]
train
https://github.com/engineor/flysystem-runabove/blob/d8c22dbf25c3bf2b62187f9da07efb48888d44de/src/RunaboveAdapter.php#L256-L270
raulfraile/ladybug-installer
src/Ladybug/Installer/Composer/Installer.php
Installer.extractName
protected function extractName(PackageInterface $package) { $extraData = $package->getExtra(); if (!array_key_exists('ladybug_name', $extraData)) { throw new \InvalidArgumentException( 'Unable to install theme/plugin, ladybug addons must ' .'include the name in the extra field of composer.json' ); } return $extraData['ladybug_name']; }
php
protected function extractName(PackageInterface $package) { $extraData = $package->getExtra(); if (!array_key_exists('ladybug_name', $extraData)) { throw new \InvalidArgumentException( 'Unable to install theme/plugin, ladybug addons must ' .'include the name in the extra field of composer.json' ); } return $extraData['ladybug_name']; }
[ "protected", "function", "extractName", "(", "PackageInterface", "$", "package", ")", "{", "$", "extraData", "=", "$", "package", "->", "getExtra", "(", ")", ";", "if", "(", "!", "array_key_exists", "(", "'ladybug_name'", ",", "$", "extraData", ")", ")", "...
Extract the theme/plugin name from the package extra info @param PackageInterface $package @throws \InvalidArgumentException @return string
[ "Extract", "the", "theme", "/", "plugin", "name", "from", "the", "package", "extra", "info" ]
train
https://github.com/raulfraile/ladybug-installer/blob/04f38f50cac673d3ca93de9c0805889e37804b33/src/Ladybug/Installer/Composer/Installer.php#L34-L46
raulfraile/ladybug-installer
src/Ladybug/Installer/Composer/Installer.php
Installer.getRootPath
protected function getRootPath(PackageInterface $package) { $rootPath = $this->vendorDir . '/raulfraile/ladybug-themes/Ladybug/'; if ($this->composer->getPackage()->getName() === 'raulfraile/ladybug') { $rootPath = 'data/' . ($package->getType() === self::PACKAGE_TYPE_THEME ? 'themes' : 'plugins') . '/Ladybug/'; } $rootPath .= ($package->getType() === self::PACKAGE_TYPE_THEME) ? 'Theme' : 'Plugin'; return $rootPath; }
php
protected function getRootPath(PackageInterface $package) { $rootPath = $this->vendorDir . '/raulfraile/ladybug-themes/Ladybug/'; if ($this->composer->getPackage()->getName() === 'raulfraile/ladybug') { $rootPath = 'data/' . ($package->getType() === self::PACKAGE_TYPE_THEME ? 'themes' : 'plugins') . '/Ladybug/'; } $rootPath .= ($package->getType() === self::PACKAGE_TYPE_THEME) ? 'Theme' : 'Plugin'; return $rootPath; }
[ "protected", "function", "getRootPath", "(", "PackageInterface", "$", "package", ")", "{", "$", "rootPath", "=", "$", "this", "->", "vendorDir", ".", "'/raulfraile/ladybug-themes/Ladybug/'", ";", "if", "(", "$", "this", "->", "composer", "->", "getPackage", "(",...
Returns the root installation path for templates. @param PackageInterface $package @return string a path relative to the root of the composer.json
[ "Returns", "the", "root", "installation", "path", "for", "templates", "." ]
train
https://github.com/raulfraile/ladybug-installer/blob/04f38f50cac673d3ca93de9c0805889e37804b33/src/Ladybug/Installer/Composer/Installer.php#L55-L66
pinepain/amqpy
src/AMQPy/AbstractListener.php
AbstractListener.consume
public function consume(AbstractConsumer $consumer, $auto_ack = false) { if (!$consumer->active()) { // prevent dirty consumer been listening on queue return; } $outside_error = null; try { $consumer->begin($this); $this->queue->consume( function (AMQPEnvelope $envelope /*, AMQPQueue $queue*/) use ($consumer) { $delivery = $this->builder->build($envelope); $this->feed($delivery, $consumer); return $consumer->active(); }, $auto_ack ? AMQP_AUTOACK : AMQP_NOPARAM ); } catch (Exception $e) { $outside_error = $e; } try { $this->queue->cancel(); } catch (Exception $e) { } $consumer->end($this, $outside_error); if ($outside_error) { throw $outside_error; } }
php
public function consume(AbstractConsumer $consumer, $auto_ack = false) { if (!$consumer->active()) { // prevent dirty consumer been listening on queue return; } $outside_error = null; try { $consumer->begin($this); $this->queue->consume( function (AMQPEnvelope $envelope /*, AMQPQueue $queue*/) use ($consumer) { $delivery = $this->builder->build($envelope); $this->feed($delivery, $consumer); return $consumer->active(); }, $auto_ack ? AMQP_AUTOACK : AMQP_NOPARAM ); } catch (Exception $e) { $outside_error = $e; } try { $this->queue->cancel(); } catch (Exception $e) { } $consumer->end($this, $outside_error); if ($outside_error) { throw $outside_error; } }
[ "public", "function", "consume", "(", "AbstractConsumer", "$", "consumer", ",", "$", "auto_ack", "=", "false", ")", "{", "if", "(", "!", "$", "consumer", "->", "active", "(", ")", ")", "{", "// prevent dirty consumer been listening on queue", "return", ";", "}...
Attach consumer to process payload from queue @param AbstractConsumer $consumer Consumer to process payload and handle possible errors @param bool $auto_ack Should message been acknowledged upon receive @return mixed @throws SerializerException @throws Exception Any exception from pre/post-consume handlers and from exception handler
[ "Attach", "consumer", "to", "process", "payload", "from", "queue" ]
train
https://github.com/pinepain/amqpy/blob/fc61dacc37a97a100caf67232a72be32dd7cc896/src/AMQPy/AbstractListener.php#L93-L128
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setSubtype
public function setSubtype($subtype) { if (!is_string($subtype) && null !== $subtype) { throw new \InvalidArgumentException('The attribute subtype on the class Attribute has to be string or null (' . gettype($subtype) . ('object' === gettype($subtype) ? ' ' . get_class($subtype) : '') . ' given).'); } $this->subtype = $subtype; return $this; }
php
public function setSubtype($subtype) { if (!is_string($subtype) && null !== $subtype) { throw new \InvalidArgumentException('The attribute subtype on the class Attribute has to be string or null (' . gettype($subtype) . ('object' === gettype($subtype) ? ' ' . get_class($subtype) : '') . ' given).'); } $this->subtype = $subtype; return $this; }
[ "public", "function", "setSubtype", "(", "$", "subtype", ")", "{", "if", "(", "!", "is_string", "(", "$", "subtype", ")", "&&", "null", "!==", "$", "subtype", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute subtype on the class...
Set subtype @param string|null $subtype @return Attribute @throws \InvalidArgumentException
[ "Set", "subtype" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L295-L304
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setPrimary
public function setPrimary($primary) { if (!is_bool($primary)) { throw new \InvalidArgumentException('The attribute primary on the class Attribute has to be boolean (' . gettype($primary) . ('object' === gettype($primary) ? ' ' . get_class($primary) : '') . ' given).'); } $this->primary = $primary; return $this; }
php
public function setPrimary($primary) { if (!is_bool($primary)) { throw new \InvalidArgumentException('The attribute primary on the class Attribute has to be boolean (' . gettype($primary) . ('object' === gettype($primary) ? ' ' . get_class($primary) : '') . ' given).'); } $this->primary = $primary; return $this; }
[ "public", "function", "setPrimary", "(", "$", "primary", ")", "{", "if", "(", "!", "is_bool", "(", "$", "primary", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute primary on the class Attribute has to be boolean ('", ".", "getty...
Set primary @param boolean $primary @return Attribute @throws \InvalidArgumentException
[ "Set", "primary" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L325-L334
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setSize
public function setSize($size) { if (!is_int($size)) { throw new \InvalidArgumentException('The attribute size on the class Attribute has to be integer (' . gettype($size) . ('object' === gettype($size) ? ' ' . get_class($size) : '') . ' given).'); } $this->size = $size; return $this; }
php
public function setSize($size) { if (!is_int($size)) { throw new \InvalidArgumentException('The attribute size on the class Attribute has to be integer (' . gettype($size) . ('object' === gettype($size) ? ' ' . get_class($size) : '') . ' given).'); } $this->size = $size; return $this; }
[ "public", "function", "setSize", "(", "$", "size", ")", "{", "if", "(", "!", "is_int", "(", "$", "size", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute size on the class Attribute has to be integer ('", ".", "gettype", "(", ...
Set size @param integer $size @return Attribute @throws \InvalidArgumentException
[ "Set", "size" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L355-L364
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setMinSize
public function setMinSize($minSize) { if (!is_int($minSize)) { throw new \InvalidArgumentException('The attribute minSize on the class Attribute has to be integer (' . gettype($minSize) . ('object' === gettype($minSize) ? ' ' . get_class($minSize) : '') . ' given).'); } $this->minSize = $minSize; return $this; }
php
public function setMinSize($minSize) { if (!is_int($minSize)) { throw new \InvalidArgumentException('The attribute minSize on the class Attribute has to be integer (' . gettype($minSize) . ('object' === gettype($minSize) ? ' ' . get_class($minSize) : '') . ' given).'); } $this->minSize = $minSize; return $this; }
[ "public", "function", "setMinSize", "(", "$", "minSize", ")", "{", "if", "(", "!", "is_int", "(", "$", "minSize", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute minSize on the class Attribute has to be integer ('", ".", "gettyp...
Set minSize @param integer $minSize @return Attribute @throws \InvalidArgumentException
[ "Set", "minSize" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L385-L394
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setMin
public function setMin($min) { if (!is_int($min)) { throw new \InvalidArgumentException('The attribute min on the class Attribute has to be integer (' . gettype($min) . ('object' === gettype($min) ? ' ' . get_class($min) : '') . ' given).'); } $this->min = $min; return $this; }
php
public function setMin($min) { if (!is_int($min)) { throw new \InvalidArgumentException('The attribute min on the class Attribute has to be integer (' . gettype($min) . ('object' === gettype($min) ? ' ' . get_class($min) : '') . ' given).'); } $this->min = $min; return $this; }
[ "public", "function", "setMin", "(", "$", "min", ")", "{", "if", "(", "!", "is_int", "(", "$", "min", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute min on the class Attribute has to be integer ('", ".", "gettype", "(", "$"...
Set min @param integer $min @return Attribute @throws \InvalidArgumentException
[ "Set", "min" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L415-L424
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setMax
public function setMax($max) { if (!is_int($max)) { throw new \InvalidArgumentException('The attribute max on the class Attribute has to be integer (' . gettype($max) . ('object' === gettype($max) ? ' ' . get_class($max) : '') . ' given).'); } $this->max = $max; return $this; }
php
public function setMax($max) { if (!is_int($max)) { throw new \InvalidArgumentException('The attribute max on the class Attribute has to be integer (' . gettype($max) . ('object' === gettype($max) ? ' ' . get_class($max) : '') . ' given).'); } $this->max = $max; return $this; }
[ "public", "function", "setMax", "(", "$", "max", ")", "{", "if", "(", "!", "is_int", "(", "$", "max", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute max on the class Attribute has to be integer ('", ".", "gettype", "(", "$"...
Set max @param integer $max @return Attribute @throws \InvalidArgumentException
[ "Set", "max" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L445-L454
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setMinSizeMessage
public function setMinSizeMessage($minSizeMessage) { if (!is_string($minSizeMessage)) { throw new \InvalidArgumentException('The attribute minSizeMessage on the class Attribute has to be string (' . gettype($minSizeMessage) . ('object' === gettype($minSizeMessage) ? ' ' . get_class($minSizeMessage) : '') . ' given).'); } $this->minSizeMessage = $minSizeMessage; return $this; }
php
public function setMinSizeMessage($minSizeMessage) { if (!is_string($minSizeMessage)) { throw new \InvalidArgumentException('The attribute minSizeMessage on the class Attribute has to be string (' . gettype($minSizeMessage) . ('object' === gettype($minSizeMessage) ? ' ' . get_class($minSizeMessage) : '') . ' given).'); } $this->minSizeMessage = $minSizeMessage; return $this; }
[ "public", "function", "setMinSizeMessage", "(", "$", "minSizeMessage", ")", "{", "if", "(", "!", "is_string", "(", "$", "minSizeMessage", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute minSizeMessage on the class Attribute has to b...
Set minSizeMessage @param string $minSizeMessage @return Attribute @throws \InvalidArgumentException
[ "Set", "minSizeMessage" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L475-L484
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setMaxSizeMessage
public function setMaxSizeMessage($maxSizeMessage) { if (!is_string($maxSizeMessage)) { throw new \InvalidArgumentException('The attribute maxSizeMessage on the class Attribute has to be string (' . gettype($maxSizeMessage) . ('object' === gettype($maxSizeMessage) ? ' ' . get_class($maxSizeMessage) : '') . ' given).'); } $this->maxSizeMessage = $maxSizeMessage; return $this; }
php
public function setMaxSizeMessage($maxSizeMessage) { if (!is_string($maxSizeMessage)) { throw new \InvalidArgumentException('The attribute maxSizeMessage on the class Attribute has to be string (' . gettype($maxSizeMessage) . ('object' === gettype($maxSizeMessage) ? ' ' . get_class($maxSizeMessage) : '') . ' given).'); } $this->maxSizeMessage = $maxSizeMessage; return $this; }
[ "public", "function", "setMaxSizeMessage", "(", "$", "maxSizeMessage", ")", "{", "if", "(", "!", "is_string", "(", "$", "maxSizeMessage", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute maxSizeMessage on the class Attribute has to b...
Set maxSizeMessage @param string $maxSizeMessage @return Attribute @throws \InvalidArgumentException
[ "Set", "maxSizeMessage" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L505-L514
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setExactSizeMessage
public function setExactSizeMessage($exactSizeMessage) { if (!is_string($exactSizeMessage)) { throw new \InvalidArgumentException('The attribute exactSizeMessage on the class Attribute has to be string (' . gettype($exactSizeMessage) . ('object' === gettype($exactSizeMessage) ? ' ' . get_class($exactSizeMessage) : '') . ' given).'); } $this->exactSizeMessage = $exactSizeMessage; return $this; }
php
public function setExactSizeMessage($exactSizeMessage) { if (!is_string($exactSizeMessage)) { throw new \InvalidArgumentException('The attribute exactSizeMessage on the class Attribute has to be string (' . gettype($exactSizeMessage) . ('object' === gettype($exactSizeMessage) ? ' ' . get_class($exactSizeMessage) : '') . ' given).'); } $this->exactSizeMessage = $exactSizeMessage; return $this; }
[ "public", "function", "setExactSizeMessage", "(", "$", "exactSizeMessage", ")", "{", "if", "(", "!", "is_string", "(", "$", "exactSizeMessage", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute exactSizeMessage on the class Attribute ...
Set exactSizeMessage @param string $exactSizeMessage @return Attribute @throws \InvalidArgumentException
[ "Set", "exactSizeMessage" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L535-L544
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setMinMessage
public function setMinMessage($minMessage) { if (!is_string($minMessage)) { throw new \InvalidArgumentException('The attribute minMessage on the class Attribute has to be string (' . gettype($minMessage) . ('object' === gettype($minMessage) ? ' ' . get_class($minMessage) : '') . ' given).'); } $this->minMessage = $minMessage; return $this; }
php
public function setMinMessage($minMessage) { if (!is_string($minMessage)) { throw new \InvalidArgumentException('The attribute minMessage on the class Attribute has to be string (' . gettype($minMessage) . ('object' === gettype($minMessage) ? ' ' . get_class($minMessage) : '') . ' given).'); } $this->minMessage = $minMessage; return $this; }
[ "public", "function", "setMinMessage", "(", "$", "minMessage", ")", "{", "if", "(", "!", "is_string", "(", "$", "minMessage", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute minMessage on the class Attribute has to be string ('", ...
Set minMessage @param string $minMessage @return Attribute @throws \InvalidArgumentException
[ "Set", "minMessage" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L565-L574
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setMaxMessage
public function setMaxMessage($maxMessage) { if (!is_string($maxMessage)) { throw new \InvalidArgumentException('The attribute maxMessage on the class Attribute has to be string (' . gettype($maxMessage) . ('object' === gettype($maxMessage) ? ' ' . get_class($maxMessage) : '') . ' given).'); } $this->maxMessage = $maxMessage; return $this; }
php
public function setMaxMessage($maxMessage) { if (!is_string($maxMessage)) { throw new \InvalidArgumentException('The attribute maxMessage on the class Attribute has to be string (' . gettype($maxMessage) . ('object' === gettype($maxMessage) ? ' ' . get_class($maxMessage) : '') . ' given).'); } $this->maxMessage = $maxMessage; return $this; }
[ "public", "function", "setMaxMessage", "(", "$", "maxMessage", ")", "{", "if", "(", "!", "is_string", "(", "$", "maxMessage", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute maxMessage on the class Attribute has to be string ('", ...
Set maxMessage @param string $maxMessage @return Attribute @throws \InvalidArgumentException
[ "Set", "maxMessage" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L595-L604
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setNull
public function setNull($null) { if (!is_bool($null)) { throw new \InvalidArgumentException('The attribute null on the class Attribute has to be boolean (' . gettype($null) . ('object' === gettype($null) ? ' ' . get_class($null) : '') . ' given).'); } $this->null = $null; return $this; }
php
public function setNull($null) { if (!is_bool($null)) { throw new \InvalidArgumentException('The attribute null on the class Attribute has to be boolean (' . gettype($null) . ('object' === gettype($null) ? ' ' . get_class($null) : '') . ' given).'); } $this->null = $null; return $this; }
[ "public", "function", "setNull", "(", "$", "null", ")", "{", "if", "(", "!", "is_bool", "(", "$", "null", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute null on the class Attribute has to be boolean ('", ".", "gettype", "(", ...
Set null @param boolean $null @return Attribute @throws \InvalidArgumentException
[ "Set", "null" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L625-L634
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setUnique
public function setUnique($unique) { if (!is_bool($unique)) { throw new \InvalidArgumentException('The attribute unique on the class Attribute has to be boolean (' . gettype($unique) . ('object' === gettype($unique) ? ' ' . get_class($unique) : '') . ' given).'); } $this->unique = $unique; return $this; }
php
public function setUnique($unique) { if (!is_bool($unique)) { throw new \InvalidArgumentException('The attribute unique on the class Attribute has to be boolean (' . gettype($unique) . ('object' === gettype($unique) ? ' ' . get_class($unique) : '') . ' given).'); } $this->unique = $unique; return $this; }
[ "public", "function", "setUnique", "(", "$", "unique", ")", "{", "if", "(", "!", "is_bool", "(", "$", "unique", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute unique on the class Attribute has to be boolean ('", ".", "gettype",...
Set unique @param boolean $unique @return Attribute @throws \InvalidArgumentException
[ "Set", "unique" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L685-L694
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setAutoIncrement
public function setAutoIncrement($autoIncrement) { if (!is_bool($autoIncrement)) { throw new \InvalidArgumentException('The attribute autoIncrement on the class Attribute has to be boolean (' . gettype($autoIncrement) . ('object' === gettype($autoIncrement) ? ' ' . get_class($autoIncrement) : '') . ' given).'); } $this->autoIncrement = $autoIncrement; return $this; }
php
public function setAutoIncrement($autoIncrement) { if (!is_bool($autoIncrement)) { throw new \InvalidArgumentException('The attribute autoIncrement on the class Attribute has to be boolean (' . gettype($autoIncrement) . ('object' === gettype($autoIncrement) ? ' ' . get_class($autoIncrement) : '') . ' given).'); } $this->autoIncrement = $autoIncrement; return $this; }
[ "public", "function", "setAutoIncrement", "(", "$", "autoIncrement", ")", "{", "if", "(", "!", "is_bool", "(", "$", "autoIncrement", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute autoIncrement on the class Attribute has to be bool...
Set autoIncrement @param boolean $autoIncrement @return Attribute @throws \InvalidArgumentException
[ "Set", "autoIncrement" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L715-L724
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setDefaultValue
public function setDefaultValue($defaultValue) { if (!is_string($defaultValue)) { throw new \InvalidArgumentException('The attribute defaultValue on the class Attribute has to be string (' . gettype($defaultValue) . ('object' === gettype($defaultValue) ? ' ' . get_class($defaultValue) : '') . ' given).'); } $this->defaultValue = $defaultValue; return $this; }
php
public function setDefaultValue($defaultValue) { if (!is_string($defaultValue)) { throw new \InvalidArgumentException('The attribute defaultValue on the class Attribute has to be string (' . gettype($defaultValue) . ('object' === gettype($defaultValue) ? ' ' . get_class($defaultValue) : '') . ' given).'); } $this->defaultValue = $defaultValue; return $this; }
[ "public", "function", "setDefaultValue", "(", "$", "defaultValue", ")", "{", "if", "(", "!", "is_string", "(", "$", "defaultValue", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute defaultValue on the class Attribute has to be string...
Set defaultValue @param string $defaultValue @return Attribute @throws \InvalidArgumentException
[ "Set", "defaultValue" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L745-L754
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setForeign
public function setForeign($foreign) { if (!is_string($foreign) && null !== $foreign) { throw new \InvalidArgumentException('The attribute foreign on the class Attribute has to be string or null (' . gettype($foreign) . ('object' === gettype($foreign) ? ' ' . get_class($foreign) : '') . ' given).'); } $this->foreign = $foreign; return $this; }
php
public function setForeign($foreign) { if (!is_string($foreign) && null !== $foreign) { throw new \InvalidArgumentException('The attribute foreign on the class Attribute has to be string or null (' . gettype($foreign) . ('object' === gettype($foreign) ? ' ' . get_class($foreign) : '') . ' given).'); } $this->foreign = $foreign; return $this; }
[ "public", "function", "setForeign", "(", "$", "foreign", ")", "{", "if", "(", "!", "is_string", "(", "$", "foreign", ")", "&&", "null", "!==", "$", "foreign", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute foreign on the class...
Set foreign @param string|null $foreign @return Attribute @throws \InvalidArgumentException
[ "Set", "foreign" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L775-L784
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setForeignKey
public function setForeignKey($foreignKey) { if (!$foreignKey instanceof Attribute && null !== $foreignKey) { throw new \InvalidArgumentException('The attribute foreignKey on the class Attribute has to be Attribute or null (' . gettype($foreignKey) . ('object' === gettype($foreignKey) ? ' ' . get_class($foreignKey) : '') . ' given).'); } $this->foreignKey = $foreignKey; return $this; }
php
public function setForeignKey($foreignKey) { if (!$foreignKey instanceof Attribute && null !== $foreignKey) { throw new \InvalidArgumentException('The attribute foreignKey on the class Attribute has to be Attribute or null (' . gettype($foreignKey) . ('object' === gettype($foreignKey) ? ' ' . get_class($foreignKey) : '') . ' given).'); } $this->foreignKey = $foreignKey; return $this; }
[ "public", "function", "setForeignKey", "(", "$", "foreignKey", ")", "{", "if", "(", "!", "$", "foreignKey", "instanceof", "Attribute", "&&", "null", "!==", "$", "foreignKey", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute foreig...
Set foreignKey @param Attribute|null $foreignKey @return Attribute @throws \InvalidArgumentException
[ "Set", "foreignKey" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L815-L824
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setForeignTick
public function setForeignTick($foreignTick) { if (!is_bool($foreignTick)) { throw new \InvalidArgumentException('The attribute foreignTick on the class Attribute has to be boolean (' . gettype($foreignTick) . ('object' === gettype($foreignTick) ? ' ' . get_class($foreignTick) : '') . ' given).'); } $this->foreignTick = $foreignTick; return $this; }
php
public function setForeignTick($foreignTick) { if (!is_bool($foreignTick)) { throw new \InvalidArgumentException('The attribute foreignTick on the class Attribute has to be boolean (' . gettype($foreignTick) . ('object' === gettype($foreignTick) ? ' ' . get_class($foreignTick) : '') . ' given).'); } $this->foreignTick = $foreignTick; return $this; }
[ "public", "function", "setForeignTick", "(", "$", "foreignTick", ")", "{", "if", "(", "!", "is_bool", "(", "$", "foreignTick", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute foreignTick on the class Attribute has to be boolean ('",...
Set foreignTick @param boolean $foreignTick @return Attribute @throws \InvalidArgumentException
[ "Set", "foreignTick" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L845-L854
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setManyToManyEntityName
public function setManyToManyEntityName($manyToManyEntityName) { if (!is_string($manyToManyEntityName)) { throw new \InvalidArgumentException('The attribute manyToManyEntityName on the class Attribute has to be string (' . gettype($manyToManyEntityName) . ('object' === gettype($manyToManyEntityName) ? ' ' . get_class($manyToManyEntityName) : '') . ' given).'); } $this->manyToManyEntityName = $manyToManyEntityName; return $this; }
php
public function setManyToManyEntityName($manyToManyEntityName) { if (!is_string($manyToManyEntityName)) { throw new \InvalidArgumentException('The attribute manyToManyEntityName on the class Attribute has to be string (' . gettype($manyToManyEntityName) . ('object' === gettype($manyToManyEntityName) ? ' ' . get_class($manyToManyEntityName) : '') . ' given).'); } $this->manyToManyEntityName = $manyToManyEntityName; return $this; }
[ "public", "function", "setManyToManyEntityName", "(", "$", "manyToManyEntityName", ")", "{", "if", "(", "!", "is_string", "(", "$", "manyToManyEntityName", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute manyToManyEntityName on the ...
Set manyToManyEntityName @param string $manyToManyEntityName @return Attribute @throws \InvalidArgumentException
[ "Set", "manyToManyEntityName" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L875-L884
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setGetter
public function setGetter($getter) { if (!is_bool($getter)) { throw new \InvalidArgumentException('The attribute getter on the class Attribute has to be boolean (' . gettype($getter) . ('object' === gettype($getter) ? ' ' . get_class($getter) : '') . ' given).'); } $this->getter = $getter; return $this; }
php
public function setGetter($getter) { if (!is_bool($getter)) { throw new \InvalidArgumentException('The attribute getter on the class Attribute has to be boolean (' . gettype($getter) . ('object' === gettype($getter) ? ' ' . get_class($getter) : '') . ' given).'); } $this->getter = $getter; return $this; }
[ "public", "function", "setGetter", "(", "$", "getter", ")", "{", "if", "(", "!", "is_bool", "(", "$", "getter", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute getter on the class Attribute has to be boolean ('", ".", "gettype",...
Set getter @param boolean $getter @return Attribute @throws \InvalidArgumentException
[ "Set", "getter" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L905-L914
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setSetter
public function setSetter($setter) { if (!is_bool($setter)) { throw new \InvalidArgumentException('The attribute setter on the class Attribute has to be boolean (' . gettype($setter) . ('object' === gettype($setter) ? ' ' . get_class($setter) : '') . ' given).'); } $this->setter = $setter; return $this; }
php
public function setSetter($setter) { if (!is_bool($setter)) { throw new \InvalidArgumentException('The attribute setter on the class Attribute has to be boolean (' . gettype($setter) . ('object' === gettype($setter) ? ' ' . get_class($setter) : '') . ' given).'); } $this->setter = $setter; return $this; }
[ "public", "function", "setSetter", "(", "$", "setter", ")", "{", "if", "(", "!", "is_bool", "(", "$", "setter", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute setter on the class Attribute has to be boolean ('", ".", "gettype",...
Set setter @param boolean $setter @return Attribute @throws \InvalidArgumentException
[ "Set", "setter" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L935-L944
j-d/draggy
src/Draggy/Autocode/Base/AttributeBase.php
AttributeBase.setEmail
public function setEmail($email) { if (!is_bool($email)) { throw new \InvalidArgumentException('The attribute email on the class Attribute has to be boolean (' . gettype($email) . ('object' === gettype($email) ? ' ' . get_class($email) : '') . ' given).'); } $this->email = $email; return $this; }
php
public function setEmail($email) { if (!is_bool($email)) { throw new \InvalidArgumentException('The attribute email on the class Attribute has to be boolean (' . gettype($email) . ('object' === gettype($email) ? ' ' . get_class($email) : '') . ' given).'); } $this->email = $email; return $this; }
[ "public", "function", "setEmail", "(", "$", "email", ")", "{", "if", "(", "!", "is_bool", "(", "$", "email", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "'The attribute email on the class Attribute has to be boolean ('", ".", "gettype", "...
Set email @param boolean $email @return Attribute @throws \InvalidArgumentException
[ "Set", "email" ]
train
https://github.com/j-d/draggy/blob/97ffc66e1aacb5f685d7aac5251c4abb8888d4bb/src/Draggy/Autocode/Base/AttributeBase.php#L965-L974