_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q253500
CompilerContext.compile
validation
public function compile(callable $validator = NULL) { if(!($project = $this->getProject())) { $project = CC::get($this->getConfiguration(), CC::COMPILER_PROJECT); if(!$project) throw new CompilerException("Compilation without project settings is not possible"); } ...
php
{ "resource": "" }
q253501
CustomFieldsHelper._cacheCustomFields
validation
private function _cacheCustomFields($class) { $customFieldsGroups = $this->em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup') ->findBy(array('entity' => (is_string($class)) ? $class : get_class($class))); if (!$customFieldsGroups) { throw CustomFieldsHelp...
php
{ "resource": "" }
q253502
CustomFieldsHelper._cacheCustomFieldsGroup
validation
private function _cacheCustomFieldsGroup(CustomFieldsGroup $group) { foreach ($group->getCustomFields() as $field) { $this->cache[$group->getEntity()][$field->getSlug()] = $field; } }
php
{ "resource": "" }
q253503
CustomFieldsHelper.getCustomField
validation
public function getCustomField($class, $slug = null) { if (!$slug) { throw CustomFieldsHelperException::slugIsMissing(); } $resolveClass = (is_string($class)) ? $class : get_class($class); if (!$this->cache[$resolveClass][$slug]) { $this->_cacheCustom...
php
{ "resource": "" }
q253504
CustomFieldsHelper.renderCustomField
validation
public function renderCustomField(array $fields, $classOrCustomField, $documentType='html', $slug = null, $showIfEmpty = true) { $customField = ($classOrCustomField instanceof CustomField) ? $classOrCustomField : $this->getCustomField($classOrCustomField, $slug); $slug = $customField->getSlug(); ...
php
{ "resource": "" }
q253505
SourceDirectoryAwareTrait.addSource
validation
public function addSource($sourcePath, $useStrict=true) { if (is_link($sourcePath)) { return $this->addSource(realpath($sourcePath), $useStrict); } if (is_dir($sourcePath)) { $this->sourceDirs[] = $sourcePath; } elseif (true === $useStrict) { ...
php
{ "resource": "" }
q253506
SourceDirectoryAwareTrait.findInSourceDirs
validation
public function findInSourceDirs(Finder $finder) { foreach ($this->sourceDirs as $dir) { $finder->in($dir); } return $finder; }
php
{ "resource": "" }
q253507
PageRendererBackend.renderCmsBlocks
validation
public function renderCmsBlocks(array $blocks, $username, array $options = array()) { $tmp = array(); foreach ($blocks as $block) { $tmp[] = $this->renderCmsBlock($block, $username, $options); } return implode("\n", $tmp); }
php
{ "resource": "" }
q253508
PageRendererBackend.renderCmsBlock
validation
public function renderCmsBlock(BaseBlock $block, $username, array $options = array()) { $blockTemplate = $this->fetchTemplateBlock($block); if ($blockTemplate == "") { return ""; } $permalinks = $this->pagesParser ->contributor($username) ->parse(...
php
{ "resource": "" }
q253509
PageRendererBackend.renderSlots
validation
protected function renderSlots(Page $page, array $slots, array $options = array()) { $renderedSlots = array(); $slots = $this->dispatchSlotsEvent(RenderEvents::SLOTS_RENDERING, $page, $slots); foreach ($slots as $slotName => $slot) { if (is_string($slot)) { $rende...
php
{ "resource": "" }
q253510
PageRendererBackend.generateEventNames
validation
protected function generateEventNames($baseEventName, Page $page) { $pageName = $page->getPageName(); $language = $page->getCurrentLanguage(); return array( $baseEventName, $baseEventName . '.' . $language, $baseEventName . '.' . $pageName, $b...
php
{ "resource": "" }
q253511
PageRendererBackend.dispatchSlotsEvent
validation
protected function dispatchSlotsEvent($baseEventName, Page $page, array $slots) { $eventNames = $this->generateEventNames($baseEventName, $page); $event = new SlotsRenderingEvent($slots); foreach($eventNames as $eventName) { $event = Dispatcher::dispatch($eventName, $event); ...
php
{ "resource": "" }
q253512
Router.getRoute
validation
public function getRoute(): string { $uri = $_SERVER['REQUEST_URI']; // Extraigo la URI base si esta es diferente a / if ($this->uriBase != '/') { $uri = str_replace($this->uriBase, '/', $uri); } // Busco el caracter ? por si se pasaron parametros por GET ...
php
{ "resource": "" }
q253513
Calc.exec
validation
public function exec($calcId) { $result = []; /* collect additional data */ $dwnlCompress = $this->daoBonDwnl->getByCalcId($calcId); /* create maps to access data */ $mapById = $this->hlpDwnlTree->mapById($dwnlCompress, EBonDwnl::A_CUST_REF); $mapDepth = $this->hlpDwn...
php
{ "resource": "" }
q253514
Date.cast
validation
public static function cast($date) { return $date instanceof self ? $date : new self($date->format(self::ISO8601), $date->getTimezone()); }
php
{ "resource": "" }
q253515
Date.createFromFormat
validation
public static function createFromFormat($format, $time, $object = null) { if (empty($object)) { $object = new DateTimeZone('America/Sao_Paulo'); } return self::cast(parent::createFromFormat($format, $time, $object)); }
php
{ "resource": "" }
q253516
FileBasedFactory.getTemplatePath
validation
private function getTemplatePath($template) { if (strpos($template, '@') === false && !empty($this->defaultNamespace)) { $template .= '@' . $this->defaultNamespace; } $map = $this->buildTemplatesMap(); if (!array_key_exists($template, $map)) { ...
php
{ "resource": "" }
q253517
FileBasedFactory.buildTemplatesMap
validation
private function buildTemplatesMap() { if (!empty($this->templatesMap)) { return $this->templatesMap; } $this->templatesMap = []; foreach ($this->templatesPaths as $templatesPath => $templatesNamespace) { if (!is_readable($templatesPath)) { ...
php
{ "resource": "" }
q253518
Group.update
validation
public function update($groupId, $name) { $params = [ 'group' => [ 'id' => $groupId, 'name' => $name, ], ]; return $this->parseJSON('json', [self::API_UPDATE, $params]); ...
php
{ "resource": "" }
q253519
Group.moveUser
validation
public function moveUser($openId, $groupId) { $params = [ 'openid' => $openId, 'to_groupid' => $groupId, ]; return $this->parseJSON('json', [self::API_MEMBER_UPDATE, $params]); }
php
{ "resource": "" }
q253520
Group.moveUsers
validation
public function moveUsers(array $openIds, $groupId) { $params = [ 'openid_list' => $openIds, 'to_groupid' => $groupId, ]; return $this->parseJSON('json', [self::API_MEMBER_BATCH_UPDATE, $params]); }
php
{ "resource": "" }
q253521
BackendController.initTemplateAssetsManager
validation
protected function initTemplateAssetsManager() { $templateAssetsManager = $this->options["template_assets"]; $pluginManager = $this->options["plugin_manager"]; $templateAssetsManager ->backend() ->add($pluginManager->getAssets()) ; return $templateAss...
php
{ "resource": "" }
q253522
PreAuthorization.getCode
validation
public function getCode() { $data = [ 'component_appid' => $this->getAppId(), ]; $result = $this->parseJSON('json', [self::CREATE_PRE_AUTH_CODE, $data]); if (empty($result['pre_auth_code'])) { throw new InvalidArgumentException('Invalid response.'); ...
php
{ "resource": "" }
q253523
AbstractApp.stopCustomProcess
validation
private function stopCustomProcess(): void { if ($this->isCustomProcessSet()) { $this->getCustomProcess()->stop(); } elseif (class_exists('\extensions\core\Process')) { \extensions\core\Process::getInstance()->stop(); } }
php
{ "resource": "" }
q253524
AbstractTemplate.render
validation
public function render(array $data = null): string { $this->init($data ?? []); return trim($this->make(static::LAYOUT_NAME)) . PHP_EOL; }
php
{ "resource": "" }
q253525
AbstractTemplate.head
validation
public function head(): string { $property = static::HEAD_ASSETS_NAME . static::BLOCK_PROPERTY_SUFFIX; return isset($this->$property) ? trim($this->make(static::HEAD_ASSETS_NAME)) . PHP_EOL : PHP_EOL; }
php
{ "resource": "" }
q253526
AbstractTemplate.end
validation
public function end(): string { $property = static::END_ASSETS_NAME . static::BLOCK_PROPERTY_SUFFIX; return isset($this->$property) ? trim($this->make(static::END_ASSETS_NAME)) . PHP_EOL : PHP_EOL; }
php
{ "resource": "" }
q253527
AbstractTemplate.inset
validation
public function inset(string $block, array $vars = null): string { return trim($this->make($block, $vars)) . PHP_EOL; }
php
{ "resource": "" }
q253528
AbstractTemplate.insetIf
validation
public function insetIf(bool $condition, string $block, array $vars = null): string { return $condition ? trim($this->make($block, $vars)) . PHP_EOL : PHP_EOL; }
php
{ "resource": "" }
q253529
AbstractTemplate.loop
validation
public function loop(array $collection, string $block, string $emptyBlock = null): string { if (empty($collection)) { return isset($emptyBlock) ? trim($this->make($emptyBlock)) . PHP_EOL : PHP_EOL; } else { $items = ''; foreach ($collection as $key => $item) { ...
php
{ "resource": "" }
q253530
AbstractTemplate.make
validation
private function make(string $block, array $vars = null): string { $commonVars = static::COMMON_NAME . static::VARS_PROPERTY_SUFFIX; $blockVars = $block . static::VARS_PROPERTY_SUFFIX; $allVars = []; if (isset($this->$commonVars) && is_array($this->$commonVars)) { $allVar...
php
{ "resource": "" }
q253531
PostRepository.countTotal
validation
public function countTotal($categoryId=null) { $qb = $this->getQueryBuilder() ->select('COUNT(p)'); if(!is_null($categoryId)){ $qb->join('p.categories', 'c') ->where('c.id = :categoryId') ->setParameter('categoryId', $categoryId); } ...
php
{ "resource": "" }
q253532
PostRepository.findPost
validation
public function findPost($search) { // select $qb = $this->getQueryBuilder() ->select('p, pTrans') ->join('p.translations', 'pTrans') ; // search if (!empty($search)) { $qb->where('pTrans.title LIKE :search') ...
php
{ "resource": "" }
q253533
PostRepository.findOneLastPost
validation
public function findOneLastPost($site) { // select $qb = $this->getQueryBuilder() ->select('p.id, p.title, p.description, p.slug, p.published, i.path as image_path') ->leftJoin('p.images', 'i') ->andWhere('p.highlighted=1') ->setMaxRes...
php
{ "resource": "" }
q253534
Repository.update
validation
public function update(array $data, $id) { $resource = $this->model->find($id); if (! $resource) { return ''; } $resource->update($data); return $resource; }
php
{ "resource": "" }
q253535
Repository.delete
validation
public function delete($id) { $resource = $this->model->find($id); if (! $resource) { return ''; } return $resource->delete(); }
php
{ "resource": "" }
q253536
Repository.findBy
validation
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null, $include = null, $fields = null) { $this->builder = $this->model; if (count($criteria) == count($criteria, COUNT_RECURSIVE)) { if (count($criteria) > 0) { $this->builder...
php
{ "resource": "" }
q253537
Repository.filter
validation
public function filter(FilterRequest $filters) { $search = new Search($this->model, $filters); $this->builder = $search->getBuilder(); return $this; }
php
{ "resource": "" }
q253538
Repository.getRules
validation
public function getRules(array $fields = []) { $default_rules = $this->model->getRules(); if (count($fields) < 1) { return $default_rules; } foreach ($fields as $field => $rule) { if (is_int($field)) { $rules[$rule] = $default...
php
{ "resource": "" }
q253539
Repository.onlyFillablePivot
validation
public function onlyFillablePivot($pivotRelation, $data) { $fillable = $this->getPivotFields($pivotRelation, 'pivotColumns'); return array_only($data, $fillable); }
php
{ "resource": "" }
q253540
Repository.getPivotFields
validation
public function getPivotFields($obj, $prop) { $reflection = new \ReflectionClass($obj); $property = $reflection->getProperty($prop); $property->setAccessible(true); $value = $property->getValue($obj); $property->setAccessible(false); /* Remove timestamp from ...
php
{ "resource": "" }
q253541
Repository.storeChild
validation
public function storeChild($id, $relation, array $data) { $parent = $this->model->find($id); if (! $parent) { return null; } $resource = $parent->$relation()->create($data); return $resource; }
php
{ "resource": "" }
q253542
Repository.getChilds
validation
public function getChilds($id, $relation, $filters = null) { $parent = $this->model->find($id); if (! $parent) { return null; } if (count($filters->request->all()) > 0) { $child = $parent->$relation()->getRelated(); $...
php
{ "resource": "" }
q253543
Repository.getChild
validation
public function getChild($id, $relation, $idChild, $filters = null) { $parent = $this->model->find($id); if (! $parent) { return null; } if (count($filters->request->all()) > 0) { $child = $parent->$relation()->getRelated(); ...
php
{ "resource": "" }
q253544
SitemapGenerator.generateSiteMap
validation
protected function generateSiteMap() { $urls = array(); $siteName = $this->configurationHandler->siteName(); foreach ($this->pagesCollectionParser->pages() as $page) { foreach($page["seo"] as $seo) { $urls[] = array( 'href' => $siteName . '/' ....
php
{ "resource": "" }
q253545
HCLanguagesController.adminIndex
validation
public function adminIndex() { $config = [ 'title' => trans('HCLanguages::languages.page_title'), 'listURL' => route('admin.api.languages'), 'newFormUrl' => route('admin.api.form-manager', ['languages-new']), 'editFormUrl' => route('admin.api.form-m...
php
{ "resource": "" }
q253546
HCLanguagesController.getAdminListHeader
validation
public function getAdminListHeader() { return [ 'language_family' => [ "type" => "text", "label" => trans('HCLanguages::languages.language_family'), ], 'language' => [ "type" => "text", "label" => tr...
php
{ "resource": "" }
q253547
HCLanguagesController.__apiUpdateStrict
validation
protected function __apiUpdateStrict(string $id) { HCLanguages::where('id', $id)->update($this->getStrictRequestParameters()); return $this->apiShow($id); }
php
{ "resource": "" }
q253548
DateRange.getDatePeriod
validation
public function getDatePeriod() { $intervaloDiario = DateInterval::createFromDateString('1 day'); $dataFim = clone $this->endDate; $dataFim->add($intervaloDiario); return new DatePeriod($this->startDate, $intervaloDiario, $dataFim); }
php
{ "resource": "" }
q253549
BackendController.showAction
validation
public function showAction(Request $request, Application $app) { $options = $this->options($request, $app); return parent::show($options); }
php
{ "resource": "" }
q253550
AuthenticationController.resetPasswordAction
validation
public function resetPasswordAction() { // if the user is logged in, we can't reset password if ($this->cmsAuthentication()->hasIdentity()) { // redirect to the defualt user route return $this->redirect()->toRoute($this->getOptions()->getDefaultUserRoute()); } ...
php
{ "resource": "" }
q253551
AssetsManager.findFile
validation
private function findFile($uriPath) { return array_reduce($this->paths, function ($file, $path) use ($uriPath) { if (false !== $file) { return $file; } $file = $path . $uriPath; if (is_file($file) && is_readable($file)) { retur...
php
{ "resource": "" }
q253552
AssetsManager.detectMimeType
validation
private function detectMimeType($file) { $fileParts = explode('.', $file); $extension = array_pop($fileParts); $extension = strtolower($extension); if (array_key_exists($extension, $this->mimeTypes)) { return $this->mimeTypes[$extension]; } if (function_...
php
{ "resource": "" }
q253553
AssetsManager.writeToWebDir
validation
private function writeToWebDir($file, $contents) { if (!$this->webDir) { return; } if (!is_writable($this->webDir)) { trigger_error(sprintf('Directory %s is not writeable', $this->webDir)); return; } $destFile = $this->webDir . $file; ...
php
{ "resource": "" }
q253554
CreateJob.toArray
validation
public function toArray() { $data = [ "uuid" => $this->uuid, "code" => $this->code, "modules" => $this->modules, "vars" => $this->vars, ]; foreach (['modules', 'vars'] as $key) { if (!array_key_exists($key, $data)) { ...
php
{ "resource": "" }
q253555
CategoryController.newAction
validation
public function newAction(Request $request) { $category = new Category(); $form = $this->createForm('BlogBundle\Form\CategoryType', $category); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $em = $this->getDoctrine()->getManager(); ...
php
{ "resource": "" }
q253556
CategoryController.sortAction
validation
public function sortAction(Request $request) { $em = $this->getDoctrine()->getManager(); if ($request->isXmlHttpRequest()) { $this->get('admin_manager')->sort('BlogBundle:Category', $request->get('values')); return new Response(0, 200); } $categories = $em-...
php
{ "resource": "" }
q253557
CategoryController.editAction
validation
public function editAction(Request $request, Category $category) { $deleteForm = $this->createDeleteForm($category); $editForm = $this->createForm('BlogBundle\Form\CategoryType', $category); $editForm->handleRequest($request); if ($editForm->isSubmitted() && $editForm->isValid()) { ...
php
{ "resource": "" }
q253558
YamlCollectionLoader.load
validation
public function load($name) { foreach ($this->sourceDirs as $dir) { if (0 === strpos($name, DIRECTORY_SEPARATOR)) { $yamlFile = $name; } else { $yamlFile = $dir . '/' . $name; } if (false === strstr($ya...
php
{ "resource": "" }
q253559
HCURLShortenerController.searchQuery
validation
protected function searchQuery(Builder $query, string $phrase) { return $query->where (function (Builder $query) use ($phrase) { $query->where('url', 'LIKE', '%' . $phrase . '%') ->orWhere('short_url_key', 'LIKE', '%' . $phrase . '%') ->orWhere('clicks', '...
php
{ "resource": "" }
q253560
HCURLShortenerController.redirect
validation
public function redirect(string $shortURLKey) { $record = HCShortURL::where('short_url_key', $shortURLKey)->first(); if (!$record) abort(404); $record->increment('clicks'); return redirect($record->url); }
php
{ "resource": "" }
q253561
Config.getBundleLocationName
validation
public static function getBundleLocationName(string $sName): string { $oConfig = self::get($sName, null, true); if (isset($oConfig->redirect)) { return $oConfig->redirect; } else { return PORTAL; } }
php
{ "resource": "" }
q253562
CliCommand.prepareData
validation
protected function prepareData(InputInterface $input) { $return = []; foreach ($this->validators as $validator) { $result = $validator->validate($input); if (isset($result) && is_array($result)) { $return = NestedArray::mergeDeep($return, $result); ...
php
{ "resource": "" }
q253563
CliCommand.run
validation
public function run(InputInterface $input, OutputInterface $output) { $this->doPreRun($input, $output); $code = parent::run($input, $output); $this->doPostRun($input, $output, $code); return $code; }
php
{ "resource": "" }
q253564
CliCommand.askQuestions
validation
protected function askQuestions(InputInterface $input, OutputInterface $output) { foreach ($this->questions as $question) { if (!$question->ask($input, $output)) { return static::RETURN_ERROR; } } return static::RETURN_SUCCESS; }
php
{ "resource": "" }
q253565
CliCommand.doExecute
validation
protected function doExecute(InputInterface $input, OutputInterface $output) { // Ask questions. if ($this->askQuestions($input, $output) == static::RETURN_ERROR) { return static::RETURN_ERROR; } // Prepare data. $data = $this->prepareData($input); // Pre...
php
{ "resource": "" }
q253566
CliCommand.execute
validation
protected function execute(InputInterface $input, OutputInterface $output) { try { $this->doPreExecute($input, $output); $this->returnCode = $this->doExecute($input, $output); $this->doPostExecute($input, $output); } catch(Exception $e) { $this->return...
php
{ "resource": "" }
q253567
Material.uploadImage
validation
public function uploadImage($path, $type = 'icon') { if (!file_exists($path) || !is_readable($path)) { throw new InvalidArgumentException("File does not exist, or the file is unreadable: '$path'"); } $type = strtolower($type); return $this->parseJSON('upload', [self::AP...
php
{ "resource": "" }
q253568
ParamBehavior.getParam
validation
protected function getParam($param) { if (isset($_POST[$param])) { return $_POST[$param]; } elseif (isset($_GET[$param])) { return $_GET[$param]; } return; }
php
{ "resource": "" }
q253569
WP_Enqueue_Util.enqueue_script
validation
public function enqueue_script( WP_Enqueue_Options $options ) { if ( ! $options->have_required_properties() ) { trigger_error( 'Trying to enqueue script, but required properties are missing.' ); return; } // Required options. $handle = $options->get_handle();...
php
{ "resource": "" }
q253570
WP_Enqueue_Util.enqueue_style
validation
public function enqueue_style( WP_Enqueue_Options $options ) { if ( ! $options->have_required_properties() ) { trigger_error( 'Trying to enqueue style, but required properties are missing.' ); return; } // Required options. $handle = $options->get_handle(); ...
php
{ "resource": "" }
q253571
WP_Enqueue_Util.get_source_to_enqueue
validation
public function get_source_to_enqueue( $relative_path, $filename, $filename_debug = null ) { $source_file = $filename; if ( defined( 'SCRIPT_DEBUG' ) && true === SCRIPT_DEBUG && !empty( $filename_debug ) ) { $source_file = $filename_debug; } $path = realpath( trailingsla...
php
{ "resource": "" }
q253572
ReferenceRepository.get
validation
public function get($key) { if (!$this->repository->containsKey($key)) throw new ReferenceDoesNotExistException(); return $this->repository->get($key); }
php
{ "resource": "" }
q253573
ReferenceRepository.add
validation
public function add($key, $object) { if ($this->repository->containsKey($key)) throw new ReferenceExistsException(); $this->repository->set($key, $object); }
php
{ "resource": "" }
q253574
Security._checkBlackListIps
validation
private function _checkBlackListIps() : bool { $oSecurity = Config::get('security'); if (isset($oSecurity->blacklist_ips)) { foreach ($oSecurity->blacklist_ips as $sIp) { if ($_SERVER['REMOTE_ADDR'] == $sIp) { return false; } } } return true; }
php
{ "resource": "" }
q253575
Security._checkPasswordIsGood
validation
private function _checkPasswordIsGood() : bool { $sLogin = self::$_sLogin; $sPassword = Config::get('security')->users->$sLogin->password; if ($sPassword == self::$_sPassword) { return true; } else if ($sPassword == md5(self::$_sPassword)) { return true; } else { return false; } }
php
{ "resource": "" }
q253576
IndexController.editProfileAction
validation
public function editProfileAction() { // if the user is not logged in, we can't edit profile if (!$this->cmsAuthentication()->hasIdentity()) { // redirect to the login redirect route return $this->redirect()->toRoute($this->getOptions()->getLoginRoute()); } $...
php
{ "resource": "" }
q253577
IndexController.changePasswordAction
validation
public function changePasswordAction() { // if the user is not logged in, we can't change password if (!$this->cmsAuthentication()->hasIdentity()) { // redirect to the login redirect route return $this->redirect()->toRoute($this->getOptions()->getLoginRoute()); } ...
php
{ "resource": "" }
q253578
IndexController.confirmEmailAction
validation
public function confirmEmailAction() { $token = $this->params()->fromRoute('token'); if ($token) { $identity = $this->getUserService()->confirmEmail($token); if ($identity instanceof ResponseInterface) { return $identity; } elseif ($identity) { ...
php
{ "resource": "" }
q253579
IndexController.changeSecurityQuestionAction
validation
public function changeSecurityQuestionAction() { // if the user is not logged in, we can't change security question if (!$this->cmsAuthentication()->hasIdentity()) { // redirect to the login redirect route return $this->redirect()->toRoute($this->getOptions()->getLoginRoute()...
php
{ "resource": "" }
q253580
AbstractCliCtrl.getColoredMsg
validation
private function getColoredMsg( string $msg, ?string $fontColor, ?string $bgColor ): string { $res = ''; if (!is_null($fontColor)) { $res .= "\033[{$fontColor}m"; } if (!is_null($bgColor)) { $res .= "\033[{$bgColor}m"; } ...
php
{ "resource": "" }
q253581
AbstractCliCtrl.print
validation
protected function print(string $msg, bool $withTime = true): void { $preMsg = ''; if ($withTime) { $preMsg = (new \DateTime('now'))->format('H:i:s')."\t"; } echo "{$preMsg}{$msg}".\PHP_EOL; }
php
{ "resource": "" }
q253582
AbstractCliCtrl.printError
validation
protected function printError( \Throwable $error, bool $withTime = true, ?string $fontColor = null, ?string $bgColor = self::BG_COLOR_MAP['red'] ): void { $shift = $withTime ? "\t\t" : ''; $this->print( $this->getColoredMsg( 'Error: '.$erro...
php
{ "resource": "" }
q253583
AbstractCliCtrl.printInfo
validation
protected function printInfo( $msg, bool $withTime = true, ?string $fontColor = self::FONT_COLOR_MAP['lightGreen'], ?string $bgColor = null ): void { $this->print($this->getColoredMsg($msg, $fontColor, $bgColor), $withTime); }
php
{ "resource": "" }
q253584
PostController.newAction
validation
public function newAction(Request $request) { $post = new Post(); $form = $this->createForm('BlogBundle\Form\PostType', $post, array('translator' => $this->get('translator') )); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { $user = $this...
php
{ "resource": "" }
q253585
PostController.showAction
validation
public function showAction(Post $post) { $deleteForm = $this->createDeleteForm($post); return array( 'entity' => $post, 'delete_form' => $deleteForm->createView(), ); }
php
{ "resource": "" }
q253586
PostController.editAction
validation
public function editAction(Request $request, Post $post) { if(is_object($post->getPublished()) && $post->getPublished()->format('dmY') == '3011-0001'){ $post->setPublished(null); } $deleteForm = $this->createDeleteForm($post); $editForm = $this->createForm('BlogBundle\For...
php
{ "resource": "" }
q253587
PostController.createDeleteForm
validation
private function createDeleteForm(Post $post) { return $this->createFormBuilder() ->setAction($this->generateUrl('blog_category_delete', array('id' => $post->getId()))) ->setMethod('DELETE') ->getForm() ; }
php
{ "resource": "" }
q253588
TemplateAssetsManager.add
validation
public function add(array $assets) { foreach ($assets as $type => $asset) { if ($asset instanceof Plugin) { $this->parse($asset); continue; } $this->assets[$type] = array_merge($this->assets[$type], $asset); } }
php
{ "resource": "" }
q253589
Aggregate.getConnectionInitializer
validation
protected function getConnectionInitializer(OptionsInterface $options, $callable) { if (!is_callable($callable)) { $class = get_called_class(); throw new \InvalidArgumentException("$class expects a valid callable"); } $option = $this; return function ($para...
php
{ "resource": "" }
q253590
Item.getTaxonomy
validation
public function getTaxonomy($system_id) { foreach ($this->getTaxonomies() as $taxonomy) { if ($taxonomy->system_id === $system_id) { return $taxonomy; } } return false; }
php
{ "resource": "" }
q253591
Auth.validate
validation
public function validate(string $api_session = null) { $this->details = false; if (empty($api_session) === false && is_string($api_session) === true) { $session = Model\Session::with('user')->where('code', $api_session)->first(); if ($session !== null) { if (s...
php
{ "resource": "" }
q253592
Auth.invalidate
validation
public function invalidate(string $api_session = null) { if (empty($api_session) === false && is_string($api_session) === true) { $session = Model\Session::where('code', $api_session)->first(); if ($session !== null) { $session->delete(); } } elsei...
php
{ "resource": "" }
q253593
Auth.allow
validation
public function allow(array $level_select = ["min" => 4,"max" => 4]): bool { if ($this->details !== false) { if (is_array($level_select) === true && isset($level_select["min"]) === true && isset($level_select["max"]) === true) { $level_select["min"] = Model\Role::find($level_select["...
php
{ "resource": "" }
q253594
ViewModel.save
validation
public function save() { try { $autenticacao = new Autenticacao(); $autenticacao->exchangeArray($this->form->getData()); $perfilDefault = $this->autenticacaoManager->getPerfilManager()->obterPerfilByNome(Acesso::getDefaultRole()); $autenticacao = $this->autent...
php
{ "resource": "" }
q253595
AbstractView.setFilePath
validation
public function setFilePath(string $viewFilePath): void { if (!is_readable($viewFilePath)) { throw new Exception("The View file {$viewFilePath} isn't readable."); } $this->filePath = $viewFilePath; }
php
{ "resource": "" }
q253596
AbstractView.setVariables
validation
public function setVariables(array $data): void { foreach ($data as $key => $value) { $this->$key = $value; } }
php
{ "resource": "" }
q253597
ThemeGenerator.generate
validation
public function generate() { if (!$this->configurationHandler->isTheme() || $this->theme->getName() != $this->configurationHandler->handledTheme()) { return; } $templates = array_keys($this->templates["template"]); $homepage = json_decode(file_get_contents($this->configu...
php
{ "resource": "" }
q253598
ContentfulContentType.updateEntryName
validation
public function updateEntryName(ContentfulEntry $entry) { $displayField = $this->getDisplayField(); $values = array_values((array)$entry->{$displayField}); $entry->setName(isset($values[0]) ? $values[0] : 'Untitled'); }
php
{ "resource": "" }
q253599
Compress.registerCalc
validation
private function registerCalc($period) { $ctx = new \Praxigento\Core\Data(); $ctx->set(PCalcReg::IN_CALC_TYPE_CODE, Cfg::CODE_TYPE_CALC_FORECAST_PHASE1); $ctx->set(PCalcReg::IN_PERIOD, $period); /** @var \Praxigento\Core\Data $res */ $res = $this->zCalcReg->exec($ctx); ...
php
{ "resource": "" }