_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q248600
PriceTransformer.getDefaultPriceMapLoader
validation
public static function getDefaultPriceMapLoader() { if (null === self::$defaultPriceMapLoader) { $currencyDir = realpath(__DIR__ . '/../../../data/prices'); self::$defaultPriceMapLoader = new PhpFileLoader(array($currencyDir)); } return self::$defaultPriceMapLoader;...
php
{ "resource": "" }
q248601
SaleItemNormalizer.getInStock
validation
private function getInStock(SaleItemInterface $item) { if (null === $subject = $this->subjectHelper->resolve($item, false)) { return INF; } if (!$subject instanceof StockSubjectInterface) { return INF; } if ($subject->isStockCompound()) { ...
php
{ "resource": "" }
q248602
SaleUpdater.updateWeightTotal
validation
protected function updateWeightTotal(SaleInterface $sale) { $weightTotal = $this->weightCalculator->calculateSale($sale); if ($sale->getWeightTotal() != $weightTotal) { $sale->setWeightTotal($weightTotal); return true; } return false; }
php
{ "resource": "" }
q248603
SaleUpdater.updateAmountsTotal
validation
protected function updateAmountsTotal(SaleInterface $sale) { $changed = false; $currency = $sale->getCurrency()->getCode(); $sale->clearResults(); $result = $this->amountCalculator->calculateSale($sale); if (0 != Money::compare($result->getBase(), $sale->getNetTotal(), $c...
php
{ "resource": "" }
q248604
SaleUpdater.updatePaymentTotal
validation
protected function updatePaymentTotal(SaleInterface $sale) { $changed = false; $currency = $sale->getCurrency()->getCode(); // Update paid total if needed $paid = $this->paymentCalculator->calculatePaidTotal($sale); if (0 != Money::compare($paid, $sale->getPaidTotal(), $cur...
php
{ "resource": "" }
q248605
SaleUpdater.updateInvoiceTotal
validation
protected function updateInvoiceTotal(SaleInterface $sale) { if (!$sale instanceof InvoiceSubjectInterface) { return false; } $changed = false; $invoice = $this->invoiceCalculator->calculateInvoiceTotal($sale); if (0 != Money::compare($invoice, $sale->getInvoice...
php
{ "resource": "" }
q248606
SaleUpdater.resolveOutstandingDate
validation
protected function resolveOutstandingDate(SaleInterface $sale) { if (!$sale instanceof InvoiceSubjectInterface) { return null; } if (!$sale instanceof ShipmentSubjectInterface) { return null; } if (null === $term = $sale->getPaymentTerm()) { ...
php
{ "resource": "" }
q248607
SaleItemValidator.checkPrivacyIntegrity
validation
protected function checkPrivacyIntegrity(SaleItemInterface $item, SaleItem $constraint) { $parent = $item->getParent(); if ($item->isPrivate()) { if (null === $parent) { // Level zero items must be public $this ->context ...
php
{ "resource": "" }
q248608
SaleItemValidator.checkInvoiceIntegrity
validation
protected function checkInvoiceIntegrity(SaleItemInterface $item, SaleItem $constraint) { $sale = $item->getSale(); if (!$sale instanceof Invoice\InvoiceSubjectInterface) { return; } if (empty($sale->getInvoices()->toArray())) { return; } $mi...
php
{ "resource": "" }
q248609
SaleItemValidator.checkShipmentIntegrity
validation
protected function checkShipmentIntegrity(SaleItemInterface $item, SaleItem $constraint) { $sale = $item->getSale(); if (!$sale instanceof Shipment\ShipmentSubjectInterface) { return; } if (empty($sale->getShipments()->toArray())) { return; } ...
php
{ "resource": "" }
q248610
StockUnitLinker.updatePrice
validation
private function updatePrice(StockUnitInterface $stockUnit) { $price = null; if (null !== $item = $stockUnit->getSupplierOrderItem()) { if (null === $order = $item->getOrder()) { throw new StockLogicException("Supplier order item's order must be set at this point."); ...
php
{ "resource": "" }
q248611
SaleView.setTranslations
validation
public function setTranslations(array $translations) { foreach ($translations as $key => $string) { if (!(is_string($string) && !empty($string))) { throw new \InvalidArgumentException("Invalid translation for key '$key'."); } } $this->translations = a...
php
{ "resource": "" }
q248612
ProfileController.editAction
validation
public function editAction() { $user = $this->getUser(); $form = $this->createForm(ProfileType::class, $user); return array( 'form' => $form->createView(), ); }
php
{ "resource": "" }
q248613
ProfileController.updateAction
validation
public function updateAction(Request $request) { $user = $this->getUser(); $form = $this->createForm(ProfileType::class, $user); $form->bind($request); if ($form->isValid()) { $em = $this->getDoctrine()->getManager(); try { $em->persist($use...
php
{ "resource": "" }
q248614
ProfileController.updatePasswordAction
validation
public function updatePasswordAction(Request $request) { $user = $this->getUser(); $form = $this->createForm(ChangePasswordType::class); $form->bind($request); $data = $form->getData(); /** @var $factory \Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface */ ...
php
{ "resource": "" }
q248615
SessionBag.has
validation
public function has(string $key): bool { return isset($_SESSION) ? array_key_exists($key, $_SESSION) : false; }
php
{ "resource": "" }
q248616
UnlimitedPool.clear
validation
public function clear() { while (!$this->queue->isEmpty()) { $this->queue->pop(); } $this->queue = null; }
php
{ "resource": "" }
q248617
ValueBag.fetch
validation
public function fetch(string $key, $default = null) { $val = $this->bag[$key] ?? $default; if (!is_array($val)) { return trim($val); } else { return $val; } }
php
{ "resource": "" }
q248618
ValueBag.fetchFloat
validation
public function fetchFloat(string $key, float $default = 0.0, int $precision = 2): float { return round(floatval($this->fetch($key, $default)), $precision); }
php
{ "resource": "" }
q248619
ValueBag.fetchBool
validation
public function fetchBool(string $key, bool $default = false): bool { return $this->fetchFilter($key, $default, FILTER_VALIDATE_BOOLEAN); }
php
{ "resource": "" }
q248620
ValueBag.fetchFilter
validation
public function fetchFilter(string $key, $default = null, $filter = FILTER_DEFAULT, $options = []) { $value = $this->fetch($key, $default); if (!is_array($options) && $options) { $options = ['flags' => $options]; } if (is_array($value) && !isset($options['flags'])) { ...
php
{ "resource": "" }
q248621
ValueBag.fetchEscape
validation
public function fetchEscape(string $key, \mysqli $db, string $default = ''): string { return $db->real_escape_string($this->fetch($key, $default)); }
php
{ "resource": "" }
q248622
Request.route
validation
public function route(bool $dropIndex = false): string { if ($dropIndex) { if ('index' == $this->route) { return ''; } } return $this->route; }
php
{ "resource": "" }
q248623
SqlStatement.toInsert
validation
public static function toInsert($input, array $include = []) { if (is_object($input)) { if (method_exists($input, 'toArray')) { $input = $input->toArray(); } elseif ($input instanceof \Traversable) { $input = iterator_to_array($input); } else { $input = (array)$input; } } elseif (!i...
php
{ "resource": "" }
q248624
SqlStatement.toValues
validation
public static function toValues($input, array $include = []) { if (!is_array($input) && !is_object($input)) { throw new InvalidArgumentException('input must be an associative array or traversable object'); } $sqlStrs = []; if (count($include)) { foreach ($include as $i) { if (array_key_exists($i, $...
php
{ "resource": "" }
q248625
Randstring.generateString
validation
private function generateString() { $this->generateNumbers(); $this->adjective = $this->adjectives[$this->first]; $this->animal = $this->animals[$this->second]; switch ($this->case) { case 'ucfirst': $this->string = ucfirst($this->adjective . $this->animal...
php
{ "resource": "" }
q248626
Upload.uploadAction
validation
public function uploadAction() { if ($this->request->hasFiles() == true) { $this->initializeScaffolding(); $form = $this->scaffolding->getForm(); $name = key($_FILES); /** @var \Vegas\Forms\Element\Upload $uploadElement */ $uploadElement = $form->g...
php
{ "resource": "" }
q248627
Helper.moveFile
validation
public static final function moveFile($file) { try { if($file->is_temp) { rename( $file->temp_destination . '/' . $file->temp_name, $file->original_destination . '/' . $file->temp_name ); if(!file_exists($fi...
php
{ "resource": "" }
q248628
Helper.generateThumbnailsFrom
validation
public static final function generateThumbnailsFrom($files, array $size) { foreach($files as $file) { self::generateThumbnail($file->getRecord(), $size); } }
php
{ "resource": "" }
q248629
ServerBag.fetch
validation
public function fetch(string $key, $default = null) { if (isset($_SERVER[$key])) { return $_SERVER[$key]; } else { $key = 'HTTP_' . $key; return $_SERVER[$key] ?? $default; } }
php
{ "resource": "" }
q248630
Application.getResponse
validation
public function getResponse(array $packageList, array $languageList, array $customRouteList, string $url = ''): Response { $request = new Request($languageList, $packageList, $url); $this->packageRoot .= 'package/' . $request->package() . '/'; try { /** * Process r...
php
{ "resource": "" }
q248631
Application.set404
validation
private function set404() { $this->response->setStatusCode(404); $content = '404 Not Found'; if (file_exists($this->packageRoot . '/view/404.html.php')) { $content = (new Native($this->packageRoot))->getContent('404.html.php'); } $this->response->setContent($conte...
php
{ "resource": "" }
q248632
TypedClass.assign
validation
public function assign($in) { $this->_massageBlockInput($in); if (empty($in)) { foreach ($this->_publicNames as $publicName) { $this->__unset($publicName); } } elseif (is_object($in)) { foreach ($this->_publicNames as $publicName) { if (isset($in->{$publicName})) { $this->_setByName($pub...
php
{ "resource": "" }
q248633
TypedClass.serialize
validation
public function serialize(): string { $toSerialize = [ '_arrayOptions' => $this->_arrayOptions, '_jsonOptions' => $this->_jsonOptions, ]; foreach ($this->_publicNames as $k) { $toSerialize[$k] = $this->{$k}; } return serialize($toSerialize); }
php
{ "resource": "" }
q248634
TypedClass.unserialize
validation
public function unserialize($serialized): void { $this->_initMetaData(); $data = unserialize($serialized); foreach ($data as $k => $v) { $this->{$k} = $v; } }
php
{ "resource": "" }
q248635
TypedClass.replace
validation
public function replace($in): void { $this->_massageBlockInput($in); if (empty($in)) { return; } foreach ($in as $k => $v) { if ($this->_keyExists($k)) { if ($this->{$k} instanceof TypedAbstract) { $this->{$k}->replace($v); } else { $this->_setByName($k, $v); } } } $th...
php
{ "resource": "" }
q248636
TypedClass._getByName
validation
protected function _getByName($propName) { if (array_key_exists($propName, $this->_map)) { $propName = $this->_map[$propName]; } if ($this->{$propName} instanceof AtomicInterface) { return $this->{$propName}->get(); } $getter = '_get_' . $propName; if (method_exists($this->_calledClass, $getter)) {...
php
{ "resource": "" }
q248637
LatitudeLongitudeWorker.execute
validation
public function execute() { $addresses = $this->addressRepository->createQueryBuilder('a') ->where('a.latitude IS NULL') ->orWhere('a.longitude IS NULL') ->setMaxResults(500) ->getQuery() ->getResult(); foreach ($addresses as $address) { ...
php
{ "resource": "" }
q248638
Response.header
validation
public function header(string $name, string $value): bool { if (!empty($name) && !empty($value) && !headers_sent()) { header($name . ': ' . $value); return true; } return false; }
php
{ "resource": "" }
q248639
Response.setStatusCode
validation
public function setStatusCode(int $statusCode, string $version = '1.1', string $statusText = ''): bool { if (!headers_sent()) { $statusCode = intval($statusCode); if ('' == $statusText) { $statusTexts = [ 100 => 'Continue', 101...
php
{ "resource": "" }
q248640
Response.redirect
validation
public function redirect(string $url = '', int $statusCode = 302) { $this->is404 = false; $server = filter_input_array(INPUT_SERVER); if ('' == $url && isset($server['REQUEST_URI'])) { $url = '/' . trim($server['REQUEST_URI'], '/'); preg_match('/^[\\a-zA-Z0-9-\._~:\/\...
php
{ "resource": "" }
q248641
JsonErrorResponse.getFormErrorData
validation
private function getFormErrorData(Form $form) { if ($form->isValid()) { // A JsonErrorResponse was created with a valid form-- no errors will be found return $this->getResponseData('An error occurred while processing the submitted information'); } $errors = $this->ge...
php
{ "resource": "" }
q248642
JsonErrorResponse.getErrors
validation
private function getErrors(Form $form) { $errors = array(); if ($form->isSubmitted() && $form->isValid()) { return $errors; } $id = $form->createView()->vars['id']; foreach ($form->getErrors() as $error) { if (!isset($errors[$id])) { ...
php
{ "resource": "" }
q248643
config.Get
validation
public function Get($name = null,$value = null,...$param){ if(!isset($name)) return self::$config; return isset($value)? self::$config[$name][$value] :(isset(self::$config[$name])?self::$config[$name]:null); }
php
{ "resource": "" }
q248644
config.reload
validation
public static function reload($file,$rangePath = null){ if(!empty($rangePath)){ self::$rangePath = $rangePath; } if (PHP_SAPI === 'cli'){ $cilpath = realpath(dirname(dirname(dirname(dirname(__FILE__))))).'/config/'; $file = $cilpath.$file.'.'.self::$form...
php
{ "resource": "" }
q248645
FileBag.convertFileInformation
validation
private function convertFileInformation($file) { if ($file instanceof FileUpload) { return $file; } $file = $this->fixPhpFilesArray($file); if (is_array($file)) { $keys = array_keys($file); sort($keys); if ($keys == ['error', 'name', ...
php
{ "resource": "" }
q248646
TypedArray.assign
validation
public function assign($in) { $this->_massageBlockInput($in); $this->_container = []; // initialize array or remove all current values foreach ($in as $k => $v) { $this->offsetSet($k, $v); } }
php
{ "resource": "" }
q248647
TypedArray.replace
validation
public function replace($in) { $this->_massageBlockInput($in); foreach ($in as $k => $v) { $this->offsetSet($k, $v); } }
php
{ "resource": "" }
q248648
TypedArray.serialize
validation
public function serialize(): string { return serialize([ '_type' => $this->_type, '_arrayOptions' => $this->_arrayOptions, '_jsonOptions' => $this->_jsonOptions, '_container' => $this->_container, ]); }
php
{ "resource": "" }
q248649
TypedArray.merge
validation
public function merge($ta): self { $this->_massageBlockInput($in); $ret = clone $this; foreach ($ta as $k => $v) { if (is_int($k)) { $ret[] = $v; } else { $ret[$k] = $v; } } return $ret; }
php
{ "resource": "" }
q248650
TypedArray.&
validation
public function &offsetGet($offset) { if (!$this->offsetExists($offset)) { // Be sure offset exists before accessing it. $this->offsetSet($offset, null); // Returns new offset created by ::offsetSet(). if (null === $offset) { end($this->_container); $offset = key($this->_container); } } ...
php
{ "resource": "" }
q248651
TypedArray.offsetSet
validation
public function offsetSet($k, $v) { if (null === $k || !array_key_exists($k, $this->_container)) { $v = (is_object($v) && get_class($v) === $this->_type) ? $v : new $this->_type($v); if (null === $k) { $this->_container[] = $v; } else { $this->_container[$k] = $v; } return; } if (is_...
php
{ "resource": "" }
q248652
TypedArray.combine
validation
public function combine(array $keys): self { if (count($keys) !== count($this->_container)) { throw new LengthException('array counts do not match'); } $this->_container = array_combine($keys, $this->_container); return $this; }
php
{ "resource": "" }
q248653
File.customChmod
validation
protected function customChmod(string $target, $mode = 0666) { if (false === @chmod($target, $mode & ~umask())) { throw new FileException(sprintf('Unable to change mode of the "%s"', $target)); } }
php
{ "resource": "" }
q248654
DefaultRoute.getResponse
validation
public function getResponse(string &$packageRoot, Request &$request): Response { $packageRoot = rtrim($packageRoot, '/'); $route = preg_replace('/\/\d+/u', '/D', $request->route()); $path = $packageRoot . '/Route/' . $route . '/' . $request->method() . '.php'; if (file_exists($path))...
php
{ "resource": "" }
q248655
FileUpload.read
validation
public function read() { $data = ''; $fileObj = $this->openFile(); while (!$fileObj->eof()) { $data .= $fileObj->fread(4096); } $fileObj = null; return $data; }
php
{ "resource": "" }
q248656
FileUpload.errorMessage
validation
public function errorMessage(): string { static $errors = array( UPLOAD_ERR_INI_SIZE => 'The file "%s" exceeds your upload_max_filesize ini directive (limit is %d KiB).', UPLOAD_ERR_FORM_SIZE => 'The file "%s" exceeds the upload limit defined in your form.', UPLOAD_ERR_PA...
php
{ "resource": "" }
q248657
FileUpload.getMaxFileSize
validation
public function getMaxFileSize(): int { $iniMax = strtolower(ini_get('upload_max_filesize')); if ('' === $iniMax) { return PHP_INT_MAX; } $max = ltrim($iniMax, '+'); if (0 === strpos($max, '0x')) { $max = intval($max, 16); } elseif (0 === str...
php
{ "resource": "" }
q248658
BaseController.setView
validation
protected function setView(string $name = '', array $data = []) { if (!empty($data)) { $this->data = array_replace($this->data, $data); } $content = (new Native($this->packageRoot, $this->request->language(), !Wrap::isEnabled()))->getContent($name, $this->data); $this->re...
php
{ "resource": "" }
q248659
BaseController.setJSONContent
validation
protected function setJSONContent(array $content) { if ($this->deleteJsonKeys) { $content = $this->deleteArrayKeys($content); } $content = json_encode($content, JSON_UNESCAPED_UNICODE); $this->response->setContentTypeJson(); $this->response->setContent($content); ...
php
{ "resource": "" }
q248660
BaseController.setRedirect
validation
protected function setRedirect(string $url = '', int $statusCode = 303) { $this->response->redirect($url, $statusCode); }
php
{ "resource": "" }
q248661
BaseController.getNumList
validation
protected function getNumList(): array { preg_match_all('/\/\d+/u', $this->request->route(), $numList); $numList = $numList[0]; $numList = array_map(function($val) { return intval(ltrim($val, '/')); }, $numList); return $numList; }
php
{ "resource": "" }
q248662
EeMediaGalleryUpdateObserver.initializeProductMediaGalleryValueToEntity
validation
protected function initializeProductMediaGalleryValueToEntity(array $attr) { // load the row/value ID $rowId = $attr[MemberNames::ROW_ID]; $valueId = $attr[MemberNames::VALUE_ID]; // query whether the product media gallery value to entity entity already exists or not if ($t...
php
{ "resource": "" }
q248663
DetailView.renderAlertBlock
validation
protected function renderAlertBlock() { $session = \Yii::$app->session; $flashes = $session->getAllFlashes(); $alertContainerOptions = [ 'style' => 'max-width:400px' ]; if (count($flashes) === 0) { Html::addCssStyle($alertContainerOptions, 'display:non...
php
{ "resource": "" }
q248664
GridView.registerWidget
validation
protected function registerWidget($name = null, $id = null) { if ($name === null) { $name = $this->getDefaultJsWidgetName(); } $this->_registerBundle(); if (!$this->isAjaxCrud && $this->getUpdateUrl()) { if ($id === null) { $id = $this->optio...
php
{ "resource": "" }
q248665
MenuViewHelper.render
validation
public function render($menu = 'Default', $debug = false, $class = null) { $response = $this->initiateSubRequest(); return $response->getContent(); }
php
{ "resource": "" }
q248666
Swf.setSource
validation
public function setSource($source = '') { if(!$this->isValid($source)) { throw new InvalidSourceExtensionException(); } $this->source = $source; return $this; }
php
{ "resource": "" }
q248667
Swf.isValid
validation
private function isValid($source = '') { if(empty($source)) { return false; } else { $extension = substr($source, -3); if(strtolower($extension) !== 'swf') { return false; } } return true; }
php
{ "resource": "" }
q248668
Swf.renderEmbed
validation
public function renderEmbed() { if(!$this->isValid($this->source)) { throw new InvalidSourceExtensionException(); } return sprintf($this->embedDecorator, $this->width, $this->height, $this->source); }
php
{ "resource": "" }
q248669
Swf.renderObject
validation
public function renderObject() { if(!$this->isValid($this->source)) { throw new InvalidSourceExtensionException(); } return sprintf($this->objectDecorator, $this->width, $this->height, $this->source); }
php
{ "resource": "" }
q248670
AuthController.loginAction
validation
public function loginAction(Request $request) { $session = $request->getSession(); $form = $this->createFormBuilder() ->add('username', TextType::class, array('label' => 'Username')) ->add('password', PasswordType::class, array('label' => 'Password')) ->add('reme...
php
{ "resource": "" }
q248671
Country.addRegion
validation
public function addRegion(RegionInterface $region) { $region->setCountry($this); $this->regions->add($region); }
php
{ "resource": "" }
q248672
MimeType.getInstance
validation
public static function getInstance(): MimeType { if (null === self::$instance) { self::$instance = new self(); } return self::$instance; }
php
{ "resource": "" }
q248673
MimeType.guess
validation
public function guess(string $path): string { if (!is_file($path)) { throw new FileNotFoundException($path); } if (!is_readable($path)) { throw new AccessDeniedException($path); } if (0 == count($this->guesserList)) { $msg = 'Unable to gu...
php
{ "resource": "" }
q248674
Export.export
validation
public function export(Defender $defender) { $content = json_encode($defender->dangerFiles); $name = 'defender/defender-'.$this->date.'.json'; if ($this->storage->exists($name)) { $this->storage->delete($name); } $this->storage->put($name, $content); }
php
{ "resource": "" }
q248675
Defender.getDirContents
validation
private function getDirContents($dir, &$results = []) { $files = scandir($dir); foreach ($files as $value) { $path = realpath($dir.DIRECTORY_SEPARATOR.$value); if (!is_dir($path)) { $results[] = $path; continue; } if (...
php
{ "resource": "" }
q248676
Defender.scan
validation
public function scan() { $files = $this->extensionsFile($this->files); foreach ($files as $file) { $content = file_get_contents($file); if (str_contains($file, '.php') && !str_contains($file, $this->exceptionsValid) && !$this->checkForValidPhp($content) ...
php
{ "resource": "" }
q248677
EeMediaGalleryObserver.prepareProductMediaGalleryValueToEntityAttributes
validation
protected function prepareProductMediaGalleryValueToEntityAttributes() { // initialize and return the entity return $this->initializeEntity( array( MemberNames::VALUE_ID => $this->valueId, MemberNames::ROW_ID => $this->parentId ) )...
php
{ "resource": "" }
q248678
Wrap.handleFatal
validation
public static function handleFatal() { $error = error_get_last(); if(null !== $error) { self::render($error["type"], $error["message"], $error["file"], $error["line"]); } }
php
{ "resource": "" }
q248679
Wrap.handleException
validation
public static function handleException(\Throwable $e) { self::render($e->getCode(), $e->getMessage(), $e->getFile(), $e->getLine(), null, $e->getTrace(), get_class($e)); }
php
{ "resource": "" }
q248680
EeMediaGalleryValueUpdateObserver.initializeProductMediaGalleryValue
validation
protected function initializeProductMediaGalleryValue(array $attr) { // load the row/value/store ID $rowId = $attr[MemberNames::ROW_ID]; $valueId = $attr[MemberNames::VALUE_ID]; $storeId = $attr[MemberNames::STORE_ID]; // query whether the product media gallery value alread...
php
{ "resource": "" }
q248681
Module.reloadModule
validation
protected function reloadModule(Wrapper $wrapper, $module) { $moduleStatus = $wrapper->ModuleManager->reload($module); $module = Inflector::camelize($module); switch ($moduleStatus) { //AlreadyUnloaded case 'AU': $wrapper->Channel->sendMessage('The M...
php
{ "resource": "" }
q248682
IfAccesOnControllersActionViewHelper.hasAccessToAction
validation
protected function hasAccessToAction($packageKey, $subpackageKey, $controllerName, $actionName) { $actionControllerName = $this->router->getControllerObjectName($packageKey, $subpackageKey, $controllerName); try { return $this->privilegeManager->isGranted( 'Neos\Flow\Security\Authorization\Privilege\Method...
php
{ "resource": "" }
q248683
GroupController.showAction
validation
public function showAction($id) { $em = $this->getDoctrine()->getEntityManager(); $group = $em->getRepository('Orkestra\Bundle\ApplicationBundle\Entity\Group')->find($id); if (!$group) { throw $this->createNotFoundException('Unable to locate Group'); } return a...
php
{ "resource": "" }
q248684
GroupController.newAction
validation
public function newAction() { $group = new Group(); $form = $this->createForm(GroupType::class, $group); return array( 'group' => $group, 'form' => $form->createView() ); }
php
{ "resource": "" }
q248685
GroupController.createAction
validation
public function createAction() { $group = new Group(); $form = $this->createForm(GroupType::class, $group); $form->bindRequest($this->getRequest()); if ($form->isValid()) { $em = $this->getDoctrine()->getEntityManager(); $em->persist($group); $em...
php
{ "resource": "" }
q248686
GroupController.editAction
validation
public function editAction($id) { $em = $this->getDoctrine()->getEntityManager(); $group = $em->getRepository('Orkestra\Bundle\ApplicationBundle\Entity\Group')->find($id); if (!$group) { throw $this->createNotFoundException('Unable to locate Group'); } $form = ...
php
{ "resource": "" }
q248687
GroupController.updateAction
validation
public function updateAction($id) { $em = $this->getDoctrine()->getEntityManager(); $group = $em->getRepository('Orkestra\Bundle\ApplicationBundle\Entity\Group')->find($id); if (!$group) { throw $this->createNotFoundException('Unable to locate Group'); } $form ...
php
{ "resource": "" }
q248688
common.decrypt
validation
function decrypt($data, $password) { $data = base64_decode($data); $salt = substr($data, 0, 16); $ct = substr($data, 16); $rounds = 3; // depends on key length $data00 = $password.$salt; $hash = array(); $hash[0] = hash('sha256', $data00, true); $r...
php
{ "resource": "" }
q248689
common.encrypt
validation
function encrypt($data, $password) { // Set a random salt $salt = openssl_random_pseudo_bytes(16); $salted = ''; $dx = ''; while (strlen($salted) < 48) { $dx = hash('sha256', $dx.$password.$salt, true); $salted .= $dx; } $key...
php
{ "resource": "" }
q248690
Processpool.exec
validation
public function exec(string $execfile, array $args): bool { return $this->process->exec($execfile, $args); }
php
{ "resource": "" }
q248691
Processpool.useQueue
validation
public function useQueue(int $msgkey = 0, int $mode = 2) { $this->process->useQueue($msgkey, $mode); }
php
{ "resource": "" }
q248692
Package.boot
validation
public function boot(\Neos\Flow\Core\Bootstrap $bootstrap) { //register Configuration Type Menu $dispatcher = $bootstrap->getSignalSlotDispatcher(); $dispatcher->connect('Neos\Flow\Configuration\ConfigurationManager', 'configurationManagerReady', function ($configurationManager) { $configurationManager->re...
php
{ "resource": "" }
q248693
Breadcrumbs.renderRTL
validation
protected function renderRTL(): string { $trail = ''; if ($this->after) { $trail .= '<span class="after">'.$this->after.'</span> '; } $trail .= \join( ' <span class="sep delimiter">'.$this->delimiter.'</span> ', \array_reverse($this->links) ...
php
{ "resource": "" }
q248694
Breadcrumbs.renderLTR
validation
protected function renderLTR(): string { $trail = ''; if ($this->before) { $trail .= '<span class="before">'.$this->before.'</span> '; } $trail .= \join( ' <span class="sep delimiter">'.$this->delimiter.'</span> ', $this->links ); ...
php
{ "resource": "" }
q248695
Breadcrumbs.getFirstTerm
validation
protected function getFirstTerm(WP_Post $post) { $taxonomies = $this->getTaxonomies($post->post_type); foreach ($taxonomies as $taxonomy) { $post_terms = \get_the_terms($post, $taxonomy); if (!$post_terms || \is_wp_error($post_terms)) { continue; ...
php
{ "resource": "" }
q248696
Breadcrumbs.getTaxonomies
validation
protected function getTaxonomies(string $post_type): array { $return = []; $taxes = \get_object_taxonomies($post_type, 'objects'); foreach ($taxes as $tax_slug => $tax_object) { if (\is_taxonomy_hierarchical($tax_slug)) { $return[] = $tax_slug; } ...
php
{ "resource": "" }
q248697
FileManager.ensureDirectoryExists
validation
private function ensureDirectoryExists($path) { if (!is_dir($path)) { if (!mkdir($path, 0777, true)) { throw new \RuntimeException(sprintf('Could not create directory "%s"', $path)); } } return $path; }
php
{ "resource": "" }
q248698
EntityOperationResult.persist
validation
public function persist(ObjectManager $manager) { foreach ($this->entities as $entity) { $manager->persist($entity); } if ($this->root) { $manager->persist($this->root); } }
php
{ "resource": "" }
q248699
Font.background
validation
public function background(): Font { if ($this->color !== null) { $this->turnToBackground(); } $this->background = true; return $this; }
php
{ "resource": "" }