_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q260800
PipelineBuilder.setKeys
test
public function setKeys(iterable $keys) { $combine = function ($values, $keys) { return new CombineIterator($keys, $values); }; return $this->then($combine, i\iterable_to_array($keys)); }
php
{ "resource": "" }
q260801
FilteringTrait.slice
test
public function slice(int $offset, ?int $size = null) { return $this->then(i\iterable_slice, $offset, $size); }
php
{ "resource": "" }
q260802
SortingTrait.sort
test
public function sort($compare, bool $preserveKeys = true) { return $this->then(i\iterable_sort, $compare, $preserveKeys); }
php
{ "resource": "" }
q260803
VariableTrait.setVariables
test
public function setVariables($variables) { if (!is_array($variables)) { return $this; } foreach ($variables as $key => $value) { $this->setVariable($key, $value); } return $this; }
php
{ "resource": "" }
q260804
VariableTrait.setVariable
test
public function setVariable($name, $value) { switch ($name) { case 'date': try { if ($value instanceof \DateTime) { $this->offsetSet('date', $value); } else { if (is_numeric($value)) { ...
php
{ "resource": "" }
q260805
SavePages.getPathname
test
protected function getPathname(Page $page) { // force pathname of a file node page (ie: "section/index.md") if ($page->getName() == 'index') { return $page->getPath().'/'.$this->config->get('output.filename'); } else { // custom extension, ex: 'manifest.json' ...
php
{ "resource": "" }
q260806
AntiSpoof.getScriptTag
test
private static function getScriptTag( $name ) { $name = "SCRIPT_" . strtoupper( trim( $name ) ); // Linear search foreach ( self::$script_ranges as $range ) { if ( $name == $range[2] ) { return $range[2]; } } // Otherwise... return null; }
php
{ "resource": "" }
q260807
AntiSpoof.isAllowedScriptCombination
test
private static function isAllowedScriptCombination( $scriptList ) { $allowedScriptCombinations = [ [ "SCRIPT_COPTIC", "SCRIPT_COPTIC_EXTRAS" ], # Coptic, using old Greek chars [ "SCRIPT_GREEK", "SCRIPT_COPTIC_EXTRAS" ], # Coptic, using new Coptic chars [ "SCRIPT_HAN", "SCRIPT_BOPOMOFO" ], # Chinese [ "SCR...
php
{ "resource": "" }
q260808
AntiSpoof.stringToList
test
public static function stringToList( $str ) { $ar = []; if ( !preg_match_all( '/./us', $str, $ar ) ) { return []; } $out = []; foreach ( $ar[0] as $char ) { $out[] = Utils::utf8ToCodepoint( $char ); } return $out; }
php
{ "resource": "" }
q260809
BatchAntiSpoof.execute
test
public function execute() { $this->output( "Creating username spoofs...\n" ); $userCol = $this->getUserColumn(); $iterator = new BatchRowIterator( $this->getDB( DB_MASTER ), $this->getTableName(), $this->getPrimaryKey(), $this->getBatchSize() ); $iterator->setFetchColumns( [ $userCol ] ); $n = 0;...
php
{ "resource": "" }
q260810
RenderPages.getAllLayoutsPaths
test
protected function getAllLayoutsPaths() { $paths = []; // layouts/ if (is_dir($this->config->getLayoutsPath())) { $paths[] = $this->config->getLayoutsPath(); } // <theme>/layouts/ if ($this->config->hasTheme()) { $themes = $this->config->getTh...
php
{ "resource": "" }
q260811
RenderPages.addGlobals
test
protected function addGlobals() { // adds global variables $this->phpoole->getRenderer()->addGlobal('site', array_merge( $this->config->get('site'), ['menus' => $this->phpoole->getMenus()], ['pages' => $this->phpoole->getPages()->filter(function (Page $page) { ...
php
{ "resource": "" }
q260812
GeneratorManager.process
test
public function process(PageCollection $pageCollection, \Closure $messageCallback) { $max = $this->count(); if ($max > 0) { $this->top(); while ($this->valid()) { /* @var GeneratorInterface $generator */ $generator = $this->current(); ...
php
{ "resource": "" }
q260813
AtomLoader.setParam
test
protected function setParam(\SimpleXMLElement $element, Feed $feed) { if (count($element) === 0) { $feed->set($element->getName(), (string)$element); } else { $feed->set($element->getName(), $this->extractParam($element)); } }
php
{ "resource": "" }
q260814
AtomLoader.extractParam
test
protected function extractParam(\SimpleXMLElement $element) { $param = array(); foreach ($element as $subElement) { if (count($subElement) === 0) { $param[$subElement->getName()] = (string)$subElement; } else { $param[$subElement->getName()] = ...
php
{ "resource": "" }
q260815
Util.runGitCommand
test
public static function runGitCommand($command) { try { $process = new Process($command, __DIR__); if (0 === $process->run()) { return trim($process->getOutput()); } throw new \RuntimeException( sprintf( 'The...
php
{ "resource": "" }
q260816
Util.sortByDate
test
public static function sortByDate($a, $b) { if (!isset($a['date'])) { return -1; } if (!isset($b['date'])) { return 1; } if ($a['date'] == $b['date']) { return 0; } return ($a['date'] > $b['date']) ? -1 : 1; }
php
{ "resource": "" }
q260817
Feed.remove
test
public function remove($id) { $success = false; foreach ($this->items as $i => $item) { if ($item->getFeedId() === $id) { unset($this->items[$i]); $success = true; break; } } if (false === $success) { ...
php
{ "resource": "" }
q260818
Feed.replace
test
public function replace($id, ItemInterface $newItem) { $success = false; foreach ($this->items as $i => $item) { if ($item->getFeedId() == $id) { $this->items[$i] = $newItem; $success = true; break; } } if (fals...
php
{ "resource": "" }
q260819
Feed.merge
test
public function merge(Feed $feed) { $this->items = array(); foreach ($feed as $item) { $this->add($item); } return $this; }
php
{ "resource": "" }
q260820
Feed.autoSlice
test
protected function autoSlice() { $maxItems = $this->get('max_items', 10); if (count($this) > $maxItems) { $this->items = array_slice( $this->items, count($this) - $maxItems, $maxItems ); } return $this; }
php
{ "resource": "" }
q260821
SpoofUser.getConflicts
test
public function getConflicts() { $dbr = $this->getDBSlave(); // Join against the user table to ensure that we skip stray // entries left after an account is renamed or otherwise munged. $spoofedUsers = $dbr->select( [ 'spoofuser', $this->getTableName() ], [ 'su_name' ], // Same thing due to the join. Sav...
php
{ "resource": "" }
q260822
SpoofUser.batchRecord
test
public static function batchRecord( IDatabase $dbw, $items ) { if ( !count( $items ) ) { return false; } $fields = []; /** * @var $item SpoofUser */ foreach ( $items as $item ) { $fields[] = $item->insertFields(); } $dbw->replace( 'spoofuser', [ 'su_name' ], $fields, __METHOD__ ); ...
php
{ "resource": "" }
q260823
AtomRenderer.writeItems
test
private function writeItems(XMLManager $xml, Feed $feed) { foreach ($feed as $item) { $this->writeItem($xml, $item); } }
php
{ "resource": "" }
q260824
ScheduleManagerScheduleIterator.setCurrent
test
protected function setCurrent() { if(count($this->buffer) === 0) { $this->buffer(); } $this->current = count($this->buffer) > 0 ? array_pop($this->buffer) : null; }
php
{ "resource": "" }
q260825
ScheduleManagerScheduleIterator.buffer
test
protected function buffer() { $this->buffer = $this->scheduleManager->findSchedules($this->limit, $this->offset); $this->offset += count($this->buffer); }
php
{ "resource": "" }
q260826
Collection.sortByDate
test
public function sortByDate() { return $this->usort(function ($a, $b) { if (!isset($a['date'])) { return -1; } if (!isset($b['date'])) { return 1; } if ($a['date'] == $b['date']) { return 0; ...
php
{ "resource": "" }
q260827
Config.import
test
public function import($config) { if (is_array($config)) { $data = $this->getAll(); $origin = $data->export(); $data->import($config); $data->import($origin); $this->setFromData($data); } }
php
{ "resource": "" }
q260828
Config.setFromData
test
protected function setFromData(Data $data) { if ($this->data !== $data) { $this->data = $data; } return $this; }
php
{ "resource": "" }
q260829
Config.setSourceDir
test
public function setSourceDir($sourceDir = null) { if ($sourceDir === null) { $sourceDir = getcwd(); } if (!is_dir($sourceDir)) { throw new \InvalidArgumentException(sprintf("'%s' is not a valid source directory.", $sourceDir)); } $this->sourceDir = $so...
php
{ "resource": "" }
q260830
Config.setDestinationDir
test
public function setDestinationDir($destinationDir = null) { if ($destinationDir === null) { $destinationDir = $this->sourceDir; } if (!is_dir($destinationDir)) { throw new \InvalidArgumentException(sprintf("'%s' is not a valid destination directory.", $destinationDir)...
php
{ "resource": "" }
q260831
Layout.finder
test
public function finder(Page $page, Config $config) { $layout = 'unknown'; // what layouts could be use for the page? $layouts = self::fallback($page); // take the first available layout foreach ($layouts as $layout) { // is it in layouts/ dir? if (Ut...
php
{ "resource": "" }
q260832
Layout.fallback
test
protected static function fallback(Page $page) { // remove redundant '.twig' extension $layout = str_replace('.twig', '', $page->getLayout()); switch ($page->getNodeType()) { case NodeType::HOMEPAGE: $layouts = [ 'index.html.twig', ...
php
{ "resource": "" }
q260833
Page.parse
test
public function parse() { $parser = new Parser($this->file); $parsed = $parser->parse(); $this->frontmatter = $parsed->getFrontmatter(); $this->body = $parsed->getBody(); return $this; }
php
{ "resource": "" }
q260834
Page.getSection
test
public function getSection() { if (empty($this->getVariable('section')) && !empty($this->path)) { $this->setSection(explode('/', $this->path)[0]); } return $this->getVariable('section'); }
php
{ "resource": "" }
q260835
Page.getPermalink
test
public function getPermalink() { if (empty($this->getVariable('permalink'))) { $this->setPermalink($this->getPathname()); } return $this->getVariable('permalink'); }
php
{ "resource": "" }
q260836
Builder.setConfig
test
public function setConfig($config) { if (!$config instanceof Config) { $config = new Config($config); } if ($this->config !== $config) { $this->config = $config; } return $this; }
php
{ "resource": "" }
q260837
Builder.build
test
public function build($options) { // backward compatibility if ($options === true) { $options['verbosity'] = self::VERBOSITY_VERBOSE; } $this->options = array_merge([ 'verbosity' => self::VERBOSITY_NORMAL, // -1: quiet, 0: normal, 1: verbose, 2: debug ...
php
{ "resource": "" }
q260838
Builder.getVersion
test
public function getVersion() { if (!isset($this->version)) { try { $this->version = @file_get_contents(__DIR__.'/../VERSION'); if ($this->version === false) { throw new \Exception('Can\'t get version file!'); } } cat...
php
{ "resource": "" }
q260839
Extension.filterBy
test
public function filterBy($pages, $variable, $value) { $filteredPages = $pages->filter(function (Page $page) use ($variable, $value) { // filter virtual pages in section if ($variable == 'section' && $page->getVariable('virtual')) { return false; } ...
php
{ "resource": "" }
q260840
Extension.sortByDate
test
public function sortByDate($array) { $callback = function ($a, $b) { if (!isset($a['date'])) { return -1; } if (!isset($b['date'])) { return 1; } if ($a['date'] == $b['date']) { return 0; ...
php
{ "resource": "" }
q260841
Extension.createUrl
test
public function createUrl(\Twig_Environment $env, $value = null, $options = null) { $base = ''; $baseurl = $env->getGlobals()['site']['baseurl']; $hash = md5($env->getGlobals()['site']['time']); $canonical = null; $addhash = true; if (isset($options['canonical'])) { ...
php
{ "resource": "" }
q260842
Extension.minify
test
public function minify($path) { $filePath = $this->destPath.'/'.$path; if (is_file($filePath)) { $extension = (new \SplFileInfo($filePath))->getExtension(); switch ($extension) { case 'css': $minifier = new Minify\CSS($filePath); ...
php
{ "resource": "" }
q260843
Extension.toCss
test
public function toCss($path) { $filePath = $this->destPath.'/'.$path; $subPath = substr($path, 0, strrpos($path, '/')); if (is_file($filePath)) { $extension = (new \SplFileInfo($filePath))->getExtension(); switch ($extension) { case 'scss': ...
php
{ "resource": "" }
q260844
Extension.readtime
test
public function readtime($text) { $words = str_word_count(strip_tags($text)); $min = floor($words / 200); if ($min === 0) { return '1'; } return $min; }
php
{ "resource": "" }
q260845
Extension.hashFile
test
public function hashFile($path) { if (is_file($filePath = $this->destPath.'/'.$path)) { return sprintf('sha384-%s', base64_encode(hash_file('sha384', $filePath, true))); } }
php
{ "resource": "" }
q260846
GenerateMenus.collectPages
test
protected function collectPages() { foreach ($this->phpoole->getPages() as $page) { /* @var $page \PHPoole\Collection\Page\Page */ if (!empty($page['menu'])) { /* * Single case * ie: * menu: main */ ...
php
{ "resource": "" }
q260847
FeedFactory.render
test
public function render($feed, $rendererName='rss') { $renderer = $this->getRenderer($rendererName); return $renderer->render($this->get($feed)); }
php
{ "resource": "" }
q260848
FeedFactory.load
test
public function load($feedName, $loaderName = 'rss_file') { $loader = $this->getLoader($loaderName); $feed = $this->get($feedName); $loadedFeed = $loader->load($feed->getFilename($loader->getFormat())); return $this->feeds[$feedName] = $feed->merge($loadedFeed); }
php
{ "resource": "" }
q260849
Sniffer.sniff
test
public function sniff($input) { if (is_array($input)) { return $this->sniffAll($input); } return $this->run($input); }
php
{ "resource": "" }
q260850
Sniffer.is
test
public function is($input, $type) { if (!isset($this->types[$type])) { throw new \Exception('Type Not found use one of supported types ( '.implode(' , ', array_keys($this->types)).' )'); } $typeClass = $this->types[$type]; return (new $typeClass())->sniff($input); }
php
{ "resource": "" }
q260851
Sniffer.sniffAll
test
private function sniffAll(array $inputs) { $result = []; foreach ($inputs as $key => $input): $result[$key] = $this->run($input); endforeach; return $result; }
php
{ "resource": "" }
q260852
Sniffer.run
test
private function run($input) { foreach ($this->types as $name => $typeClass): //check if it custom type closure if (is_object($typeClass) && $typeClass instanceof Closure) { if ($typeClass($input) === true) { return $name; } ...
php
{ "resource": "" }
q260853
ScheduleManager.save
test
public function save(ScheduleInterface $schedule, $andFlush = true) { $this->objectManager->persist($schedule); if ($andFlush) { $this->objectManager->flush(); } }
php
{ "resource": "" }
q260854
RssRenderer.render
test
public function render(Feed $feed) { $filename = sprintf('%s/%s', $this->basePath, $feed->getFilename('rss')); if (is_file($filename)) { unlink($filename); } $xml = new XMLManager($filename); $this->init($xml, $feed); $this->writeItems($xml, $feed); ...
php
{ "resource": "" }
q260855
RssRenderer.createItem
test
private function createItem(XMLManager $xml) { $itemNode = $xml->getXml()->createElement('item'); $channelNode = $xml->getXml()->getElementsByTagName('channel')->item(0); $channelNode->appendChild($itemNode); return $itemNode; }
php
{ "resource": "" }
q260856
RssRenderer.getAuthor
test
private function getAuthor(ItemInterface $item) { $authorData = $item->getFeedAuthor(); $author = ''; if(isset($authorData['name'])) { $author .= $authorData['name']; } if (isset($authorData['email'])) { $author .= empty($author) ? $authorData['email']...
php
{ "resource": "" }
q260857
RssRenderer.getComments
test
private function getComments(ItemInterface $item) { $commentRoute = $item->getFeedCommentRoute(); if (!$commentRoute) { return null; } elseif (is_array($commentRoute)) { return $this->router->generate($commentRoute[0], $commentRoute[1]); } else { r...
php
{ "resource": "" }
q260858
XMLManager.hasXMLSyntaxMarkers
test
protected function hasXMLSyntaxMarkers($content) { foreach (array('<', '&') as $char) { if (strpos($content, $char) !== false) { return true; } } return false; }
php
{ "resource": "" }
q260859
Taxonomy.collectTaxonomiesFromPages
test
protected function collectTaxonomiesFromPages() { /* @var $page Page */ foreach ($this->pageCollection as $page) { foreach (array_keys($this->config->get('site.taxonomies')) as $plural) { if (isset($page[$plural])) { // converts a list to an array if n...
php
{ "resource": "" }
q260860
Taxonomy.createNodePages
test
protected function createNodePages() { /* @var $terms Vocabulary */ foreach ($this->taxonomies as $plural => $terms) { if (count($terms) > 0) { /* * Creates $plural/$term pages (list of pages) * ex: /tags/tag-1/ */ ...
php
{ "resource": "" }
q260861
OptimizeCommand.compileViews
test
protected function compileViews(): void { foreach ($this->laravel['view']->getFinder()->getPaths() as $path) { $this->compileViewsInPath($path); } }
php
{ "resource": "" }
q260862
OptimizeCommand.compileViewsInPath
test
protected function compileViewsInPath(string $path): void { foreach ($this->laravel['files']->allFiles($path) as $file) { try { $engine = $this->laravel['view']->getEngineFromPath($file); } catch (InvalidArgumentException $e) { continue; } ...
php
{ "resource": "" }
q260863
OptimizeCommand.compileSingleViewFile
test
protected function compileSingleViewFile($engine, string $file): void { if ($engine instanceof CompilerEngine) { $engine->getCompiler()->compile($file); } }
php
{ "resource": "" }
q260864
DiffUtils.generate
test
public static function generate($before, $after) { if ($before === $after) { return ''; } if (strlen($before) > self::MAX_SIZE || strlen($after) > self::MAX_SIZE) { return ''; } $beforeTmpFile = tempnam(sys_get_temp_dir(), 'diff'); file_put_c...
php
{ "resource": "" }
q260865
DiffUtils.parse
test
public static function parse($diff) { if ('' === $diff) { return array(); } $lines = explode("\n", $diff); $nbLines = count($lines); $curLine = 0; $chunks = array(); while ($curLine < $nbLines) { $chunks[] = self::parseChunk($lines, $...
php
{ "resource": "" }
q260866
Dispatchable.boot
test
public function boot() { // Extension should be activated only if we're not running under // safe mode (or debug mode). This is to ensure that developer have // a way to disable broken extension without tempering the database. if (! ($this->booted() || $this->status->is('safe'))) { ...
php
{ "resource": "" }
q260867
Dispatchable.finish
test
public function finish() { $this->extensions->each(function ($options, $name) { $this->dispatcher->finish($name, $options); }); $this->extensions = new Collection(); $this->booted = false; return $this; }
php
{ "resource": "" }
q260868
Dispatchable.registerActiveExtensions
test
protected function registerActiveExtensions(): void { $available = $this->memory->get('extensions.available', []); $active = $this->memory->get('extensions.active', []); // Loop all active extension and merge the configuration with // available config. Extension registration is hand...
php
{ "resource": "" }
q260869
Dispatchable.after
test
public function after(Closure $callback = null): void { if ($this->booted() || $this->status->is('safe')) { $this->app->call($callback); return; } $this->events->listen('orchestra.extension: booted', $callback); }
php
{ "resource": "" }
q260870
ProviderRepository.provides
test
public function provides(array $provides) { $this->compiled = Collection::make($provides)->mapWithKeys(function ($provider) { $options = $this->manifest[$provider] ?? $this->recompileProvider($provider); $this->loadDeferredServiceProvider($provider, $options); $this->loa...
php
{ "resource": "" }
q260871
ProviderRepository.writeManifestFile
test
protected function writeManifestFile(array $manifest = []) { $this->files->put($this->manifestPath, '<?php return '.\var_export($manifest, true).';'); }
php
{ "resource": "" }
q260872
ProviderRepository.registerDeferredServiceProvider
test
protected function registerDeferredServiceProvider($provider, ServiceProvider $instance) { return [ 'instance' => $instance, 'eager' => false, 'when' => $instance->when(), 'deferred' => \array_fill_keys($instance->provides(), $provider), ]; }
php
{ "resource": "" }
q260873
ProviderRepository.loadQueuedServiceProvider
test
protected function loadQueuedServiceProvider($provider, array $options) { foreach ($options['when'] as $listen) { $this->events->listen($listen, function () use ($provider, $options) { $this->app->register($options['instance'] ?? $provider); }); } }
php
{ "resource": "" }
q260874
Activator.activate
test
public function activate(Listener $listener, Fluent $extension) { if ($this->factory->started($extension->get('name'))) { return $listener->abortWhenRequirementMismatched(); } return $this->execute($listener, 'activation', $extension, function (Factory $factory, $name) { ...
php
{ "resource": "" }
q260875
Repository.map
test
public function map(string $name, array $aliases): bool { $memory = $this->memory->make(); $meta = $memory->get("extension_{$name}", []); foreach ($aliases as $current => $default) { isset($meta[$current]) && $this->config->set($default, $meta[$current]); $meta[$cur...
php
{ "resource": "" }
q260876
DomainAware.registerDomainAwareness
test
public function registerDomainAwareness() { $this->app->resolving(RouteGenerator::class, function (RouteGenerator $generator, Application $app) { $generator->setBaseUrl($app->make('config')->get('app.url')); }); }
php
{ "resource": "" }
q260877
Factory.detect
test
public function detect(): Collection { $this->events->dispatch('orchestra.extension: detecting'); return \tap($this->finder()->detect(), function ($extensions) { $this->memory->put('extensions.available', $extensions->map(function ($item) { return Arr::except($item, ['de...
php
{ "resource": "" }
q260878
Factory.option
test
public function option(string $name, string $option, $default = null) { if (! $this->extensions->has($name)) { return \value($default); } return Arr::get($this->extensions->get($name), $option, $default); }
php
{ "resource": "" }
q260879
Factory.publish
test
public function publish(string $name): void { $this->app->make('orchestra.publisher.migrate')->extension($name); $this->app->make('orchestra.publisher.asset')->extension($name); $this->events->dispatch('orchestra.publishing', [$name]); $this->events->dispatch("orchestra.publishing: ...
php
{ "resource": "" }
q260880
Factory.register
test
public function register(string $name, string $path): bool { return $this->finder()->registerExtension($name, $path); }
php
{ "resource": "" }
q260881
Factory.route
test
public function route(string $name, string $default = '/'): UrlGeneratorContract { // Boot the extension. ! $this->booted() && $this->app->make(LoadExtension::class)->bootstrap($this->app); if (! isset($this->routes[$name])) { // All route should be manage via `orchestra/extens...
php
{ "resource": "" }
q260882
Operation.activating
test
protected function activating(string $name): bool { if (\is_null($active = $this->refresh($name))) { return false; } $this->extensions->put($name, $active[$name]); $this->publish($name); $this->dispatcher->activating($name, $active[$name]); return true;...
php
{ "resource": "" }
q260883
Operation.refresh
test
public function refresh(string $name): ?array { $memory = $this->memory; $available = $memory->get('extensions.available', []); $active = $memory->get('extensions.active', []); if (! isset($available[$name])) { return null; } // Append the activated exte...
php
{ "resource": "" }
q260884
Operation.reset
test
public function reset(string $name): bool { $memory = $this->memory; $default = $memory->get("extensions.available.{$name}", []); $memory->put("extensions.active.{$name}", $default); if ($memory->has("extension_{$name}")) { $memory->put("extension_{$name}", []); ...
php
{ "resource": "" }
q260885
ElementAnnotationsListener.handleExcludeField
test
public function handleExcludeField(EventInterface $event) { /** @var \Doctrine\ORM\Mapping\ClassMetadataInfo $metadata */ $metadata = $event->getParam('metadata'); $identifiers = $metadata->getIdentifierFieldNames(); return in_array($event->getParam('name'), $identifiers) && ...
php
{ "resource": "" }
q260886
ThemeManager.createOrchestraDriver
test
protected function createOrchestraDriver(): ThemeContract { $theme = new Theme( $this->app, $this->app->make('events'), $this->app->make('files') ); return $theme->initiate(); }
php
{ "resource": "" }
q260887
Plugin.bootstrap
test
public function bootstrap(Application $app) { $this->bootstrapConfiguration($app); $this->bootstrapForm($app); $this->bootstrapMenuHandler($app); $this->bootstrapSidebarPlaceholders($app); $this->bootstrapValidationRules($app); }
php
{ "resource": "" }
q260888
Plugin.bootstrapConfiguration
test
protected function bootstrapConfiguration(Application $app) { if (empty($this->extension) || empty($this->config)) { return; } $app->make('orchestra.extension.config')->map($this->extension, $this->config); }
php
{ "resource": "" }
q260889
Plugin.bootstrapForm
test
protected function bootstrapForm(Application $app) { $this->attachListenerOn($app, 'form', function (Fluent $model, FormBuilder $form) { $this->form($model, $form); }); }
php
{ "resource": "" }
q260890
Plugin.bootstrapMenuHandler
test
protected function bootstrapMenuHandler(Application $app) { if (\is_null($this->menu)) { return; } $app->make('events')->listen('orchestra.ready: admin', $this->menu); }
php
{ "resource": "" }
q260891
Plugin.bootstrapSidebarPlaceholders
test
protected function bootstrapSidebarPlaceholders(Application $app) { $widget = $app->make('orchestra.widget'); $placeholder = $widget->make('placeholder.orchestra.extensions'); $this->attachListenerOn($app, 'form', function () use ($placeholder) { foreach ($this->sidebar as $name...
php
{ "resource": "" }
q260892
Plugin.bootstrapValidationRules
test
protected function bootstrapValidationRules(Application $app) { $this->attachListenerOn($app, 'validate', function (Fluent $rules) { foreach ($this->rules as $name => $validation) { $rules[$name] = $validation; } }); }
php
{ "resource": "" }
q260893
Plugin.attachListenerOn
test
protected function attachListenerOn(Application $app, $event, Closure $callback) { $app->make('events')->listen("orchestra.{$event}: extension.{$this->extension}", $callback); }
php
{ "resource": "" }
q260894
Theme.initiate
test
public function initiate() { $baseUrl = $this->app->make('request')->root(); // Register relative and absolute URL for theme usage. $this->absoluteUrl = \rtrim($baseUrl, '/').'/themes'; $this->relativeUrl = \trim(\str_replace($baseUrl, '/', $this->absoluteUrl), '/'); return...
php
{ "resource": "" }
q260895
Theme.setTheme
test
public function setTheme(?string $theme): void { if (! \is_null($this->theme)) { $this->resolved && $this->resetViewPaths(); $this->dispatcher->dispatch("orchestra.theme.unset: {$this->theme}"); } $this->theme = $theme; $this->dispatcher->dispatch("orchestra...
php
{ "resource": "" }
q260896
Theme.boot
test
public function boot(): bool { if ($this->booted) { return false; } $this->booted = true; $themePath = $this->getThemePath(); $autoload = $this->getThemeAutoloadFiles($themePath); foreach ($autoload as $file) { $file = \ltrim($file, '/'); ...
php
{ "resource": "" }
q260897
Theme.resolving
test
public function resolving(): bool { if ($this->resolved) { return false; } $this->resolved = true; $this->dispatcher->dispatch('orchestra.theme.resolving', [$this, $this->app]); $this->setViewPaths(); return true; }
php
{ "resource": "" }
q260898
Theme.getAvailableThemePaths
test
public function getAvailableThemePaths(): array { return Collection::make($this->getThemePaths())->filter(function ($path) { return $this->files->isDirectory($path); })->values()->all(); }
php
{ "resource": "" }
q260899
Theme.getThemeAutoloadFiles
test
protected function getThemeAutoloadFiles(string $themePath): array { $manifest = new Manifest($this->files, $themePath); return $manifest->autoload ?? []; }
php
{ "resource": "" }