_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q240800
RequestCookieCollection.set
train
public function set(string $name, RequestCookieInterface $requestCookie): void { $this->requestCookies[$name] = $requestCookie; }
php
{ "resource": "" }
q240801
TransformerFactory.make
train
public function make($name, $options) { if (!$name || !is_string($name)) { return null; } if (isset($this->objTemplates[$name])) { return clone $this->objTemplates[$name]; } if (!$this->namespaceTransformer) { $this->namespaceTransformer ...
php
{ "resource": "" }
q240802
ConnectTrait.setDefaultAttributes
train
protected function setDefaultAttributes() { if (!empty($this->attributes)) { foreach ($this->attributes as $attr => $val) { $this->realSetAttribute($attr, $val); } } }
php
{ "resource": "" }
q240803
AbstractMapperCollection.doAdd
train
protected function doAdd($object) { $this->notifyAccess(); $this->objectsArray[$this->total] = $object; $this->total++; }
php
{ "resource": "" }
q240804
Reference.countVideos
train
public function countVideos(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null) { $partial = $this->collVideosPartial && !$this->isNew(); if (null === $this->collVideos || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collVideos) { ...
php
{ "resource": "" }
q240805
Reference.getSkillReferences
train
public function getSkillReferences(Criteria $criteria = null, ConnectionInterface $con = null) { $partial = $this->collSkillReferencesPartial && !$this->isNew(); if (null === $this->collSkillReferences || null !== $criteria || $partial) { if ($this->isNew() && null === $this->collSkillR...
php
{ "resource": "" }
q240806
Reference.getSkillReferencesJoinSkill
train
public function getSkillReferencesJoinSkill(Criteria $criteria = null, ConnectionInterface $con = null, $joinBehavior = Criteria::LEFT_JOIN) { $query = ChildSkillReferenceQuery::create(null, $criteria); $query->joinWith('Skill', $joinBehavior); return $this->getSkillReferences($query, $con)...
php
{ "resource": "" }
q240807
Reference.getSkills
train
public function getSkills(Criteria $criteria = null, ConnectionInterface $con = null) { $partial = $this->collSkillsPartial && !$this->isNew(); if (null === $this->collSkills || null !== $criteria || $partial) { if ($this->isNew()) { // return empty collection ...
php
{ "resource": "" }
q240808
Reference.removeSkill
train
public function removeSkill(ChildSkill $skill) { if ($this->getSkills()->contains($skill)) { $skillReference = new ChildSkillReference(); $skillReference->setSkill($skill); if ($skill->isReferencesLoaded()) { //remove the back reference if available $...
php
{ "resource": "" }
q240809
Index.search
train
public function search($key) { $binarySearch = new BinarySearch($this); $result = $binarySearch->search($key); if (\is_null($result) || $result->getKey() != $key) { return null; } return $result; }
php
{ "resource": "" }
q240810
Index.searchRange
train
public function searchRange(Range $range) { $iterator = $this->getIterator(); // find start $start = null; $binarySearch = new BinarySearch($this); $startHint = $binarySearch->search($range->getMin()); if ($startHint == null) { return new RangeIte...
php
{ "resource": "" }
q240811
Object.get
train
public function get($property, $default = null) { if (!$this->has($property)) { return $default; } return null !== $this->data[$property] ? $this->data[$property] : $default; }
php
{ "resource": "" }
q240812
Mapper.copyfrom
train
public function copyfrom($var,$func=NULL) { if (is_string($var)) { $var = Base::instance()->get($var); } if ($func) { $var = call_user_func($func, $var); } foreach ($var as $key=>$val) { if ( array_key_exists($key, $this->fi...
php
{ "resource": "" }
q240813
RequireAnnotation.parse
train
public function parse($param_str) { $file = new File(trim($param_str), $this->getScope()->getFile()->getAbsoluteFile()->getParent()); if (!$file->exists()) { throw new ResourceNotFoundException($param_str, $this->getScope(), $this->getOccursPos(), "The Requirement File Not Exists"); ...
php
{ "resource": "" }
q240814
Tiny_diff.compare
train
public function compare($old, $new, $mode = 'normal') { // Mixed if ( $mode === 'mixed') { // Insert characters $ins_begin = '<ins>+ '; $ins_end = '</ins>' . PHP_EOL; // Delete characters $del_begin = '<del>- '; $del_end = '</del>' . PHP_EOL; } // HTML mode elseif ( $mode === 'html'...
php
{ "resource": "" }
q240815
Tiny_diff.diff
train
private function diff($old, $new) { $maxlen = 0; // Go through each old line. foreach($old as $old_line => $old_value) { // Get the new lines that match the old line $new_lines = array_keys($new, $old_value); // Go through each new line number foreach($new_lines as $new_line) { $matrix[$old...
php
{ "resource": "" }
q240816
BackyardGeo.getRoughDistance
train
public function getRoughDistance($clientLng, $clientLat, $poiLng, $poiLat) { $result = abs($clientLng - $poiLng) + abs($clientLat - $poiLat); $this->BackyardError->log(5, "client({$clientLng}, {$clientLat}) poi({$poiLng}, {$poiLat}) roughDistance = {$result}"); return $result; }
php
{ "resource": "" }
q240817
ServiceProvider.register
train
public function register() { // Register Sub Providers $this->registerSubProviders(collect($this->subProviders)); // Register bindings. $this->registerBindings(collect($this->bindings)); // Register migrations. $this->registerMigrations(collect($this->migrations)); ...
php
{ "resource": "" }
q240818
ServiceProvider.registerSubProviders
train
protected function registerSubProviders(Collection $subProviders) { $subProviders->each(function ($provider) { $this->app->register($provider); }); }
php
{ "resource": "" }
q240819
ServiceProvider.registerBindings
train
protected function registerBindings(Collection $bindings) { $bindings->each(function ($concretion, $abstraction) { $this->app->bind($abstraction, $concretion); }); }
php
{ "resource": "" }
q240820
RobocloudKinesisClient.getKinesisClient
train
public function getKinesisClient($type) { if (!empty($this->clients[$type])) { return $this->clients[$type]; } $config = [ 'version' => $this->config['api_version'], 'region' => $this->config['region'], ]; $config['credentials'] = [ ...
php
{ "resource": "" }
q240821
IndexController.preDispatch
train
public function preDispatch(MvcEvent $e) { if ($this->zfcUserAuthentication ()->hasIdentity ()) { $userName = $this->zfcUserAuthentication ()->getIdentity ()->getUsername (); } else { $userName = 'anonymous'; } $this->layout ()->setVariable ( 'dataTypes', $this->getDataTypesHandler ()->getDataTypes () ); ...
php
{ "resource": "" }
q240822
Collection.isDirty
train
public function isDirty() { if (count($this) != $this->_original) { return true; } if (count($this->_deleted)) { return true; } foreach ($this as $model) { if (is_object($model) && ($model->isDirty() || $model->isNew()) ...
php
{ "resource": "" }
q240823
Collection.markClean
train
public function markClean() { foreach ($this as $model) { if (is_object($model)) { $model->markClean(); } } $this->_original = count($this); }
php
{ "resource": "" }
q240824
Collection.jsonSerialize
train
public function jsonSerialize() { $out = []; foreach ($this as $model) { if (!is_object($model)) { continue; } if ($model instanceof JsonSerializable) { $out[] = $model->jsonSerialize(); } else { $out[] =...
php
{ "resource": "" }
q240825
Item.get
train
public function get($key, $default = null) { if(!is_string($key) || empty($key)) { return $default; } //split string into array $item_pieces = explode('.', $key); //let igorw check if array item exists return igorw\get_in($this->data, $item_pieces, $defa...
php
{ "resource": "" }
q240826
Seeder.execute
train
protected static function execute($seeder) { $data = self::fill($seeder); // $table = new DBTable($seeder->table); return $table->insert($data); }
php
{ "resource": "" }
q240827
Seeder.fill
train
public static function fill($seeder) { $data = []; // if ($seeder->count <= 0) { foreach ($seeder->data() as $value) { // Collection::push($data, $value); array_push($data, $value); } } else { for ($i = 0; $i < $seed...
php
{ "resource": "" }
q240828
PasswordController.request
train
public function request(Request $request) { $user = User::whereEmail($request->email)->firstOrFail(); $user->sendResetPasswordNotification($this->broker()->createToken($user), $request); return response()->json('Password request successful', 200); }
php
{ "resource": "" }
q240829
Scores.createNew
train
public function createNew( string $attribute, string $name, float $value ) : array { return $this->sendPost( sprintf('/profiles/%s/scores', $this->userName), [], [ 'attribute' => $attribute, 'name' => $name, ...
php
{ "resource": "" }
q240830
Scores.upsertOne
train
public function upsertOne( string $attribute, string $name, float $value ) : array { return $this->sendPut( sprintf('/profiles/%s/scores', $this->userName), [], [ 'attribute' => $attribute, 'name' => $name, ...
php
{ "resource": "" }
q240831
Scores.updateOne
train
public function updateOne(string $attribute, string $name, float $value) : array { return $this->sendPatch( sprintf('/profiles/%s/scores/%s', $this->userName, $name), [], [ 'attribute' => $attribute, 'value' => $value ] ...
php
{ "resource": "" }
q240832
ClearShell.all
train
public function all() { foreach ( $this->tasks as $task => $option ) { $task = $this->taskClassname($task); $this->$task->all(); } }
php
{ "resource": "" }
q240833
Bstall.make
train
public function make($name="default", $width=100, $height=100, $bgcolor=0xFFFFFF) { $bstall = new Bstall; $this->width = $width; $this->height = $height; $this->bgcolor = $bgcolor; $this->load($name); return View::make('bstall::canvas', [ 'name' ...
php
{ "resource": "" }
q240834
Bstall.load
train
public function load($name) { $stall = $this->redis->get("bstall_{$name}"); if(is_null($stall)) { $this->clean(); $this->save($name); } else { $canvas = unserialize($stall); $this->canvas = $canvas; } }
php
{ "resource": "" }
q240835
Bstall.clean
train
public function clean() { $this->canvas = []; for($y=0; $y < $this->height; $y++) { array_push($this->canvas, []); for($x=0; $x < $this->width; $x++) { $this->canvas[$y][$x] = $this->bgcolor; } } }
php
{ "resource": "" }
q240836
Bstall.write
train
public function write($x, $y, $color) { if(isset($this->canvas[$y][$x])) { $this->canvas[$y][$x] = $color; } }
php
{ "resource": "" }
q240837
next.parent
train
public static function parent() { if (!self::$activeTraitMethod) { throw new \BadMethodCallException("next:parent() call is only allowed in trait calls"); } $arguments = func_get_args(); return call_user_func(self::$activeTraitMethod, $arguments); }
php
{ "resource": "" }
q240838
ArticleStatisticImporter.importArticleStatistics
train
public function importArticleStatistics() { $pendingImports = $this->em->getRepository('ImportBundle:PendingStatisticImport')->findAll(); $this->consoleOutput->writeln("Importing article statistics..."); foreach ($pendingImports as $import) { $this->importArticleStatistic($impor...
php
{ "resource": "" }
q240839
ArticleStatisticImporter.importArticleStatistic
train
public function importArticleStatistic($oldId, $newId) { $article = $this->em->getRepository('VipaJournalBundle:Article')->find($newId); if (!$article) { $this->consoleOutput->writeln("Couldn't find #" . $newId . " on the new database."); return; } $this->co...
php
{ "resource": "" }
q240840
Zend_Gdata.getFeed
train
public function getFeed($location, $className = 'Zend_Gdata_Feed') { if (is_string($location)) { $uri = $location; } elseif ($location instanceof Zend_Gdata_Query) { $uri = $location->getQueryUrl(); } else { require_once 'Zend/Gdata/App/InvalidArgumentExce...
php
{ "resource": "" }
q240841
Zend_Gdata.performHttpRequest
train
public function performHttpRequest($method, $url, $headers = array(), $body = null, $contentType = null, $remainingRedirects = null) { if ($this->_httpClient instanceof Zend_Gdata_HttpClient) { $filterResult = $this->_httpClient->filterHttpRequest($method, $url, $headers, $body, $contentType); ...
php
{ "resource": "" }
q240842
Zend_Gdata.isAuthenticated
train
public function isAuthenticated() { $client = parent::getHttpClient(); if ($client->getClientLoginToken() || $client->getAuthSubToken() ) { return true; } return false; }
php
{ "resource": "" }
q240843
CmsPageHelper.renderTree
train
public function renderTree($pages, $closedPages, $langId, $level = null) { if (empty($pages)) { $newPageLink = $this->Html->link( __d('wasabi_cms', 'Please add your first Page'), [ 'plugin' => 'Wasabi/Cms', 'controller' => 'Page...
php
{ "resource": "" }
q240844
SimpleXmlElement._toBoolean
train
protected function _toBoolean($value) { $value = strtolower((string)$value); $result = ($value != 'false') && ($value != 'off') && !empty($value); return $result; }
php
{ "resource": "" }
q240845
SimpleXmlElement.quoteXpathValue
train
public static function quoteXpathValue($string) { if (strpos($string, "'") === false) { return "'$string'"; } if (strpos($string, '"') === false) { return '"' . $string . '"'; } // String contains ' and " -> need to use concat ... $parts = ex...
php
{ "resource": "" }
q240846
SimpleXmlElement.getPath
train
public function getPath() { $stack = array($this->getName()); $current = $this; while ($parent = $current->getParent()) { array_unshift($stack, $parent->getName()); $current = $parent; } return implode('/', $stack); }
php
{ "resource": "" }
q240847
SimpleXmlElement.toValue
train
public function toValue($type = null, $valueAttribute = null) { $value = ($valueAttribute)? (string)$this[$valueAttribute] : (string)$this; $type = ($type)?: (string)$this['type']; switch ($type) { case 'int': $value = (int)$value; break; ...
php
{ "resource": "" }
q240848
SimpleXmlElement.toArray
train
public function toArray($force = true) { if (!$force && !$this->hasChildren()) { return $this->toValue(); } $data = array(); foreach ($this->children() as $name => $child) { $data[$name] = $child->toArray(false); } return $data; }
php
{ "resource": "" }
q240849
SimpleXmlElement.toPhpValue
train
public function toPhpValue($type = null, $serviceLocator = null) { if (!$type) { $type = $this->getName(); } switch ($type) { case 'array': $value = array(); if (!isset($this->item)) { return $value; ...
php
{ "resource": "" }
q240850
SimpleXmlElement._getMergeRule
train
protected function _getMergeRule($element, &$affected = null, $rule = null) { if ($rule instanceof MergeRuleInterface) { $result = $rule($this, $element, $affected); if ($result !== false) { return $result; } } $name = $element->getName()...
php
{ "resource": "" }
q240851
SimpleXmlElement.mergeAttributes
train
public function mergeAttributes(SimpleXmlElement $node, $replace = true) { foreach ($node->attributes() as $name => $value) { if (isset($this[$name])) { if ($replace) { $this[$name] = (string)$value; } continue; } ...
php
{ "resource": "" }
q240852
SimpleXmlElement.merge
train
public function merge(SimpleXmlElement $element, $replace = true, $rule = null) { foreach ($element->children() as $name => $child) { $affected = null; $currentpath = $child->getPath(); $action = $this->_getMergeRule($child, $affected, $rule); if ($action == ...
php
{ "resource": "" }
q240853
Router.route_exists
train
private function route_exists() : bool { if ( property_exists( $this, 'routes' ) ) { return array_key_exists( $this->__method_name, $this->routes ); } return false; }
php
{ "resource": "" }
q240854
Router.route_request
train
private function route_request() { $named_arguments = $this->get_named_arguments(); list( $to_class, $to_method, $on_error ) = $this->get_route_parts(); return $this->do_route( $to_class, $to_method, $named_arguments, $on_error ); }
php
{ "resource": "" }
q240855
Router.get_named_arguments
train
private function get_named_arguments() : array { // name the parameters $named_arguments = []; if ( array_key_exists( 'expects', $this->routes[ $this->__method_name ] ) ) { $expects = $this->routes[ $this->__method_name ]['expects']; foreach ( $expects as $index => $parameter_name ) { if ( array_key_e...
php
{ "resource": "" }
q240856
Router.get_route_parts
train
private function get_route_parts() : array { $to = $this->routes[ $this->__method_name ]['to']; if ( \is_array( $to ) ) { $to_parts = $to; } else { $to_parts = explode( '@', $to ); } $to_class = $to_parts[0]; $to_method = $to_parts[1]; $on_error = null; if ( array_key_exists( 'on_error', $this-...
php
{ "resource": "" }
q240857
Router.do_route
train
private function do_route( $class_name, $method_name, $named_arguments, $on_error ) { if ( \is_object( $class_name ) ) { return $this->call( array( $class_name, $method_name, ), $named_arguments ); } $injector_factory = new Dependency_Injection_Factory( $class_name, $method_name...
php
{ "resource": "" }
q240858
ResponseFactory.template
train
public static function template($template, $parameter = array(), $status = 200, $headers = array()) { View::setTemplate($template, $parameter); return new Response('', $status, $headers); }
php
{ "resource": "" }
q240859
ResponseFactory.json
train
public static function json($data, $status = 200, $headers = array()) { $jsonHeader = array('Content-Type' => 'application/json'); $content = json_encode($data); return new Response($content, $status, $jsonHeader); }
php
{ "resource": "" }
q240860
ResponseFactory.redirect
train
public static function redirect($url, $status = 302, $headers = array()) { $redirect = new RedirectResponse($url, $status, $headers); $redirect->sendHeaders(); die(); }
php
{ "resource": "" }
q240861
ResponseFactory.download
train
public static function download($file, $status = 200, $headers = array()) { require_once ABSPATH.'wp-admin/includes/file.php'; WP_Filesystem(); global $wp_filesystem; $fileData = $wp_filesystem->get_contents($file); $downloadHeader['Content-Description'] = 'File Transfer'...
php
{ "resource": "" }
q240862
LanguageListener.setLocaleForUnauthenticatedUser
train
public function setLocaleForUnauthenticatedUser(GetResponseEvent $event) { if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) { return; } $request = $event->getRequest(); if ('unset' == $request->getLocale()) { if ($locale = $request->getSes...
php
{ "resource": "" }
q240863
LanguageListener.setLocaleForAuthenticatedUser
train
public function setLocaleForAuthenticatedUser(InteractiveLoginEvent $event) { $user = $event->getAuthenticationToken()->getUser(); if ($lang = $user->getLocale()) { $this->session->set('_locale', $lang); } else { $request = $event->getRequest(); if ('unset...
php
{ "resource": "" }
q240864
App.makeInstance
train
protected static function makeInstance( $class, array $options = null ): Implementation { $options || $options = ['provider' => self::app()]; return IOC::make($class, [$options, true]); }
php
{ "resource": "" }
q240865
App.getInstance
train
public static function getInstance( $class = null, array $options = [] ) { /** @var Implementation $instance */ if (is_null(self::$instance)) { if (is_null($class)) { self::$instance = self::makeInstance( Implementation::class, $options...
php
{ "resource": "" }
q240866
Signature.setHttpMethod
train
public function setHttpMethod($method) { $allowedMethods = array( 'POST', 'PUT', 'GET', 'DELETE', 'PATCH' ); if (!in_array(strtoupper($method), $allowedMethods)) { throw new \InvalidArgumentException('Provided metho...
php
{ "resource": "" }
q240867
Signature.getNonce
train
public function getNonce() { if ($this->nonce !== '') { return $this->nonce; } $this->nonce = md5(uniqid(rand(), true)); return $this->nonce; }
php
{ "resource": "" }
q240868
Signature.setTimestamp
train
public function setTimestamp($timestamp = 0) { $this->timestamp = $timestamp; if ($timestamp === 0) { $this->timestamp = $this->generateTimestamp(); } return $this; }
php
{ "resource": "" }
q240869
AnnotationManagerFactory.createService
train
public function createService(ServiceLocatorInterface $serviceLocator) { $annotationManager = new AnnotationManager(); $parser = new DoctrineAnnotationParser(); foreach ($this->defaultAnnotations as $annotationName) { $class = 'TjoAnnotationRouter\\Annotation\\' . $annotationNa...
php
{ "resource": "" }
q240870
TimeEntry.setTask
train
public function setTask($task) { $taskCode = filter_var($task, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); if (strpos($taskCode, '-') !== false) { $taskCode = str_replace('-', '', $taskCode); } $taskCode = $this->project . $taskCode; $this->task = $...
php
{ "resource": "" }
q240871
TimeEntry.processTags
train
public function processTags($tags = null) { if (empty($tags)) { $tags = $this->tags; } foreach ($tags as $tag) { $this->tags[] = $tag; if (preg_match('/[A-Z]+\-[\d]+/', $tag)) { $this->setTicket($tag); continue; ...
php
{ "resource": "" }
q240872
StorageboxMethod.startRestoreService
train
private function startRestoreService( StorageboxData $data, $backupKey, Database $database, OutputInterface $output) { $stackName = $data->getBackup()->getStackName(); $restoreService = new Service(); $restoreService->setImage('ipunktbs/xtrabackup:1.1.1'); $restoreService->setName('restore-'.$backupKey); $re...
php
{ "resource": "" }
q240873
StorageboxMethod.startNewService
train
private function startNewService(Service $restoreService,StorageboxData $data, $backupKey, OutputInterface $output) { $stackName = $data->getBackup()->getStackName(); $restoreServiceName = $restoreService->getName(); $dockerCompose = [ 'version' => '2', 'services' => array_merge( [$data->getBackup()->g...
php
{ "resource": "" }
q240874
ContentBase.prepareI18nModels
train
public function prepareI18nModels() { $mI18n = $this->getJoined()->all(); $modelsI18n = []; foreach ($mI18n as $modelI18n) { $modelI18n->correctSelectedText(); $modelsI18n[$modelI18n->lang_code] = $modelI18n; } foreach ($this->languages as $langCode =>...
php
{ "resource": "" }
q240875
Setting.errors
train
public function errors($field = null, $errors = null, $overwrite = false) { if (isset($this->_properties['scope'])) { $this->_errors = []; } return parent::errors($field, $errors, $overwrite); }
php
{ "resource": "" }
q240876
RepositoryDispatcher.addRepository
train
public function addRepository(RepositoryInterface $repository) { if ($repository instanceof IssueRepository) { $type = 'issue'; } else { throw new \Exception('Unknown repository type.'); } $this->repositories[$type] = $repository; }
php
{ "resource": "" }
q240877
Help.addArgument
train
public function addArgument($shortName = '', $fullName = '', $description = '', $hasValue = false, $isMandatory = false) { $argument = new \stdClass(); $argument->shortName = $shortName; $argument->fullName = $fullName; $argument->description = $description; $argument->hasVal...
php
{ "resource": "" }
q240878
EarthIT_CMIPREST_ResultAssembler_NOJResultAssembler._q45
train
protected function _q45( EarthIT_Schema_ResourceClass $rc, array $items ) { $restObjects = array(); $keyByIds = $this->shouldKeyRestItemsById($rc); foreach( $items as $item ) { $restItem = $this->internalObjectToRest($rc, $item); if( $keyByIds ) { $restObjects[EarthIT_Storage_Util::itemId($item,$rc)] = ...
php
{ "resource": "" }
q240879
ViewController.addAssets
train
protected function addAssets() { $this->assets = ViewService::getAssetManager(); $this->assets ->addCss(__DIR__ . '/../../assets/common/dist/common.css') ->addJs(__DIR__ . '/../../assets/common/dist/common.js') ->entry('teamelf/common/main'); }
php
{ "resource": "" }
q240880
EntityManager.buildDataRequestQuery
train
public function buildDataRequestQuery(DataRequest $dataRequest, QueryBuilder $queryBuilder, $entity, $tableCode) { $queryBuilder->select($tableCode) ->from($entity, $tableCode); $hasWhere = false; $i = 1; foreach ($dataRequest->getFilters() as $filter) {...
php
{ "resource": "" }
q240881
Server.run
train
public static function run($cwd = null, array $index = ['html', 'php'], $front = '/index.php') { if ($cwd === null) { $cwd = getcwd(); } $file = self::getFilePath($cwd, $index); //The file does not exists if ($file === false) { return false; ...
php
{ "resource": "" }
q240882
Server.getRequestPath
train
public static function getRequestPath() { if (empty($_SERVER['REQUEST_URI'])) { return false; } $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); return empty($path) ? $path : urldecode($path); }
php
{ "resource": "" }
q240883
Server.getFilePath
train
public static function getFilePath($cwd, array $index) { $path = self::getRequestPath(); if ($path === false) { return false; } $file = $cwd.$path; if (is_file($file)) { return $file; } if (empty($index)) { return false;...
php
{ "resource": "" }
q240884
Dispatcher.handle
train
public function handle( \AltoRouter $router, \PowerOn\Network\Request $request ) { $match = $router->match($request->path); if ( $match ) { $target = explode('#', $match['target']); $this->controller = $target[0]; $this->action = key_exists(1, $target) ? $target[1] : ...
php
{ "resource": "" }
q240885
Dispatcher.force
train
public function force($request_controller, $request_action = 'index') { $this->controller = $request_controller; $this->action = $request_action; $handler = $this->loadController(); if ( !$handler ) { throw new LogicException(sprintf('No se existe la clase d...
php
{ "resource": "" }
q240886
Dispatcher.loadController
train
private function loadController() { $controller_name = Inflector::classify($this->controller) . 'Controller'; $controller_class = $this->controller === 'system' ? 'PowerOn\\Controller\\CoreController' : 'App\\Controller\\' . $controller_name; if ( !class_exists($controller_class) ) { ...
php
{ "resource": "" }
q240887
Request.getParameter
train
public function getParameter($as = self::AS_STRING) { if ($as == self::AS_SIMPLEXML) { //convert to SimpleXMLElement $success = simplexml_load_string($this->parameter); if ($success === false) { $error = libxml_get_last_error(); throw new \RuntimeException("XML Syntax error: " . $error->message)...
php
{ "resource": "" }
q240888
HeaderOnReadyManager.makeAdd
train
public function makeAdd(){ if(OWEB_DEBUG > 0) $code .= $this->makeAddNormal (); else $code .= $this->makeAddNormal (); Headers::getInstance()->addHeader($code, Headers::jsCode); }
php
{ "resource": "" }
q240889
HeaderOnReadyManager.makeAddDebug
train
public function makeAddDebug(){ $s = ""; foreach ($this->headers as $code){ $s .= '$( document ).ready(function() {'."\n"; $s .= $code; $s .= "\n});\n\n"; } return $s; }
php
{ "resource": "" }
q240890
HeaderOnReadyManager.makeAddNormal
train
public function makeAddNormal(){ $s = "var oweb_ready = function (){"; foreach ($this->headers as $code) $s .= $code."\n\n"; $s .= "}\n\n"; $s .= '$( document ).ready(function() {'."\n"; $s .= "oweb_ready(); \n"; $s .= "\n});\n\n"; return $s; }
php
{ "resource": "" }
q240891
PreCompileCommand.execute
train
protected function execute(InputInterface $input, OutputInterface $output) { $this->validateCommand($input); $output->writeln('> Loading configuration file'); $config = $input->getOption('config'); $files = (new ConfigResolver())->getFileList($config); $output->writeLn('- Fo...
php
{ "resource": "" }
q240892
PreCompileCommand.getOptions
train
protected function getOptions(InputInterface $input) { return [ 'dir' => (bool) $input->getOption('fix_dir'), 'file' => (bool) $input->getOption('fix_file'), 'skip' => (bool) $input->getOption('skip_dir_file'), 'strict' => (bool) $input->getOption('stri...
php
{ "resource": "" }
q240893
AuthPanel.&
train
public function & getViewData () { if ($this->view !== NULL) return $this->view; $user = & \MvcCore\Ext\Auths\Basic::GetInstance()->GetUser(); $authenticated = $user instanceof \MvcCore\Ext\Auths\Basics\IUser; $this->view = (object) [ 'user' => $user, 'authenticated' => $authenticated, ]; return $th...
php
{ "resource": "" }
q240894
Repository.find
train
public function find($find, $column = 'id', array $relations = [], array $columns = ['*']) { $this->model = $this->where($column, $find); $this->model = $this->relation->apply($this->model, $this, $relations); return $this->model->firstOrFail($columns); }
php
{ "resource": "" }
q240895
Repository.findWith
train
public function findWith($find, array $with = [], $column = 'id', array $columns = ['*']) { return $this->whereWith($find, $column, $with)->firstOrFail($columns); }
php
{ "resource": "" }
q240896
Repository.onlyFillable
train
public function onlyFillable(array $input) { $result = array_intersect_key($input, array_flip($this->modelInstance->getFillable())); foreach ($this->avoidEmptyUpdate as $avoid) { if (array_key_exists($avoid, $result) && empty($result[$avoid])) { unset($result[$avoid]); ...
php
{ "resource": "" }
q240897
Repository.whereWith
train
protected function whereWith($find, $column, $with, $where_role = '=') { $this->where($column, $where_role, $find); $this->with($with); return $this->model; }
php
{ "resource": "" }
q240898
PathManager.get
train
public function get($type, $file = null) { if (!isset($this->paths[$type])) { $method = 'get'.Utils::camelize($type).'Dir'; if (!method_exists($this, $method)) { return null; } $this->set($type, $this->$method()); } $path = $...
php
{ "resource": "" }
q240899
Lexer.isNextToken
train
public function isNextToken($token, $ignoreSpaces = true) { if($this->pos >= $this->len) { return Tokens::T_END == $token; } switch($token) { case Tokens::T_END: return false; case Tokens::T_OPERATOR: return $this->isNe...
php
{ "resource": "" }