_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q235600 | Partition.getFsRoot | train | private function getFsRoot(): ?string
{
if (null === $this->fsRoot) {
$tempDir = rtrim(sys_get_temp_dir(), '\\/');
do {
$name = $tempDir.'/'.uniqid('vfs', true);
} while (file_exists($name));
$this->fs->mkdir($name);
$this->fsRoot... | php | {
"resource": ""
} |
q235601 | PaginatorExtension.paginate | train | public function paginate(
\Twig_Environment $twig,
PaginatorInterface $paginator,
string $template = '@Core/pagination/default.html.twig'
) {
return $twig->render($template, array(
'available_pages' => $paginator->getAvailablePages(),
'current_page' => $pagina... | php | {
"resource": ""
} |
q235602 | PaginatorExtension.getNextUrl | train | private function getNextUrl(PaginatorInterface $paginator) : ?string
{
$page = $paginator->getCurrentPage();
if (++$page <= $paginator->getAvailablePages()) {
return $this->generateUrl(
$this->getRoute(),
$this->getMergedParams(['page' => $page])
... | php | {
"resource": ""
} |
q235603 | PaginatorExtension.getPreviousUrl | train | private function getPreviousUrl(PaginatorInterface $paginator) : ?string
{
$page = $paginator->getCurrentPage();
if (--$page >= 1) {
return $this->generateUrl(
$this->getRoute(),
$this->getMergedParams(['page' => $page])
);
}
... | php | {
"resource": ""
} |
q235604 | Router.callFilter | train | protected function callFilter($filter, $request, $response = null)
{
return $this->events->until('router.'.$filter, array($request, $response));
} | php | {
"resource": ""
} |
q235605 | Router.filterSupportsMethod | train | protected function filterSupportsMethod($filter, $method)
{
$methods = $filter['methods'];
return is_null($methods) || in_array($method, $methods);
} | php | {
"resource": ""
} |
q235606 | Router.callRouteFilter | train | public function callRouteFilter($filter, $parameters, $route, $request, $response = null)
{
$data = array_merge(array($route, $request, $response), $parameters);
return $this->events->until('router.filter: '.$filter, $this->cleanFilterParameters($data));
} | php | {
"resource": ""
} |
q235607 | ImageStrategy.cropAlternative | train | protected function cropAlternative(FormInterface $form)
{
$needFlush = false;
foreach ($this->thumbnailConfig as $format => $parameters) {
$x = $form->get('coordinates')->get($format)->get('x')->getData();
$y = $form->get('coordinates')->get($format)->get('y')->getData();
... | php | {
"resource": ""
} |
q235608 | ImageStrategy.overrideAlternative | train | protected function overrideAlternative(FormInterface $form)
{
$needFlush = false;
foreach ($this->thumbnailConfig as $format => $parameters) {
$file = $form->get('files')->get($format)->get('file')->getData();
if (null !== $file) {
$media = $form->getData();
... | php | {
"resource": ""
} |
q235609 | gpi.gpi | train | public function gpi($data){
// var_dump($data);
if( !preg_match('/^[a-zA-Z0-9\_]+$/s', $data['api']) ){
return false;
}
// API をロードして実行
if( is_file(__DIR__.'/gpis/'.urlencode($data['api']).'.php') ){
$Api = include(__DIR__.'/gpis/'.urlencode($data['api']).'.php');
$result = $Api($this->px2me, $data... | php | {
"resource": ""
} |
q235610 | Visual_Hook.get_visual_hook | train | public function get_visual_hook() {
printf(
'<div class="filter-container"><p class="filter-name">%s</p>%s</div>',
current_filter(),
empty( $this->options['show_hooked_callable'] ) ? '' : $this->hooked->get_hooked_list( current_filter(), false )
);
} | php | {
"resource": ""
} |
q235611 | File.getConfigFileContent | train | private function getConfigFileContent(string $configPath) : array
{
// if empty just skip it
if (!filesize($configPath)) {
return [];
}
// read the file handler
$config = file_get_contents($configPath);
// check for linebreaks
if (strpos($config,... | php | {
"resource": ""
} |
q235612 | Generic.mapToAbstractEntity | train | public function mapToAbstractEntity($entity)
{
$entityStack = new \SplStack();
$this->mapXMLElementToEntity($this->xml, $entity, $entityStack);
} | php | {
"resource": ""
} |
q235613 | Generic.mapToPropertyAttribut | train | protected function mapToPropertyAttribut($property, $value, $xmlEntry, $entity, $stackEntity)
{
$this->mapToProperty($property, $value, $xmlEntry, $entity, $stackEntity);
} | php | {
"resource": ""
} |
q235614 | Generic.mapToPropertyTagname | train | protected function mapToPropertyTagname($property, $value, $xmlEntry, $entity, $stackEntity)
{
if ($this->mapToProperty($property, $value, $xmlEntry, $entity, $stackEntity) === false) {
$this->mapXMLElementToEntity($xmlEntry, $entity, $stackEntity);
}
} | php | {
"resource": ""
} |
q235615 | Generic.mapToProperty | train | protected function mapToProperty($property, $value, $xmlEntry, $entity, $stackEntity)
{
$classSchema = $this->reflectionService->getClassSchema(get_class($entity));
if ($classSchema->hasProperty($property)) {
$propertyDefinition = $classSchema->getProperty($property);
switc... | php | {
"resource": ""
} |
q235616 | Generic.mapXMLElementToEntity | train | protected function mapXMLElementToEntity($xmlEntry, $entity, $stackEntity)
{
$stackEntity->push($entity);
foreach ($xmlEntry->attributes() as $name => $attribut) {
$value = $this->mapAttributValue($xmlEntry, $name, $attribut->__toString(), $stackEntity);
$entityForAttribut ... | php | {
"resource": ""
} |
q235617 | Disk.getDiskData | train | public function getDiskData($wmiConnection) {
$LogicalDisk = $wmiConnection->query("SELECT Size, FreeSpace, DeviceID FROM Win32_LogicalDisk");
$return = Array();
$index = 0;
foreach ($LogicalDisk as $wmi_LogicalDisk) {
if (isset($wmi_LogicalDisk->Size) and $wmi_LogicalDisk... | php | {
"resource": ""
} |
q235618 | RecursiveCollection.hasIn | train | protected function hasIn($key, $in)
{
$keys = explode($this->getSeparator(), $key, 2);
if (count($keys) <= 0) {
return false;
} else {
if (! isset($in[$keys[0]])) {
return false;
} else {
if (count($keys) >= 2) {
... | php | {
"resource": ""
} |
q235619 | TeacherAcademicPeriod.scopeActive | train | public function scopeActive($query)
{
return $this->scopeActiveOn($query,
AcademicPeriod::current()->get()->first()->id);
} | php | {
"resource": ""
} |
q235620 | AbstractEvent.getParam | train | public function getParam($name, $default = null)
{
if (isset($this->params[$name])) {
return $this->params[$name];
}
return $default;
} | php | {
"resource": ""
} |
q235621 | AbstractEvent.setResult | train | public function setResult($name = null, $result = null)
{
if (null === $result) {
$result = $name;
array_push($this->results, $result);
return $this;
}
$this->results[(string) $name] = $result;
return $this;
} | php | {
"resource": ""
} |
q235622 | AbstractEvent.getResult | train | public function getResult($name = null, $default = null)
{
if (null === $name) {
return end($this->results);
}
if (! isset($this->results[$name])) {
return $default;
}
return $this->results[$name];
} | php | {
"resource": ""
} |
q235623 | Zend_Gdata_MimeBodyString.read | train | public function read($bytesRequested)
{
$len = strlen($this->_sourceString);
if($this->_bytesRead == $len) {
return FALSE;
} else if($bytesRequested > $len - $this->_bytesRead) {
$bytesRequested = $len - $this->_bytesRead;
}
$buffer = substr($this->_sourceString, $... | php | {
"resource": ""
} |
q235624 | Select.build | train | public function build($string = '', $groupSeparator = ',', $viewSeparator = ':')
{
// Clear options data
$this->options = array();
// Split string into groups and iterate them
foreach (explode($groupSeparator, $string) as $group) {
// Split group into view -> value
... | php | {
"resource": ""
} |
q235625 | Flow.combine | train | static function combine ($inputs, array $fields = null, $flags = 2)
{
$mul = new MultipleIterator($flags);
foreach (iterator ($inputs) as $k => $it)
$mul->attachIterator (iterator ($it), isset($fields) ? $fields[$k] : $k);
return new static ($mul);
} | php | {
"resource": ""
} |
q235626 | Flow.sequence | train | static function sequence ($list)
{
$a = new AppendIterator;
foreach (iterator ($list) as $it)
$a->append (iterator ($it));
return new static ($a);
} | php | {
"resource": ""
} |
q235627 | Flow.all | train | function all ()
{
if (!isset ($this->data))
$this->data = iterator_to_array ($this->it);
return $this->data;
} | php | {
"resource": ""
} |
q235628 | Flow.append | train | function append ($list)
{
$cur = $this->getIterator ();
if ($cur instanceof AppendIterator) {
foreach (iterator ($list) as $it)
$cur->append (iterator ($it));
}
else {
$a = new AppendIterator;
$a->append ($cur);
foreach (iterator ($list) as $it)
$a->append (iter... | php | {
"resource": ""
} |
q235629 | Flow.apply | train | function apply ($traversableClass)
{
$args = func_get_args ();
$args[0] = $this->getIterator ();
$c = new \ReflectionClass ($traversableClass);
$this->setIterator ($c->newInstanceArgs ($args));
return $this;
} | php | {
"resource": ""
} |
q235630 | Flow.concat | train | function concat ()
{
$a = new AppendIterator;
foreach ($this->getIterator () as $it)
$a->append (iterator ($it));
$this->setIterator ($a);
return $this;
} | php | {
"resource": ""
} |
q235631 | Flow.each | train | function each (callable $fn)
{
foreach ($this->getIterator () as $k => $v)
if ($fn ($v, $k) === false) break;
return $this;
} | php | {
"resource": ""
} |
q235632 | Flow.expand | train | function expand (callable $fn, $keepOriginals = false)
{
$keepOriginals ? $this->intercalate ($fn) : $this->map ($fn);
return $this->unfold ();
} | php | {
"resource": ""
} |
q235633 | Flow.fetch | train | function fetch ()
{
$it = $this->getIterator ();
if (!$this->fetching) {
$this->fetching = true;
$it->rewind ();
}
if ($it->valid ()) {
$v = $it->current ();
$it->next ();
return $v;
}
return false;
} | php | {
"resource": ""
} |
q235634 | Flow.fetchKey | train | function fetchKey ()
{
$it = $this->getIterator ();
if (!$this->fetching) {
$this->fetching = true;
$it->rewind ();
}
if ($it->valid ()) {
$k = $it->key ();
$it->next ();
return $k;
}
return false;
} | php | {
"resource": ""
} |
q235635 | Flow.intercalate | train | function intercalate (callable $fn)
{
return $this->map (function ($v, &$k) use ($fn) {
$r = $fn ($v, $k);
if (is_iterable ($r))
return new HeadAndTailIterator ($v, $r, $k, true);
return $r;
})->unfold ();
} | php | {
"resource": ""
} |
q235636 | Flow.map | train | function map (callable $fn, $arg = null)
{
$this->setIterator (new MapIterator ($this->getIterator (), $fn, $arg));
return $this;
} | php | {
"resource": ""
} |
q235637 | Flow.mapAndFilter | train | function mapAndFilter (callable $fn, $arg = null)
{
$this->setIterator (new CallbackFilterIterator (new MapIterator ($this->getIterator (), $fn, $arg), function ($v) {
return isset ($v);
}));
return $this;
} | php | {
"resource": ""
} |
q235638 | Flow.pack | train | function pack ()
{
$this->data = isset ($this->data) ? array_values ($this->data) : iterator_to_array ($this->it, false);
return $this;
} | php | {
"resource": ""
} |
q235639 | Flow.prepend | train | function prepend ($list)
{
$a = new AppendIterator;
foreach (iterator ($list) as $it)
$a->append (iterator ($it));
$a->append ($this->getIterator ());
$this->setIterator ($a);
return $this;
} | php | {
"resource": ""
} |
q235640 | Flow.prependValue | train | function prependValue ($value, $key = 0)
{
$this->setIterator (new HeadAndTailIterator ($value, $this->getIterator (), $key, true));
return $this;
} | php | {
"resource": ""
} |
q235641 | Flow.recursive | train | function recursive (callable $fn, $mode = RecursiveIteratorIterator::SELF_FIRST)
{
$this->setIterator (new RecursiveIteratorIterator (new RecursiveIterator ($this->getIterator (), $fn), $mode));
return $this;
} | php | {
"resource": ""
} |
q235642 | Flow.recursiveUnfold | train | function recursiveUnfold (callable $fn, $keepOriginals = false)
{
$w = function ($v, $k, $d) use ($fn, &$w, $keepOriginals) {
$r = $fn ($v, $k, $d);
if (is_iterableEx ($r)) {
$it = new UnfoldIterator (new MapIterator ($r, $w, $d + 1), UnfoldIterator::USE_ORIGINAL_KEYS);
return $keepOri... | php | {
"resource": ""
} |
q235643 | Flow.regex | train | function regex ($regexp, $preg_flags = 0, $useKeys = false)
{
$this->setIterator (
new RegexIterator ($this->getIterator (), $regexp, RegexIterator::ALL_MATCHES,
$useKeys ? RegexIterator::USE_KEY : 0,
$preg_flags)
);
return $this;
} | php | {
"resource": ""
} |
q235644 | Flow.regexExtract | train | function regexExtract ($regexp, $preg_flags = 0, $useKeys = false)
{
$this->setIterator (
new RegexIterator ($this->getIterator (), $regexp, RegexIterator::GET_MATCH,
$useKeys ? RegexIterator::USE_KEY : 0,
$preg_flags)
);
return $this;
} | php | {
"resource": ""
} |
q235645 | Flow.regexMap | train | function regexMap ($regexp, $replaceWith, $useKeys = false)
{
$this->setIterator (
new RegexIterator ($this->getIterator (), $regexp, RegexIterator::REPLACE, $useKeys ? RegexIterator::USE_KEY : 0)
);
$this->it->replacement = $replaceWith;
return $this;
} | php | {
"resource": ""
} |
q235646 | Flow.regexSplit | train | function regexSplit ($regexp, $preg_flags = 0, $useKeys = false)
{
$this->setIterator (
new RegexIterator ($this->getIterator (), $regexp, RegexIterator::SPLIT, $useKeys ? RegexIterator::USE_KEY : 0,
$preg_flags)
);
return $this;
} | php | {
"resource": ""
} |
q235647 | Flow.reindex | train | function reindex ($i = 0, $st = 1)
{
$this->setIterator (new ReindexIterator($this->getIterator (), $i, $st));
return $this;
} | php | {
"resource": ""
} |
q235648 | Flow.repeatWhile | train | function repeatWhile (callable $fn)
{
$this->setIterator ($it = new LoopIterator ($this->getIterator ()));
$it->test ($fn);
return $this;
} | php | {
"resource": ""
} |
q235649 | Flow.reverse | train | function reverse ($preserveKeys = false)
{
$this->pack ();
$this->it = $this->array_reverse_iterator ($this->data, $preserveKeys);
unset ($this->data);
return $this;
} | php | {
"resource": ""
} |
q235650 | Flow.slice | train | function slice ($offset = 0, $count = -1)
{
$this->setIterator (new LimitIterator ($this->getIterator (), $offset, $count));
return $this;
} | php | {
"resource": ""
} |
q235651 | Flow.sort | train | function sort ($type = 'sort', $flags = SORT_REGULAR, callable $fn = null)
{
if (!isset (self::$SORT_TYPES[$type]))
throw new InvalidArgumentException ("Bad sort type: $type");
$n = self::$SORT_TYPES[$type];
$this->all (); // force materialization of data.
switch ($n) {
case 1:
$t... | php | {
"resource": ""
} |
q235652 | Flow.swap | train | function swap (callable $fn)
{
$this->pack ();
$this->data = $fn ($this->data);
return $this;
} | php | {
"resource": ""
} |
q235653 | Flow.whereMatch | train | function whereMatch ($regexp, $preg_flags = 0, $useKeys = false)
{
$this->setIterator (new RegexIterator ($this->getIterator (), $regexp, RegexIterator::MATCH,
$useKeys ? RegexIterator::USE_KEY : 0, $preg_flags));
return $this;
} | php | {
"resource": ""
} |
q235654 | Flow.array_reverse_iterator | train | private function array_reverse_iterator (array $a, $preserveKeys = false)
{
if ($preserveKeys)
for (end ($a); ($key = key ($a)) !== null; prev ($a))
yield $key => current ($a);
else for (end ($a); ($key = key ($a)) !== null; prev ($a))
yield current ($a);
} | php | {
"resource": ""
} |
q235655 | FineMessageFile.load | train | public function load($file) {
$this->file = $file;
$msg = array();
@include($file);
$this->msg = $msg;
} | php | {
"resource": ""
} |
q235656 | PortScanner.scanPortRange | train | public function scanPortRange() {
if (strtolower($this->typePort) == 'tcp') {
$hostIp = $this->hostIP;
} else if (strtolower($this->typePort) == 'udp') {
$hostIp = "udp://$this->hostIP";
} else {
throw new \Exception('Port Type undefined!');
}
... | php | {
"resource": ""
} |
q235657 | EmailReceiveCheck.removeOldItems | train | private function removeOldItems()
{
$emailSendReceiveOld = $this
->getEmailSendReceiveColl()
->findAll($this->findOldEmailReceiveOldCallback());
/** @var EmailSendReceive $emailSendCheckI */
foreach ($emailSendReceiveOld as $emailSendCheckI) {
$this->getEm... | php | {
"resource": ""
} |
q235658 | File.setInfoAttribute | train | public function setInfoAttribute($value)
{
return ($value) ? $this->attributes['info'] = json_encode($value) : $this->attributes['info'] = null;
} | php | {
"resource": ""
} |
q235659 | File.removeExistingTranslation | train | public function removeExistingTranslation($languageCode)
{
return $this->translations()
->where('file_id', $this->id)
->where('language_code', $languageCode)
->delete();
} | php | {
"resource": ""
} |
q235660 | AbstractMapper.getQueryableProperties | train | public function getQueryableProperties()
{
$classMetadata = $this->getObjectManager()
->getClassMetadata($this->getEntityClass());
$fields = $classMetadata->getFieldNames();
$alias = $this->getEntityClassAlias();
foreach ($fields as $key => &$field) {... | php | {
"resource": ""
} |
q235661 | AbstractMapper.getOrderByIdentifier | train | public function getOrderByIdentifier($orderBy)
{
$objectManager = $this->getObjectManager();
$classMetadata = $objectManager->getClassMetadata($this->getEntityClass());
if (strpos($orderBy, '::') === false) {
if (!$classMetadata->hasField($orderBy)) {
throw new ... | php | {
"resource": ""
} |
q235662 | AbstractMapper.addJoinTablesToQueryBuilder | train | protected function addJoinTablesToQueryBuilder(QueryBuilder $queryBuilder)
{
$objectManager = $this->getObjectManager();
$entityAlias = $this->getEntityClassAlias();
$classMetaData = $objectManager->getClassMetadata($this->getEntityClass());
$assocMappings = $classMetaData->getAss... | php | {
"resource": ""
} |
q235663 | AbstractMapper.addFilterToQueryBuilder | train | protected function addFilterToQueryBuilder(array $filter, QueryBuilder $queryBuilder)
{
$objectManager = $this->getObjectManager();
$entityClassAlias = $this->getEntityClassAlias();
$classMetaData = $objectManager->getClassMetadata($this->getEntityClass());
$assocMappings = ... | php | {
"resource": ""
} |
q235664 | Loops.hasService | train | public function hasService($name, $resolve = TRUE) {
if(array_key_exists($name, $this->services)) {
return TRUE;
}
if(!$resolve) {
return FALSE;
}
$classname = "Loops\\Service\\".Misc::camelize($name);
if(class_exists($classname)) {
... | php | {
"resource": ""
} |
q235665 | Loops.createService | train | public function createService($name, ArrayObject $config = NULL, $merge_into_config = FALSE) {
if($merge_into_config) {
$service_config = $this->config->offsetExists($name) ? $this->config->offsetGet($name) : new ArrayObject;
if(is_array($service_config)) {
$service_conf... | php | {
"resource": ""
} |
q235666 | Loops.registerService | train | public function registerService($name, $service, array $params = [], $shared = TRUE) {
if(is_callable($service)) {
$this->services[$name] = [ "shared" => $shared, "params" => $params, "callback" => $service ];
}
elseif(is_object($service)) {
$this->services[$name] = [ "sh... | php | {
"resource": ""
} |
q235667 | PathTree.getTree | train | public function getTree(): array
{
$tree = [];
$size = count($this->segments);
for ($index = 0; $index < $size; $index = $index + 1) {
$temp = array_slice($this->segments, 0, $index + 1);
$path = implode(DIRECTORY_SEPARATOR, $temp);
$tree[] = Path::norma... | php | {
"resource": ""
} |
q235668 | PathTree.getPathTree | train | public function getPathTree(): array
{
$tree = [];
foreach ($this->getTree() as $branch) {
$tree[] = Path::make($branch);
}
return $tree;
} | php | {
"resource": ""
} |
q235669 | PdoStatement.bindValue | train | public function bindValue($parameter, $value, $data_type = \PDO::PARAM_STR) {
$this->_debugBindValues[$parameter] = $value;
parent::bindValue($parameter, $value, $data_type);
} | php | {
"resource": ""
} |
q235670 | PdoStatement.debugQuery | train | public function debugQuery($replaced = true) {
$q = $this->queryString;
if (!$replaced) {
return $q;
}
else {
if (count($this->_debugBindValues) > 0) {
return preg_replace_callback('/:([0-9a-z_]+)/i', [$this, '_debugReplaceBindValue'], $q);
... | php | {
"resource": ""
} |
q235671 | PdoStatement._debugReplaceBindValue | train | protected function _debugReplaceBindValue($m) {
$v = $this->_debugBindValues[':' . $m[1]];
switch (gettype($v)) {
case 'boolean' :
return $v;
break;
case 'integer' :
return $v;
break;
case 'double' :
... | php | {
"resource": ""
} |
q235672 | ValidateTrait.CreditCard | train | public static function CreditCard ($value, $options) {
//
$number_pattern_list = [
'American Express' => [
"/^34[0-9]{13}$/",
"/^37[0-9]{13}$/",
],
'China UnionPay' => [
"/^62212[6-9][0-9]{10}$/",
"/^6221[3-9][0-9][0-9]{10}$/",
"/^622[2-8] [0-9]{12}$/",
"/^6229[01][0-9][0-9]{10}$/",... | php | {
"resource": ""
} |
q235673 | Html.toText | train | public static function toText(string $value, bool $double_encode = true) : string
{
return htmlspecialchars($value, ENT_QUOTES, 'utf-8', $double_encode);
} | php | {
"resource": ""
} |
q235674 | Html.arrow | train | public static function arrow(string $direction) : string
{
switch ($direction) {
case "up": $output = '<span class="arrow">↑</span>'; break;
case "down": $output = '<span class="arrow">↓</span>'; break;
case "left": $output = '<span class="arrow">←</sp... | php | {
"resource": ""
} |
q235675 | Html.anchor | train | public static function anchor(string $title, string $url = '', array $attributes = null) : string
{
// Add link
if ($url !== '') $attributes['href'] = $url;
return '<a'.Html::attributes($attributes).'>'.$title.'</a>';
} | php | {
"resource": ""
} |
q235676 | Html.doctype | train | public static function doctype(string $type = 'html5')
{
$doctypes = ['xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/... | php | {
"resource": ""
} |
q235677 | Uri._validateState | train | private function _validateState()
{
if (!$this->getAuthority()) {
if (0 === strpos($this->path, '//')) {
throw new InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"');
}
if (!$this->scheme && false !== st... | php | {
"resource": ""
} |
q235678 | Arr.sort | train | public static function sort(array $array, string $field, string $direction = 'ASC', $method = SORT_REGULAR) : array
{
if (count($array) > 0) {
// Create the helper array
foreach ($array as $key => $row) {
$helper[$key] = function_exists('mb_strtolower') ? mb_str... | php | {
"resource": ""
} |
q235679 | Arr.set | train | public static function set(array &$array, string $path, $value)
{
// Get segments from path
$segments = explode('.', $path);
// Loop through segments
while (count($segments) > 1) {
$segment = array_shift($segments);
if (!isset($array[$segment]) || !is_array($... | php | {
"resource": ""
} |
q235680 | Arr.keyExists | train | public static function keyExists(array $array, $path) : bool
{
foreach (explode('.', $path) as $segment) {
if (! is_array($array) or ! array_key_exists($segment, $array)) {
return false;
}
$array = $array[$segment];
}
return true;
} | php | {
"resource": ""
} |
q235681 | Arr.createFromJson | train | public static function createFromJson(string $json, bool $assoc = true, int $depth = 512 , int $options = 0) : array
{
return json_decode($json, $assoc, $depth, $options);
} | php | {
"resource": ""
} |
q235682 | Arr.overwrite | train | public static function overwrite(array $array1, array $array2) : array
{
foreach (array_intersect_key($array2, $array1) as $key => $value) {
$array1[$key] = $value;
}
if (func_num_args() > 2) {
foreach (array_slice(func_get_args(), 2) as $array2) {
fo... | php | {
"resource": ""
} |
q235683 | AuthenticationHandler.execute | train | public function execute() {
$this->container->set('securityContext', $this->securityContext);
if (is_null($this->node) || !array_key_exists('authentication', $this->node)) {
return;
}
if (array_key_exists('security', $this->node) && (!$this->node['security'] || $this->node['... | php | {
"resource": ""
} |
q235684 | ModularCollection.scan | train | public function scan() : ModularCollection
{
if ($this->hasScanned) {
return $this;
}
/**
* @var SplFileInfo $path
*/
foreach (new RecursiveDirectoryIterator($this->getModularDirectory()) as $path) {
$baseName = $path->getBaseName();
... | php | {
"resource": ""
} |
q235685 | ModularCollection.& | train | protected function &internalGetModular(string $name) : ModularAbstract
{
$modularName = $this->sanitizeModularName($name);
if (!$modularName) {
throw new InvalidArgumentException(
"Please insert not an empty arguments",
E_USER_ERROR
);
... | php | {
"resource": ""
} |
q235686 | ModularCollection.getAllModularInfo | train | public function getAllModularInfo()
{
$modularInfo = new Collection();
foreach ($this->getAllValidModular() as $modularName => $modular) {
$modularInfo[$modularName] = $this->getModularInformation($modularName);
}
return $modularInfo;
} | php | {
"resource": ""
} |
q235687 | ModularCollection.hasLoaded | train | public function hasLoaded(string $name)
{
$modularName = $this->sanitizeModularName($name);
return $modularName && !empty($this->loadedModular[$modularName]);
} | php | {
"resource": ""
} |
q235688 | Plugin.get | train | public function get(string $name = null): \TheCMSThread\Classes\Plugin
{
if (empty($name) === false && empty($this->plugins[$name]) === false) {
return $this->plugins[$name];
} else {
throw new \InvalidArgumentException("Plugin not found");
}
} | php | {
"resource": ""
} |
q235689 | Plugin.runAll | train | public function runAll(): string
{
$result = '';
foreach ($this->getAll() as $plugin) {
$result .= (string) $plugin->run();
}
return $result;
} | php | {
"resource": ""
} |
q235690 | Plugin.run | train | public function run(string $name = null): string
{
return (string) $this->get($name)->run();
} | php | {
"resource": ""
} |
q235691 | Plugin.stylesAll | train | public function stylesAll(): array
{
$styles = [];
foreach ($this->getAll() as $name => $plugin) {
$styles[$name] = $plugin->styles();
}
return $styles;
} | php | {
"resource": ""
} |
q235692 | Plugin.scriptsAll | train | public function scriptsAll(): array
{
$scripts = [];
foreach ($this->getAll() as $name => $plugin) {
$scripts[$name] = $plugin->scripts();
}
return $scripts;
} | php | {
"resource": ""
} |
q235693 | FormStatic.renderHelper | train | protected function renderHelper($name, $value, ElementInterface $element)
{
$helper = $this->getView()->plugin($name);
if ($helper instanceof HtmlContainer && $helper->getTagName()) {
$this->shouldWrap = false;
return $helper($value, $element->getAttributes());
}
... | php | {
"resource": ""
} |
q235694 | FormStatic.renderInstance | train | protected function renderInstance(ElementInterface $element)
{
$value = $this->getElementValue($element);
foreach ($this->classMap as $class => $pluginName) {
if ($value instanceof $class) {
return $this->renderHelper($pluginName, $value, $element);
}
... | php | {
"resource": ""
} |
q235695 | ContentMenuBuilder._prepare | train | protected static function _prepare()
{
if (empty(static::$_module)) {
$module = Module::getModuleByClassname(Module::className());
if (!empty($module)) {
static::$_sysControllerUid = "/sys/main";
static::$_routeActionView = "/{$module->uniqueId}/main/v... | php | {
"resource": ""
} |
q235696 | ContentMenuBuilder.checkRoutesLink | train | protected static function checkRoutesLink($node)
{
$nodeLink = static::$_model->getNodePath($node);
// find route
$result = false;
foreach (Yii::$app->urlManager->rules as $nextRule) {
if (RoutesBuilder::properRule($nextRule, $nodeLink)) {
$result = true... | php | {
"resource": ""
} |
q235697 | ContentMenuBuilder.createContentLink | train | protected static function createContentLink($node)
{
static::_prepare();
$url = false;
// node with external/internal link: get URL from 'route' field
if (empty($node->text) && !empty($node->route)) {
$url = static::routeToLink($node->route);
}
// site t... | php | {
"resource": ""
} |
q235698 | ContentMenuBuilder.routeToLink | train | public static function routeToLink($strRoute, $ctrlLinkPrefix = null)
{
if (empty($ctrlLinkPrefix)) {
static::_prepare();
$ctrlLinkPrefix = Url::toRoute([static::$_sysControllerUid]);
}
$strRoute = trim($strRoute);
$url = $route = false;
if (substr($st... | php | {
"resource": ""
} |
q235699 | ContentMenuBuilder.convertRouteStrToArray | train | protected static function convertRouteStrToArray($strRoute)
{
/*
try {
$route = @eval("return $strRoute;"); // security problem
} catch (Exception $ex) {
return false;
}
*/
$str = trim($strRoute);
if (substr($str, 0, 1) == '[' && substr($str, -1, 1) ==... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.