_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q252700
Mail.attachFile
validation
public function attachFile(string $sFileName, string $sContent, string $sType) : bool { $this->_aAttachments[] = array( "name" => $sFileName, "content" => $sContent, "type" => $sType ); return true; }
php
{ "resource": "" }
q252701
Mail.send
validation
public function send() : bool { $sHeaders = 'From: ' . $this->_sFrom . "\r\n"; if (empty($this->_aAttachments)) { if ($this->_sFormat == "HTML") { $sHeaders .= 'MIME-Version: 1.0' . "\r\n"; $sHeaders .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; } return mail(implode(',', $th...
php
{ "resource": "" }
q252702
ExceptionHandler.enable
validation
public static function enable($state = true, $enable_assert = false){ $state = (bool) $state; self::enableAssert((bool) $enable_assert); if($state && self::$_enabled || !$state && !self::$_enabled){ return; } if($state){ set_exception_handler(__CLASS__ . '::exception'); set_error_handler(__CLAS...
php
{ "resource": "" }
q252703
ExceptionHandler.notice
validation
public static function notice($message){ // Remove all superfluous white-spaces for increased readability $message = preg_replace('/\s+/', ' ', $message); static::writeLogLine('Notices.log', $message); trigger_error($message, E_USER_NOTICE); }
php
{ "resource": "" }
q252704
ExceptionHandler.exception
validation
public static function exception($Throwable){ // Dump all output buffers while(@ob_end_clean()); try{ // Command-line interface if(PHP_SAPI == 'cli'){ $message = BaseException::displayConsoleException($Throwable); if(@fwrite(STDERR, $message) === false) echo $message; } // HTTP/1.1 ...
php
{ "resource": "" }
q252705
ExceptionHandler.error
validation
public static function error($severity, $message, $file, $line){ // Respect the "@" error suppression operator if(error_reporting() == 0) return; elseif(error_reporting() && $severity){ $ErrorException = new PHPErrorException( $message, 0, $severity, $file, $line); // If we're in an assert()-chain,...
php
{ "resource": "" }
q252706
ExceptionHandler.assert
validation
public static function assert($file, $line, $expression){ $Exception = new PHPAssertionFailed( '', 0, null, $file, $line, $expression); // Try FireLogger (only if not yet involved) if(assert_options(ASSERT_BAIL)){ // Terminate execution after failed assertion (ASSERT_BAIL) self::exception($Exception...
php
{ "resource": "" }
q252707
ExceptionHandler.writeLogLine
validation
public static function writeLogLine($log_file, $input, $timestamp = null){ if(is_null(self::$_error_folder)){ return false; } // Prevent people from escaping the pre-defined folder $log_file = basename($log_file); $fp = @fopen(self::$_error_folder . $log_file, 'ab'); // NOSONAR if(!$fp){ return ...
php
{ "resource": "" }
q252708
ClearView.init
validation
public function init(array $viewDirs, array $params) { $this->viewDirs = $viewDirs; $this->params = $params; $this->parts = new ClearViewPartsCollection(); }
php
{ "resource": "" }
q252709
ResponseResourceController.index
validation
public function index(ResponseRequest $request) { $view = $this->response->theme->listView(); if ($this->response->typeIs('json')) { $function = camel_case('get-' . $view); return $this->repository ->setPresenter(\Litecms\Forum\Repositories\Presenter\Response...
php
{ "resource": "" }
q252710
ResponseResourceController.show
validation
public function show(ResponseRequest $request, Response $response) { if ($response->exists) { $view = 'forum::response.show'; } else { $view = 'forum::response.new'; } return $this->response->title(trans('app.view') . ' ' . trans('forum::response.name')) ...
php
{ "resource": "" }
q252711
ResponseResourceController.store
validation
public function store(ResponseRequest $request) { try { $request = $request->all(); $slug = $request['slug']; $attributes['comment'] = $request['comment']; $attributes['question_id'] = $request['question_id']; $attributes['user_id']...
php
{ "resource": "" }
q252712
ResponseResourceController.edit
validation
public function edit(ResponseRequest $request, Response $response) { return $this->response->title(trans('app.edit') . ' ' . trans('forum::response.name')) ->view('forum::response.edit', true) ->data(compact('response')) ->output(); }
php
{ "resource": "" }
q252713
ResponseResourceController.update
validation
public function update(ResponseRequest $request, Response $response) { try { $attributes = $request->all(); $id = $attributes['question_id']; $question = $this->question->selectquestion($id); $response->update($attributes); return redirect('/disc...
php
{ "resource": "" }
q252714
ResponseResourceController.destroy
validation
public function destroy(ResponseRequest $request, Response $response) { try { $id = $response['question_id']; $question = $this->question->selectquestion($id); $response->delete(); return redirect('/discussion/'.$question['slug']); } catch (Except...
php
{ "resource": "" }
q252715
ObjectViewEvent.setObject
validation
public function setObject($object) { if (is_null($this->_objectType)) { $this->objectType = $object->objectType; } $this->_object = $object; }
php
{ "resource": "" }
q252716
ObjectViewEvent.setObjectType
validation
public function setObjectType($type) { if (!is_object($type)) { if (Yii::$app->collectors['types']->has($type)) { $type = Yii::$app->collectors['types']->getOne($type)->object; } else { $type = null; } } $this->_objectType =...
php
{ "resource": "" }
q252717
Benri_Auth.authenticate
validation
public function authenticate(Zend_Auth_Adapter_Interface $adapter) { // Authenticates against the supplied adapter. $result = $adapter->authenticate(); /* * ZF-7546 - prevent multiple succesive calls from storing inconsistent * results. * * Ensure storage...
php
{ "resource": "" }
q252718
Theme.boot
validation
public function boot(Plugin $theme) { $this->plugin = $theme; parent::boot($theme); $this->initTemplates(); $this->initHomepageTemplate(); return $this; }
php
{ "resource": "" }
q252719
Theme.addTemplateSlots
validation
public function addTemplateSlots($templateName, $username) { if (!array_key_exists($templateName, $this->templateBlocks)) { return null; } $blocks = $this->templateBlocks[$templateName]; $this->addSlots($blocks, $username); }
php
{ "resource": "" }
q252720
Client.send
validation
protected function send(RequestInterface $request): ResponseInterface { $request = $request->withHeader("Authorization", sprintf("Bearer %s", $this->apiToken)); $request = $request->withHeader("Content-Type", "application/json"); $request = $request->withHeader("Accept", "application/json");...
php
{ "resource": "" }
q252721
Client.getJsonBody
validation
private function getJsonBody(RequestInterface $request, ResponseInterface $response): array { $data = json_decode($response->getBody(), true); if (!$data || !is_array($data) || !array_key_exists("data", $data)) { throw new ClientException("Response body does not contain a valid JSON obje...
php
{ "resource": "" }
q252722
Deployer.save
validation
public function save(BlockManagerApprover $approver, array $options, $saveCommonSlots = true) { $this->contributorDefined(); $filesystem = new Filesystem(); $pageDir = $this->pagesDir . '/' . $options["page"]; $filesystem->copy($pageDir . '/' . $this->pageFile, $pageDir . '/page.jso...
php
{ "resource": "" }
q252723
Deployer.saveAllPages
validation
public function saveAllPages(BlockManagerApprover $approver, array $languages, $saveCommonSlots = true) { $this->contributorDefined(); $finder = new Finder(); $pages = $finder->directories()->depth(0)->in($this->pagesDir); foreach ($pages as $page) { $page = (string)$pag...
php
{ "resource": "" }
q252724
Container.getFactory
validation
public function getFactory($class, array $params = array()) { if (!isset($this->factories[$class]) && $this->autowire) { $this->factories[$class] = Definition::getDefaultForClass($class); } $factory = $this->factories[$class]; // if $params is defined, we need to either make a copy of the existing // Fa...
php
{ "resource": "" }
q252725
Container.getFunctionArguments
validation
protected function getFunctionArguments(ReflectionFunctionAbstract $func, array $params = array()) { $args = []; foreach ($func->getParameters() as $param) { $class = $param->getClass(); if ($class) { $args[] = $this->resolveClassArg($class, $param, $params); } else { $args[] = $this->resolveNon...
php
{ "resource": "" }
q252726
Container.resolveClassArg
validation
protected function resolveClassArg(ReflectionClass $class, ReflectionParameter $param, array $params) { $name = '$'.$param->getName(); $class = $class->getName(); // loop to prevent code repetition. executes once trying to find the // parameter name in the $params array, then once more trying to find // the...
php
{ "resource": "" }
q252727
Container.resolveNonClassArg
validation
protected function resolveNonClassArg(ReflectionParameter $param, array $params, ReflectionFunctionAbstract $func) { $name = '$'.$param->getName(); if ($params && array_key_exists($name, $params)) { $argument = $params[$name]; if (is_array($argument) && isset($this->factories[$argument[0]])) { $argumen...
php
{ "resource": "" }
q252728
Container.callResolvingCallbacks
validation
protected function callResolvingCallbacks($key, $object) { foreach ($this->resolvingAnyCallbacks as $callback) { call_user_func($callback, $object, $this); } if (isset($this->resolvingCallbacks[$key])) { foreach ($this->resolvingCallbacks[$key] as $callback) { call_user_func($callback, $object, $this)...
php
{ "resource": "" }
q252729
Session.setName
validation
public function setName(string $name): void { if (!empty($name)) { if (!is_numeric($name)) { @session_name($name); } else { throw new Exception('The session name can\'t consist only of digits, ' .'at least one letter must be presented.'...
php
{ "resource": "" }
q252730
Session.start
validation
public function start(?string $name = null, ?string $sessionId = null): string { if (!$this->isStarted()) { if (!is_null($name)) { $this->setName($name); } @session_start($sessionId); }; return $this->getId(); }
php
{ "resource": "" }
q252731
Session.destroyWithCookie
validation
public function destroyWithCookie(): ?bool { if ($this->isStarted()) { $this->destroy(); return setcookie($this->getName(), '', time() - 1, '/'); } return null; }
php
{ "resource": "" }
q252732
Session.getAll
validation
public function getAll(): array { $res = []; foreach ($this->getKeys() as $key) { $res[$key] = $this->get($key); } return $res; }
php
{ "resource": "" }
q252733
Session.remove
validation
public function remove(string $key) { if ($this->contains($key)) { $res = $_SESSION[$key]; unset($_SESSION[$key]); return $res; } else { return null; } }
php
{ "resource": "" }
q252734
Session.removeAll
validation
public function removeAll(): array { $res = []; foreach ($this->getKeys() as $key) { $res[$key] = $this->remove($key); } return $res; }
php
{ "resource": "" }
q252735
DataLogger.log
validation
public static function log($message, $type = DataLogger::INFO) { if (null === self::$logger) { return; } if (!method_exists(self::$logger, $type)) { $exceptionMessage = sprintf('Logger does not support the %s method.', $type); throw new \InvalidArgumentE...
php
{ "resource": "" }
q252736
ShowPageCollectionController.showAction
validation
public function showAction(Request $request, Application $app) { $options = array( "request" => $request, "configuration_handler" => $app["red_kite_cms.configuration_handler"], "page_collection_manager" => $app["red_kite_cms.page_collection_manager"], 'form_fa...
php
{ "resource": "" }
q252737
LoadTime.end
validation
public static function end() { if (self::$startTime) { $time = round((microtime(true) - self::$startTime), 4); self::$startTime = false; } return (isset($time)) ? $time : false; }
php
{ "resource": "" }
q252738
Benri_Db_Table.all
validation
public static function all($pageNumber = 0, $pageSize = 10, $order = null) { return (new static()) ->fetchAll(null, $order, $pageSize, $pageNumber); }
php
{ "resource": "" }
q252739
Benri_Db_Table.locate
validation
public static function locate($column, $value) { $table = new static(); $select = $table->select() ->where("{$table->getAdapter()->quoteIdentifier($column)} = ?", $value) ->limit(1); return $table->fetchRow($select); }
php
{ "resource": "" }
q252740
Benri_Db_Table.bulkInsert
validation
public static function bulkInsert(array $batch) { $table = new static(); if (1 === sizeof($batch)) { return $table->insert(array_shift($batch)); } $adapter = $table->getAdapter(); $counter = 0; $sqlBinds = []; $values = []; /...
php
{ "resource": "" }
q252741
Benri_Db_Table._setupDatabaseAdapter
validation
protected function _setupDatabaseAdapter() { if (Zend_Registry::isRegistered('multidb')) { return $this->_setAdapter(Zend_Registry::get('multidb')->getDb($this->_connection)); } return parent::_setupDatabaseAdapter(); }
php
{ "resource": "" }
q252742
Aura.loadContainer
validation
protected function loadContainer(array $config = [], $environment = null) { $containerConfigs = $this->provideContainerConfigs($config, $environment); array_unshift( $containerConfigs, new WeaveConfig( function ($pipelineName) { return $this->provideMiddlewarePipeline($pipelineName); }, func...
php
{ "resource": "" }
q252743
CommentController.showAction
validation
public function showAction(Comment $comment) { $deleteForm = $this->createDeleteForm($comment); return array( 'entity' => $comment, 'delete_form' => $deleteForm->createView(), ); }
php
{ "resource": "" }
q252744
CommentController.createDeleteForm
validation
private function createDeleteForm(Comment $comment) { return $this->createFormBuilder() ->setAction($this->generateUrl('blog_comment_delete', array('id' => $comment->getId()))) ->setMethod('DELETE') ->getForm() ; }
php
{ "resource": "" }
q252745
SlotMap.setSlots
validation
public function setSlots($first, $last, $connection) { if (!static::isValidRange($first, $last)) { throw new \OutOfBoundsException("Invalid slot range $first-$last for `$connection`"); } $this->slots += array_fill($first, $last - $first + 1, (string) $connection); }
php
{ "resource": "" }
q252746
SlotMap.getSlots
validation
public function getSlots($first, $last) { if (!static::isValidRange($first, $last)) { throw new \OutOfBoundsException("Invalid slot range $first-$last"); } return array_intersect_key($this->slots, array_fill($first, $last - $first + 1, null)); }
php
{ "resource": "" }
q252747
SlotMap.offsetSet
validation
public function offsetSet($slot, $connection) { if (!static::isValid($slot)) { throw new \OutOfBoundsException("Invalid slot $slot for `$connection`"); } $this->slots[(int) $slot] = (string) $connection; }
php
{ "resource": "" }
q252748
Guard.serve
validation
public function serve() { Log::debug('Request received:', [ 'Method' => $this->request->getMethod(), 'URI' => $this->request->getRequestUri(), 'Query' => $this->request->getQueryString(), 'Protocal' => $this->request->server->get('SERVER_PROTOCOL'), ...
php
{ "resource": "" }
q252749
Guard.validate
validation
public function validate($token) { $params = [ $token, $this->request->get('timestamp'), $this->request->get('nonce'), ]; if (!$this->debug && $this->request->get('signature') !== $this->signature($params)) { throw new FaultException('Invalid ...
php
{ "resource": "" }
q252750
Guard.parseMessageFromRequest
validation
protected function parseMessageFromRequest($content) { $content = strval($content); $dataSet = json_decode($content, true); if ($dataSet && (JSON_ERROR_NONE === json_last_error())) { // For mini-program JSON formats. // Convert to XML if the given string can be decod...
php
{ "resource": "" }
q252751
Parser.parse
validation
public static function parse($program) { $i = 0; $len = strlen($program); $forms = []; while ($i < $len) { if (strpos(self::WHITESPACES, $program[$i]) === false) { try { $form = self::parseExpression(substr($program, $i), $offset); if (!is_null($form)) $forms[] = $form; } catch (Pa...
php
{ "resource": "" }
q252752
Parser.unescapeString
validation
protected static function unescapeString($matches) { static $map = ['n' => "\n", 'r' => "\r", 't' => "\t", 'v' => "\v", 'f' => "\f"]; if (!empty($matches[2])) return chr(octdec($matches[2])); elseif (!empty($matches[3])) return chr(hexdec($matches[3])); elseif (isset($map[$matches[1]])) return $map[...
php
{ "resource": "" }
q252753
RecoveryController.actionRequest
validation
public function actionRequest() { if (!$this->module->enablePasswordRecovery) { throw new NotFoundHttpException; } $model = \Yii::createObject([ 'class' => RecoveryForm::className(), 'scenario' => 'request', ]); $this->performAjaxValid...
php
{ "resource": "" }
q252754
RecoveryController.actionReset
validation
public function actionReset($id, $code) { if (!$this->module->enablePasswordRecovery) { throw new NotFoundHttpException; } /** @var Token $token */ $token = $this->finder->findToken(['user_id' => $id, 'code' => $code, 'type' => Token::TYPE_RECOVERY])->one(); if ...
php
{ "resource": "" }
q252755
PsrRequestAdapter.getNamedParams
validation
public function getNamedParams(string $category = null) : array { switch($category) { case 'attribute': return $this->request->getAttributes(); case 'query': return $this->request->getQueryParams(); case 'uploaded_files': ...
php
{ "resource": "" }
q252756
PsrRequestAdapter.getNamedParam
validation
public function getNamedParam(string $category, string $key) { $params = $this->getNamedParams($category); return $params[$key] ?? ''; }
php
{ "resource": "" }
q252757
SEO_Icons_SiteTree_DataExtension.updateMetadata
validation
public function updateMetadata(SiteConfig $config, SiteTree $owner, &$metadata) { //// HTML4 Favicon // @todo Perhaps create dynamic image, but just use favicon.ico for now //// Create Favicons $HTML5Favicon = $config->HTML5Favicon(); $IOSPinicon = $config->IOSPinicon(); ...
php
{ "resource": "" }
q252758
SEO_Icons_SiteTree_DataExtension.GenerateIOSPinicon
validation
protected function GenerateIOSPinicon(SiteConfig $config, SiteTree $owner, &$metadata, Image $IOSPinicon) { // header $metadata .= $this->owner->MarkupComment('iOS Pinned Icon'); //// iOS Pinicon Title if ($config->fetchPiniconTitle()) { $metadata .= $owner->MarkupMeta('app...
php
{ "resource": "" }
q252759
SEO_Icons_SiteTree_DataExtension.GenerateHTML5Favicon
validation
protected function GenerateHTML5Favicon(SiteTree $owner, &$metadata, Image $HTML5Favicon) { // header $metadata .= $owner->MarkupComment('HTML5 Favicon'); // // Android Chrome 32 // @todo: Is the Android Chrome 32 196x196 px icon fully redundant ?? // $metadata .= $owner->MarkupLink('icon'...
php
{ "resource": "" }
q252760
SEO_Icons_SiteTree_DataExtension.GenerateAndroidPinicon
validation
protected function GenerateAndroidPinicon(SiteConfig $config, SiteTree $owner, &$metadata) { // header $metadata .= $owner->MarkupComment('Android Pinned Icon'); // if ($config->fetchAndroidPiniconThemeColor()) { $metadata .= $owner->MarkupMeta('theme-color', $config->fetch...
php
{ "resource": "" }
q252761
SEO_Icons_SiteTree_DataExtension.GenerateWindowsPinicon
validation
protected function GenerateWindowsPinicon(SiteConfig $config, SiteTree $owner, &$metadata, Image $WindowsPinicon) { // header $metadata .= $owner->MarkupComment('Windows Pinned Icon'); // application name $appName = $config->fetchPiniconTitle(); if (!$appName) { $ap...
php
{ "resource": "" }
q252762
EventMediator.off
validation
public function off($eventType, $listener = null) { foreach ($this->_eventListeners as $i => $l) { if ($l->getType() == $eventType) { if ($listener === null || $l->getListener() === $listener) { unset($this->_eventListeners[$i]); } ...
php
{ "resource": "" }
q252763
AuditPackage.get
validation
public function get($name) { return isset($this->_items[$name]) ? $this->_items[$name] : null; }
php
{ "resource": "" }
q252764
BotDomParser.parseBotNames
validation
public function parseBotNames() { $dom = $this->getDom('https://udger.com/resources/ua-list/crawlers'); if (false === $dom) { throw new Exception("Fail to load bot list DOM.", E_WARNING); } $crawler = new Crawler(); $crawler->addContent($dom); $crawler->filter('body #container table tr t...
php
{ "resource": "" }
q252765
BotDomParser.parseBotUA
validation
public function parseBotUA($botName) { $dom = $this->getDom('https://udger.com/resources/ua-list/bot-detail?bot=' . $botName); if (false === $dom) { echo "Can not parse DOM" . PHP_EOL; return false; } $this->currentBotName = $botName; $crawlerBot = new Crawler(); $crawlerBot->addCo...
php
{ "resource": "" }
q252766
BotDomParser.getDom
validation
private function getDom($url) { $ch = curl_init(); $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $dom = curl_exec($ch); curl_close($ch); return $dom; }
php
{ "resource": "" }
q252767
FileResolver.resolve
validation
public function resolve($templatePath) { $templatePathReal = realpath($templatePath); if ($templatePathReal === false) { throw new \Exception( 'Template file does not exist: ' . $templatePath ); } if ($this->hasCache($templatePathReal)) { ...
php
{ "resource": "" }
q252768
LaravelHelpersServiceProvider.registerPackageHelpers
validation
public function registerPackageHelpers() { foreach($this->packageHelpers as $helper) { $dashName = last(explode('/', $helper)); $underscoreName = str_replace('-', '_', $dashName); if(in_array('*', $this->packageInclude) || in_array($dashName, $thi...
php
{ "resource": "" }
q252769
LaravelHelpersServiceProvider.registerCustomHelpers
validation
public function registerCustomHelpers() { foreach(glob(app_path($this->namespace.'/*')) as $helper) { $helperName = last(explode('/', $helper)); if(!in_array($helperName, $this->customExclude)) { if(in_array('*', $this->customInclude) || in_array($...
php
{ "resource": "" }
q252770
LaravelHelpersServiceProvider.replaceVariables
validation
public function replaceVariables($string, $replaces = []) { $callback = function ($match) use ($replaces) { $variable = trim($match[0], '{}'); if(array_key_exists($variable, $replaces)) { return $replaces[$variable]; } return $var...
php
{ "resource": "" }
q252771
Path.setPermissions
validation
public static function setPermissions($path, $mode=0777, $recursive=true) { $path = Path::clean($path); $fs = new Filesystem(); try { $fs->chmod($path, $mode, 0000, $recursive); } catch(IOExceptionInterface $e){ return false; } return true; }
php
{ "resource": "" }
q252772
FilesystemTools.slotDir
validation
public static function slotDir($sourceDir, array $options) { $paths = array( sprintf( '%s/pages/pages/%s/%s_%s/%s', $sourceDir, $options['page'], $options['language'], $options['country'], $options['s...
php
{ "resource": "" }
q252773
FilesystemTools.cascade
validation
public static function cascade(array $folders) { $result = null; foreach ($folders as $folder) { if (is_dir($folder)) { $result = $folder; break; } } return $result; }
php
{ "resource": "" }
q252774
FilesystemTools.readFile
validation
public static function readFile($file) { if (!file_exists($file)) { return null; } $handle = fopen($file, 'r'); if (!self::lockFile($handle, LOCK_SH | LOCK_NB)) { $exception = array( "message" => 'exception_file_cannot_be_locked_for_reading', ...
php
{ "resource": "" }
q252775
FilesystemTools.writeFile
validation
public static function writeFile($file, $content) { $handle = fopen($file, 'w'); if (!self::lockFile($handle, LOCK_EX | LOCK_NB)) { $exception = array( "message" => 'exception_file_cannot_be_locked_for_writing', "parameters" => array( "...
php
{ "resource": "" }
q252776
ModuleSetExtension.bootstrap
validation
public function bootstrap($app) { Yii::beginProfile(get_called_class()); Yii::$app->modules = static::getModules(); Yii::$app->on(\yii\base\Application::EVENT_BEFORE_REQUEST, [$this, 'beforeRequest']); Yii::endProfile(get_called_class()); Yii::trace("Registered " . count(stat...
php
{ "resource": "" }
q252777
Time.cast
validation
public static function cast($time) { return $time instanceof self ? $time : new self($time->format(self::ISO8601), $time->getTimezone()); }
php
{ "resource": "" }
q252778
HttpRequest.get
validation
public function get($name, $default = "") { $param = Arr::get($_REQUEST, $name, $default); if ($_SERVER["REQUEST_METHOD"] == "GET" && is_string($param)) { $param = urldecode($param); } return $param; }
php
{ "resource": "" }
q252779
Generator.setItems
validation
public function setItems($items) { $this->_items = $items; if (isset($this->_items[0]) && is_array($this->_items[0])) { $this->_items = $this->_items[0]; } foreach ($this->_items as $item) { $item->owner = $this; if (!$item->isValid) { ...
php
{ "resource": "" }
q252780
BlockManagerAdd.add
validation
public function add($sourceDir, array $options, $username) { $this->resolveAddOptions($options); $this->createContributorDir($sourceDir, $options, $username); $dir = $this ->init($sourceDir, $options, $username) ->getDirInUse() ; $blockName = $this->a...
php
{ "resource": "" }
q252781
BlockManagerAdd.resolveAddOptions
validation
protected function resolveAddOptions(array $options) { if ($this->optionsResolved) { // @codeCoverageIgnoreStart return; // @codeCoverageIgnoreEnd } $this->optionsResolver->clear(); $this->optionsResolver->setRequired( array( ...
php
{ "resource": "" }
q252782
UserService.editProfile
validation
public function editProfile($data) { /* @var $user UserInterface */ if (!($user = $this->hydrate($data, $this->getEditProfileForm()))) { return; } $eventManager = $this->getEventManager(); $eventManager->trigger(__FUNCTION__, $this, compact('user')); $this->getMa...
php
{ "resource": "" }
q252783
UserService.confirmEmail
validation
public function confirmEmail($token) { /* @var $user UserInterface */ $user = $this->getMapper()->findOneBy(['registrationToken' => $token]); if (!$user instanceof UserInterface) { return; } $eventManager = $this->getEventManager(); $eventManager->trigger...
php
{ "resource": "" }
q252784
UserService.changePassword
validation
public function changePassword($data) { /* @var $user UserInterface */ if (!($user = $this->hydrate($data, $this->getChangePasswordForm()))) { return; } $eventManager = $this->getEventManager(); $eventManager->trigger(__METHOD__, $this, $user); $password...
php
{ "resource": "" }
q252785
UserService.confirmPasswordReset
validation
public function confirmPasswordReset($token) { $user = $this->getMapper()->findOneBy(['registrationToken' => $token]); if (!$user instanceof UserInterface) { return; } $eventManager = $this->getEventManager(); $eventManager->trigger(__METHOD__, $this, $user); ...
php
{ "resource": "" }
q252786
UserService.changeEmail
validation
public function changeEmail($data) { /* @var $user UserInterface */ if (!($user = $this->hydrate($data, $this->getChangeEmailForm()))) { return; } $eventManager = $this->getEventManager(); $eventManager->trigger(__METHOD__, $this, $user); $user->setEmail...
php
{ "resource": "" }
q252787
UserService.changeSecurityQuestion
validation
public function changeSecurityQuestion($data) { /* @var $user UserInterface */ if (!($user = $this->hydrate($data, $this->getChangeSecurityQuestionForm()))) { return; } $eventManager = $this->getEventManager(); $eventManager->trigger(__METHOD__, $this, $user); ...
php
{ "resource": "" }
q252788
Service.addGroup
validation
public function addGroup(Group $group) { $group->setService($this); $this->groups[$group->getName()] = $group; }
php
{ "resource": "" }
q252789
Service.getGroup
validation
public function getGroup($name) { if (array_key_exists($name, $this->groups)) { return $this->groups[$name]; } throw new KeyNotFoundInSetException($name, array_keys($this->groups), 'groups'); }
php
{ "resource": "" }
q252790
AuthenticateEvent.onExecuteAction
validation
public function onExecuteAction(ExecuteActionEvent $event){ $request=$event->getRequest(); $authenticate=$request->getConfig()->getObject('authenticate'); if($authenticate){ $this->execute($event,$authenticate); } }
php
{ "resource": "" }
q252791
Manager.preencherLista
validation
private function preencherLista($pagamentos) { $resultado = array(); foreach ($pagamentos as $pagamento) { $resultado[] = $pagamento->setAutenticacao($this->getAutenticacaoManager()->obterAutenticacaoBasica($pagamento->getAutenticacaoId())); } return $resultado; }
php
{ "resource": "" }
q252792
ConsignmentManager.saveConsignment
validation
public function saveConsignment(ConsignmentInterface $consignment) { $adapter = $this->getAdapter($consignment); $event = new EventConsignment($consignment); $this->eventDispatcher->dispatch(Events::PRE_CONSIGNMENT_SAVE, $event); if (! $consignment->getStatus()) { $cons...
php
{ "resource": "" }
q252793
ConsignmentManager.removeConsignment
validation
public function removeConsignment(ConsignmentInterface $consignment) { $adapter = $this->getAdapter($consignment); $event = new EventConsignment($consignment); $this->eventDispatcher->dispatch(Events::PRE_CONSIGNMENT_REMOVE, $event); if ($consignment->getStatus() != ConsignmentStatu...
php
{ "resource": "" }
q252794
ConsignmentManager.dispatch
validation
public function dispatch(DispatchConfirmationInterface $dispatchConfirmation) { try { $event = new EventDispatchConfirmation($dispatchConfirmation); $this->eventDispatcher->dispatch(Events::PRE_CONSIGNMENTS_DISPATCH, $event); $adapter = $this->getAdapter($dispatchConfirm...
php
{ "resource": "" }
q252795
ConsignmentManager.cancelConsignment
validation
public function cancelConsignment(ConsignmentInterface $consignment) { $adapter = $this->getAdapter($consignment); $event = new EventConsignment($consignment); $this->eventDispatcher->dispatch(Events::PRE_CONSIGNMENT_CANCEL, $event); try { $adapter->cancelConsignment($co...
php
{ "resource": "" }
q252796
Aggregate.getBonusTotals
validation
private function getBonusTotals($dsBegin, $dsEnd) { $query = $this->qbGetBonusTotals->build(); $conn = $query->getConnection(); $bind = [ QBGetTotals::BND_PERIOD_BEGIN => $dsBegin, QBGetTotals::BND_PERIOD_END => $dsEnd ]; $rs = $conn->fetchAll($query, ...
php
{ "resource": "" }
q252797
SettingsService.findParameter
validation
protected function findParameter($namespace, $name, $namespaceParameters) { foreach ($namespaceParameters as $namespaceParameter) { if ($namespaceParameter->getNamespace() === $namespace && $namespaceParameter->getName() === $name) { return $namespaceParameter; } ...
php
{ "resource": "" }
q252798
SettingsService.detectNamespace
validation
protected function detectNamespace($settings) { foreach ($this->options->getNamespaces() as $namespaceOptions) { $namespaceEntityClass = $namespaceOptions->getEntityClass(); if ($settings instanceof $namespaceEntityClass) { return $namespaceOptions->getName(); ...
php
{ "resource": "" }
q252799
Cookie.save
validation
public function save() { $this->modifiedTime = new \DateTime('now'); self::set( $this->namespace, base64_encode(serialize($this->instance)), $this->modifiedTime->getTimestamp() + $this->lifetime, $this->path, $this->domain, ...
php
{ "resource": "" }