_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q237000
EnumObject.all
train
static function all(): array { $instances = []; foreach (static::getMap() as $key => $value) { $instances[$key] = self::$instanceCache[static::class][$key] ?? (self::$instanceCache[static::class][$key] = new static($key, $value)); } return $instances; ...
php
{ "resource": "" }
q237001
StringHelper.numeroFormatoBrParaSql
train
public function numeroFormatoBrParaSql($numero) { //Retira espaços $numero = trim($numero); //Retira separador de milhar com o ponto $numero = str_replace(".", "", $numero); //Substitui separador de decimal de virgula para ponto $numero = str_replace(",", ".", $nume...
php
{ "resource": "" }
q237002
StringHelper.numeroFormatoSqlParaBr
train
public function numeroFormatoSqlParaBr($numero) { //Retira espaços $numero = trim($numero); //Retira separador de milhar com a virgula $numero = str_replace(",", "", $numero); if (!is_numeric($numero)) { return false; } //Se não tiver ponto ...
php
{ "resource": "" }
q237003
StringHelper.numeroFormatoSqlParaMoedaBr
train
public function numeroFormatoSqlParaMoedaBr($numero) { //Retira espaços $numero = trim($numero); //Retira separador de milhar com a virgula $numero = str_replace(",", "", $numero); if(!is_numeric($numero)){ return false; } return number_format($...
php
{ "resource": "" }
q237004
StringHelper.numeroFormatoBrParaMoedaBr
train
public function numeroFormatoBrParaMoedaBr($numero) { //Retira espaços $numero = trim($numero); //Retira separador de milhar com a virgula $numero = str_replace(".", "", $numero); //transforma para numero $numero = str_replace(",", ".", $numero); if(!is_num...
php
{ "resource": "" }
q237005
StringHelper.checarValorArrayMultidimensional
train
public function checarValorArrayMultidimensional($key, $value, array $array) { foreach ($array as $a) { if (isset($a[$key]) && $a[$key] == $value) { return true; } } return false; }
php
{ "resource": "" }
q237006
StringHelper.formatarIeCpfCnpj
train
function formatarIeCpfCnpj($valor) { if (strlen($valor) == 9) { return $this->formatarIe($valor); } if (strlen($valor) == 11) { return $this->formatarCpf($valor); } return $this->formatarCnpj($valor); }
php
{ "resource": "" }
q237007
StringHelper.formatarTelefone
train
function formatarTelefone($valor) { if (strlen($valor) < 10) { return $this->formatarValor($valor, '####-####'); } if (strlen($valor) == 10) { return $this->formatarValor($valor, '(##) ####-####'); } return $this->formatarValor($valor, '(##) #####-##...
php
{ "resource": "" }
q237008
AbstractExtendableConfigurationController.indexAction
train
public function indexAction(Request $request) { $form = $this->createForm(new ExtendableConfigurationType($this->get('madrak_io_extendable_configuration.extendable_configuration_chain')->getBuiltConfiguration())); $form->setData($this->get('madrak_io_extendable_configuration.configuration_service')-...
php
{ "resource": "" }
q237009
Emoji.char
train
public static function char($symbol) { if (is_string($symbol) && EmojiDictionary::get($symbol)) $symbol = EmojiDictionary::get($symbol); // In case that multiple unicode sequences are used if (is_array($symbol)) { $output = ''; foreach ($symbo...
php
{ "resource": "" }
q237010
Emoji.html
train
public static function html($symbol) { if (is_string($symbol) && EmojiDictionary::get($symbol)) $symbol = EmojiDictionary::get($symbol); // In case that multiple unicode sequences are used if (is_array($symbol)) { $output = ''; foreach ($symbol...
php
{ "resource": "" }
q237011
UrlUtils.removeTrainingSlash
train
public function removeTrainingSlash($url) { if (null === $url || strlen($url) <= 2) { return $url; } return (substr($url, -1, 1) == '/')? substr($url, 0, -1) : $url; }
php
{ "resource": "" }
q237012
UrlUtils.buildUrlString
train
public function buildUrlString($baseUrl, $resource) { if (null === $baseUrl || '' == $baseUrl) { return null; } if (null === $resource || '' == $resource) { return $baseUrl; } $baseUrl = $this->removeTrainingSlash($baseUrl); if (!substr($reso...
php
{ "resource": "" }
q237013
UrlUtils.parseNewLineSeparatedBody
train
public function parseNewLineSeparatedBody($body) { $data = array(); if (!$body) { return $data; } $parts = preg_split("/\\r?\\n/", $body); foreach ($parts as $str) { if (!$str) { continue; } list ($key, $value...
php
{ "resource": "" }
q237014
Asset_Queued.make_output
train
private function make_output( $assets, $type ) { $output = ''; $output .= '<pre>' . $type . ' trovati in coda'."\r\n"; foreach ( $assets->queue as $asset ) { if ( ! isset( $assets->registered[ $asset ] ) ) { continue; } $output .= "\r\nHandle: <strong>" . $asset . "</strong>\n"; $output .= "<...
php
{ "resource": "" }
q237015
ExpressionBuilderFactory.create
train
public function create(ExpressionInterface $expression = null) { if($expression instanceof ConditionInterface) { return new ConditionBuilder($expression); } elseif($expression instanceof JoinInterface) { return new JoinBuilder($expression); } else { return new NullBuilder(); } }
php
{ "resource": "" }
q237016
PhpSerialize.persist
train
public function persist($identifier, ParameterBagInterface $parameterBag) { $stateFilename = $this->getStateFilename($identifier); if (!touch($stateFilename) || (file_exists($stateFilename) && !is_writable($stateFilename))) { throw new IOException("State isn't writable!"); } ...
php
{ "resource": "" }
q237017
PhpSerialize.load
train
public function load($identifier, ParameterBagInterface $parameterBag) { $stateFilename = $this->getStateFilename($identifier); if (!file_exists($stateFilename)) { throw new IOException("State file {$stateFilename} doesn't exist!"); } $stateFileContent = file_get_content...
php
{ "resource": "" }
q237018
Addic7edScrapper.parse
train
protected function parse($url) { $html = $this->get($url)->getBody()->getContents(); $parser = $this->getParser($html); return $parser; }
php
{ "resource": "" }
q237019
Insert.into
train
public function into($table = null): Insert { $this->into = []; if (!\is_string($table) && !\is_array($table)) { throw new InvalidArgumentException('$table has to be an array or a string'); } $this->into = $this->namesClass->parse($table, true); return $this; ...
php
{ "resource": "" }
q237020
BItemsItemRTree.getCollection
train
public function getCollection() { $collectionName = $this->collectionName; if(empty($collectionName)){ return NULL; } $collection = $collectionName::getInstance(); return $collection; }
php
{ "resource": "" }
q237021
BItemsItemRTree.getfieldsvalues
train
protected function getfieldsvalues(&$qr_fields, &$qr_values) { $qr_fields = array(); $qr_values = array(); parent::getfieldsvalues($qr_fields, $qr_values); if (empty($this->{$this->parentKeyName})) { $qr_fields[] = '`' . $this->parentKeyName . '`'; $qr_values[] = 'NULL'; } else { $qr_fields[] = '`' ...
php
{ "resource": "" }
q237022
InventoryItemController.newAction
train
public function newAction(Inventory $inventory) { $inventoryitem = new InventoryItem(); $inventoryitem->setInventory($inventory); $form = $this->createForm(new InventoryItemType(), $inventoryitem); return array( 'inventoryitem' => $inventoryitem, 'form' => $f...
php
{ "resource": "" }
q237023
InventoryItemController.createAction
train
public function createAction(Request $request) { $inventoryitem = new InventoryItem(); $form = $this->createForm(new InventoryItemType(), $inventoryitem); if ($form->handleRequest($request)->isValid()) { $em = $this->getDoctrine()->getManager(); $em->persist($inventor...
php
{ "resource": "" }
q237024
InventoryItemController.editAction
train
public function editAction(InventoryItem $inventoryitem) { $editForm = $this->createForm(new InventoryItemType(), $inventoryitem, array( 'action' => $this->generateUrl('stock_inventoryitem_update', array('id' => $inventoryitem->getid())), 'method' => 'PUT', )); $delet...
php
{ "resource": "" }
q237025
InventoryItemController.updateAction
train
public function updateAction(InventoryItem $inventoryitem, Request $request) { $editForm = $this->createForm(new InventoryItemType(), $inventoryitem, array( 'action' => $this->generateUrl('stock_inventoryitem_update', array('id' => $inventoryitem->getid())), 'method' => 'PUT', ...
php
{ "resource": "" }
q237026
TextDescriptorHelper.describe
train
public function describe(AbstractCommand $command) { // Describe Options $options = $command->getAllOptions(); $optionDescriptor = $this->getOptionDescriptor(); foreach ($options as $option) { $optionDescriptor->addItem($option); } $render['option'] = count($options) ? "\n\nOptions:\n\n" . ...
php
{ "resource": "" }
q237027
RestPaginatorAdapter.getItems
train
public function getItems($offset, $itemCountPerPage) { $cacheKey = $offset . '-' . $itemCountPerPage; if (isset($this->preloadCache[$cacheKey])) { return $this->preloadCache[$cacheKey]; } return $this->loadItems($offset, $itemCountPerPage); }
php
{ "resource": "" }
q237028
CardNumberTrait.getCardNumber
train
public function getCardNumber() : ?string { if ( ! $this->hasCardNumber()) { $this->setCardNumber($this->getDefaultCardNumber()); } return $this->cardNumber; }
php
{ "resource": "" }
q237029
WebDriver_Element.getElementId
train
public function getElementId() { if ($this->elementId === null) { $param = WebDriver_Util::parseLocator($this->locator); $commandUri = (null === $this->parent) ? 'element' : "element/{$this->parent->getElementId()}/element"; $command = $this->driver->factoryCommand($comma...
php
{ "resource": "" }
q237030
WebDriver_Element.tagName
train
public function tagName() { if (!$this->state['tagName']) { $result = $this->sendCommand('element/:id/name', WebDriver_Command::METHOD_GET); $this->state['tagName'] = strtolower($result['value']); } return $this->state['tagName']; }
php
{ "resource": "" }
q237031
WebDriver_Element.location
train
public function location() { $result = $this->sendCommand('element/:id/location', WebDriver_Command::METHOD_GET); $value = $result['value']; return ['x' => $value['x'], 'y' => $value['y']]; }
php
{ "resource": "" }
q237032
WURFL_Request_UserAgentNormalizer_Specific_Chrome.chromeWithMajorVersion
train
private function chromeWithMajorVersion($userAgent) { $start_idx = strpos($userAgent, 'Chrome'); $end_idx = strpos($userAgent, '.', $start_idx); if ($end_idx === false) { return substr($userAgent, $start_idx); } else { return substr($userAgent, $start_idx, ($end_idx - $start_idx)); } }
php
{ "resource": "" }
q237033
TreeManager.findOrFail
train
public function findOrFail($fullslug) { if (!$tree = $this->find($fullslug)) { throw (new ModelNotFoundException)->setModel(Tree::class); } return $tree; }
php
{ "resource": "" }
q237034
ReferenceProcessor.resolveValue
train
protected function resolveValue(Config $config, $key) { $value = $config->getRequired($key); if (is_array($value)) { throw new KeyException(sprintf('Referenced configuration key "%s" must not be an array.', $key)); } if (in_array($key, $this->referenceStack)) { ...
php
{ "resource": "" }
q237035
BasicAuthConnector.connect
train
public function connect(array $config) { $connection = $this->createConnection($config); $this->validateCredentials($config); // For basic authentication we need an Authorization // header to be set. We add it to the request here. $this->addHeader( 'Authorizatio...
php
{ "resource": "" }
q237036
Finder.sortByNameDesc
train
public function sortByNameDesc() { $this->sort( function (SplFileInfo $a, SplFileInfo $b) { return strcmp($b->getRealpath(), $a->getRealpath()); } ); return $this; }
php
{ "resource": "" }
q237037
Finder.sortByAccessedTimeDesc
train
public function sortByAccessedTimeDesc() { $this->sort( function (SplFileInfo $a, SplFileInfo $b) { return ($b->getATime() - $a->getATime()); } ); return $this; }
php
{ "resource": "" }
q237038
Finder.sortByChangedTimeDesc
train
public function sortByChangedTimeDesc() { $this->sort( function (SplFileInfo $a, SplFileInfo $b) { return ($b->getCTime() - $a->getCTime()); } ); return $this; }
php
{ "resource": "" }
q237039
Finder.sortByModifiedTimeDesc
train
public function sortByModifiedTimeDesc() { $this->sort( function (SplFileInfo $a, SplFileInfo $b) { return ($b->getMTime() - $a->getMTime()); } ); return $this; }
php
{ "resource": "" }
q237040
Finder.getNFirst
train
public function getNFirst($n) { $it = new \ArrayIterator(); $j = 0; foreach ($this as $file) { if ($j == $n) { break; } $j++; $it->append($file); } $finder = new static(); $finder->append($it); ...
php
{ "resource": "" }
q237041
MonologChannelManager.getAllLoggers
train
public function getAllLoggers() { // instantiate all loggers foreach ($this->config->getChannelConfigs() as $name => $config) { $this->getLogger($name); } return $this->getLoggers(); }
php
{ "resource": "" }
q237042
InvoiceAddressTrait.getInvoiceAddress
train
public function getInvoiceAddress() : ?string { if ( ! $this->hasInvoiceAddress()) { $this->setInvoiceAddress($this->getDefaultInvoiceAddress()); } return $this->invoiceAddress; }
php
{ "resource": "" }
q237043
HCPagesController.options
train
public function options() { if (request()->has('language')) { $pages = HCPagesTranslations::select('record_id as id', 'title', 'language_code') ->where('language_code', request('language')); if (request()->has('type')) { $pages->whereHas('record', fun...
php
{ "resource": "" }
q237044
Error.indexAction
train
public function indexAction() { header("HTTP/1.0 404 Not Found"); $data['title'] = '404'; $data['error'] = $this->_error; $this->view->render('error/404', $data); }
php
{ "resource": "" }
q237045
Request.getUri
train
public function getUri($withBaseUrl = false) { $prefix = $withBaseUrl ? $this->getBaseUrl() : ''; $uri = $prefix . $this->uri; $uri = '/' . ltrim($uri, '/'); return $uri; }
php
{ "resource": "" }
q237046
Request.getParams
train
public function getParams($withActionParams = false) { return $withActionParams ? array_merge($this->actionParams, $this->params) : $this->params; }
php
{ "resource": "" }
q237047
Request.getParam
train
public function getParam(string $key) { $isActionParam = in_array($key, [self::PARAM_CONTROLLER, self::PARAM_ACTION]); $params = $isActionParam ? $this->actionParams: $this->params; return array_key_exists($key, $params) ? $params[$key] : null; }
php
{ "resource": "" }
q237048
GenericFilter.getURLQuery
train
public function getURLQuery() { $qstr = '?'; $params = $this->getParametersArray(); $paramCount = count($params); $i = 0; foreach ($params as $key => $value) { if ($value === null) { continue; } $qstr .= $key . '=' . rawu...
php
{ "resource": "" }
q237049
iauGst06.Gst06
train
public static function Gst06($uta, $utb, $tta, $ttb, array $rnpb) { $x; $y; $s; $era; $eors; $gst; /* Extract CIP coordinates. */ IAU::Bpn2xy($rnpb, $x, $y); /* The CIO locator, s. */ $s = IAU::S06($tta, $ttb, $x, $y); /* Greenwich apparent sidereal time. */ $era = IA...
php
{ "resource": "" }
q237050
BackendRedirect.redirectUser
train
public function redirectUser( $id, $setFlash = true, $indexAction = ['index'], $editAction = ['edit'], $overrideReturnUrl = false ) { /** @var \yii\web\Controller $this */ if ($setFlash === true) { Yii::$app->session->setFlash('success', AdminModul...
php
{ "resource": "" }
q237051
Symfony2.convertFromRequest
train
public function convertFromRequest(SimplifiedRequest $request) { return Request::create( $request->path, $request->method, array(), array(), array(), $this->mapHeaderKeys($request->headers), $request->content ); ...
php
{ "resource": "" }
q237052
Symfony2.mapHeaderKeys
train
protected function mapHeaderKeys(array $headers) { $phpHeaders = array(); foreach ($headers as $key => $value) { $phpHeaders['HTTP_' . str_replace('-', '_', strtoupper($key))] = $value; } return $phpHeaders; }
php
{ "resource": "" }
q237053
Symfony2.convertFromResponse
train
public function convertFromResponse(SimplifiedResponse $response) { return Response::create( $response->content, $response->status, $response->headers ); }
php
{ "resource": "" }
q237054
AssetsMinifier.compress
train
public function compress($type, $files, $file) { // files have been updated so update the minified file if($this->isUpdated($files)) { $content = $this->getFileContents($files); switch($type){ case 'css': $content = $this->minifyCSS($content); break; case 'js': $content = $this->mini...
php
{ "resource": "" }
q237055
AssetsMinifier.getFileContents
train
private function getFileContents($files) { $content = ''; $basePath = $this->basePath; array_walk($files,function(&$value, $key) use(&$content, $basePath){ if(file_exists($basePath.$value)) $content .= file_get_contents($basePath.$value); }); return $content; }
php
{ "resource": "" }
q237056
HasHttpRequest.getBaseOptions
train
protected function getBaseOptions() { $options = [ 'base_uri' => property_exists($this, 'baseUri') ? $this->baseUri : '', 'timeout' => property_exists($this, 'timeout') ? $this->timeout : 5.0, 'connect_timeout' => property_exists($this, 'connect_timeout'...
php
{ "resource": "" }
q237057
EntityCreateMethods.add
train
public function add() { $form = $this->getForm(); $this->set(compact('form')); if (!$form->wasSubmitted()) { return; } try { $this->getUpdateService() ->setForm($form) ->update(); ; ...
php
{ "resource": "" }
q237058
PHP_ParserGenerator.handleflags
train
function handleflags($i, $argv) { if (!isset($argv[1]) || !isset(self::$_options[$argv[$i][1]])) { throw new Exception('Command line syntax error: undefined option "' . $argv[$i] . '"'); } $v = self::$_options[$argv[$i][1]] == '-'; if (self::$_options[$argv[$i][1]]['type...
php
{ "resource": "" }
q237059
PHP_ParserGenerator._argindex
train
private function _argindex($n, $a) { $dashdash = 0; if (!is_array($a) || !count($a)) { return -1; } for ($i=1; $i < count($a); $i++) { if ($dashdash || !($a[$i][0] == '-' || $a[$i][0] == '+' || strchr($a[$i], '='))) { if ($n == 0) { ...
php
{ "resource": "" }
q237060
PHP_ParserGenerator.OptPrint
train
function OptPrint() { $max = 0; foreach (self::$_options as $label => $info) { $len = strlen($label) + 1; switch ($info['type']) { case self::OPT_FLAG: case self::OPT_FFLAG: break; case self::OPT_INT: case self::...
php
{ "resource": "" }
q237061
PHP_ParserGenerator._handleDOption
train
private function _handleDOption($z) { if ($a = strstr($z, '=')) { $z = substr($a, 1); // strip first = } $this->azDefine[] = $z; }
php
{ "resource": "" }
q237062
PHP_ParserGenerator.merge
train
static function merge($a, $b, $cmp, $offset) { if ($a === 0) { $head = $b; } elseif ($b === 0) { $head = $a; } else { if (call_user_func($cmp, $a, $b) < 0) { $ptr = $a; $a = $a->$offset; } else { ...
php
{ "resource": "" }
q237063
PHP_ParserGenerator.Reprint
train
function Reprint() { printf("// Reprint of input file \"%s\".\n// Symbols:\n", $this->filename); $maxlen = 10; for ($i = 0; $i < $this->nsymbol; $i++) { $sp = $this->symbols[$i]; $len = strlen($sp->name); if ($len > $maxlen ) { $maxlen = $l...
php
{ "resource": "" }
q237064
Controller.passRequestData
train
public function passRequestData() { $this ->getValidator() ->setInputData($this ->getRequest() ->query ->all() ); $this ->getValidator() ->setInputData($th...
php
{ "resource": "" }
q237065
Controller.getRepository
train
public function getRepository($name = null) { // Resolve repository class name $repositoryName = $this->resolveRepositoryClassName($name); return new $repositoryName($this->getValidator(), $this->config); }
php
{ "resource": "" }
q237066
Controller.getRepositoryClassnameByReference
train
public static function getRepositoryClassnameByReference($reference) { $parts = explode(':', $reference); // Check name is string if (!is_string($reference) || count($parts) !== 3) { throw new \Exception("Invalid Repository Class Reference. Repository reference should consist of...
php
{ "resource": "" }
q237067
CleanupCommand.removeFiles
train
private function removeFiles($files) { // Grab the duration $duration = $this->option('duration'); // Grab the minimum acceptable timestamp $timestamp = time() - $duration; // Cycle through the list checking their creation dates foreach($files as $file) ...
php
{ "resource": "" }
q237068
CleanupCommand.buildFileList
train
private function buildFileList($folder) { // The list of files to use $files = array(); // Cycle through all of the files in our storage folder removing // any files that exceed the cache duration. $directory = new DirectoryIterator($folder); foreach ($directory as ...
php
{ "resource": "" }
q237069
CookieComponent.check
train
public function check($name) { // is in cache? if(isset($this->cache[$name])) return true; return $this->cookies->has($name); }
php
{ "resource": "" }
q237070
EnolaContext.init
train
public function init(){ $file= 'config'; //Seleccion el archivo de configuracion correspondiente segun el MODO y el DOMINIO if($this->multiDomain && $this->domain){ //Ya no importa el modo, se definio todo antes si busca o no por dominio //if(ENOLA_MODE == 'HTTP'){ ...
php
{ "resource": "" }
q237071
EnolaContext.setBasicConstants
train
private function setBasicConstants(){ //Algunas constantes - La idea es ir sacandolas //PATHROOT: direccion de la carpeta del framework - definida en index.php define('PATHROOT', $this->getPathRoot()); //PATHFRA: direccion de la carpeta del framework - definida en index.php defin...
php
{ "resource": "" }
q237072
EnolaContext.readConfigurationFile
train
public function readConfigurationFile($name, $cache = TRUE){ //Lee archivo de configuracion principal donde se encuentra toda la configuracion de variables, filtros, controladores, etc. $config= NULL; if($this->cacheConfigFiles && $cache && $this->app->cache != NULL){ //Si esta en pr...
php
{ "resource": "" }
q237073
EnolaContext.compileConfigurationFile
train
public function compileConfigurationFile($file){ //CARGAMOS LA DEPENDENCIA POR SI ES NECESARIA require_once $this->pathFra . 'Support/Spyc.php'; $info= new \SplFileInfo($file); $path= $info->getPath() . '/'; $name= $info->getBasename('.' . $info->getExtension()); ...
php
{ "resource": "" }
q237074
EnolaContext.readFile
train
private function readFile($name, $folder = null){ $realConfig= NULL; $folder != null ?: $folder= $this->pathApp . $this->configurationFolder; if($this->configurationType == 'YAML'){ $realConfig = \Spyc::YAMLLoad($folder . $name . '.yml'); }else if($this->configura...
php
{ "resource": "" }
q237075
EnolaContext.readFileSpecific
train
public function readFileSpecific($path, $extension = 'yml'){ $realConfig= NULL; if($extension == 'yml'){ $realConfig = \Spyc::YAMLLoad($path); }else if($extension == 'php'){ include $path; //La variable $config la define cada archivo incluido ...
php
{ "resource": "" }
q237076
FilterModifier.hasAllRequiredData
train
protected function hasAllRequiredData(array $modifier) { if (array_key_exists('operator', $modifier) && !in_array($modifier['operator'], self::$allowedFilterOperators) ) { throw new ModifierException('The filter operator "' . $modifier['operator'] . '" is not ...
php
{ "resource": "" }
q237077
SecurityServiceProvider.register
train
public function register(\Silex\Application $app) { parent::register($app); // Register voters $app->extend('security.voters', function($voters) { return array_merge($voters, $this->voters); }); // Add reference to this in application instance $this->app...
php
{ "resource": "" }
q237078
SecurityServiceProvider.boot
train
public function boot(\Silex\Application $app) { // Register firewalls foreach ($this->firewalls as $firewall) { $firewall->register($this); } $i = 0; $firewalls = array(); foreach ($this->unsecuredPatterns as $pattern => $v) { $firewal...
php
{ "resource": "" }
q237079
SecurityServiceProvider.getFirewall
train
public function getFirewall($path = null) { if (!$path) { $path = $this->getCurrentPathRelativeToBase(); } foreach ($this->firewalls as $firewall) { if ($firewall->isPathCovered($path)) { return $firewall; } } return null; ...
php
{ "resource": "" }
q237080
SecurityServiceProvider.getLoginCheckPath
train
public function getLoginCheckPath() { $login_check = $this->app['request']->getBasePath(); if (($firewall = $this->getFirewall($this->getCurrentPathRelativeToBase()))) { $login_check .= $firewall->getLoginCheckPath(); } return $login_check; }
php
{ "resource": "" }
q237081
SecurityServiceProvider.getLogoutPath
train
public function getLogoutPath() { $logout = $this->app['request']->getBasePath(); if (($firewall = $this->getFirewall($this->getCurrentPathRelativeToBase()))) { $logout .= $firewall->getLogoutPath(); } return $logout; }
php
{ "resource": "" }
q237082
SecurityServiceProvider.prependFirewallConfig
train
public function prependFirewallConfig($name, $config) { $this->firewallConfig = array_merge( array($name => $config), $this->firewallConfig); }
php
{ "resource": "" }
q237083
SecurityServiceProvider.addAuthorizationVoter
train
public function addAuthorizationVoter(VoterInterface $voter) { if (!in_array($voter, $this->voters)) { $this->voters[] = $voter; } }
php
{ "resource": "" }
q237084
SecurityServiceProvider.isGranted
train
public function isGranted($attributes, $object = null, $catchException = true) { try { return $this->app['security.authorization_checker']->isGranted($attributes, $object); } catch (AuthenticationCredentialsNotFoundException $e) { if ($catchExcep...
php
{ "resource": "" }
q237085
SecurityServiceProvider.getCurrentPathRelativeToBase
train
protected function getCurrentPathRelativeToBase($path = null) { if (!$path) { // using $_SERVER instead of using Request method // to get original request path instead of any forwarded request $path = $_SERVER['REQUEST_URI']; } $base_path = $this->app['req...
php
{ "resource": "" }
q237086
LikePDOStatement.debugDumpParams
train
public function debugDumpParams() { if(!is_resource($this->resource)) { throw new LikePDOException("There is no active statement"); return false; } else { $parameters = array(); if(count($this->parametersBound) > 0) { foreach($this->parametersBound as $key => $param) ...
php
{ "resource": "" }
q237087
LikePDOStatement.nextRowset
train
public function nextRowset() { if(!is_resource($this->resource)) { throw new LikePDOException("There is no active statement"); return false; } else { return $this->pdo->driver->nextResult($this->resource); } }
php
{ "resource": "" }
q237088
Controller.getFilters
train
public function getFilters() { $filters = []; $names = explode('_', $this->name); $base = ''; $filters = []; while ($name = array_shift($names)) { $filter = $this->_searchInControllerDir($base, 'filter.yml'); if ($filter) $filters[] = $filter; ...
php
{ "resource": "" }
q237089
Controller.getFilterKey
train
public function getFilterKey($action = null) { // controller.action $controller = $this->getName(); return $action ? $controller . '.' . $action : $controller; }
php
{ "resource": "" }
q237090
Controller.task
train
public function task($name, array $options = []) { $this->taskProcessor->setOutput($this); $this->taskProcessor->execute($name, $options); }
php
{ "resource": "" }
q237091
Controller._searchInControllerDir
train
private function _searchInControllerDir($base_dir, $file_name) { $dirs = $this->application->getControllerDirectories(); foreach ($dirs as $dir) { $filter = $this->finder->path($dir . $base_dir)->name($file_name)->find()->first(); if ($filter) return $filter; } }
php
{ "resource": "" }
q237092
Compiler.addPHPFiles
train
private function addPHPFiles(Phar $phar) { $finder = new Finder(); $finder ->files() ->ignoreVCS(true) ->name('*.php') ->notName('Compiler.php') ->in(realpath(__DIR__.'/../../src')); foreach ($finder as $file) { $this->...
php
{ "resource": "" }
q237093
Compiler.addVendorFiles
train
private function addVendorFiles(Phar $phar) { $vendorPath = __DIR__.'/../../vendor/'; $requiredDependencies = [ realpath($vendorPath.'symfony/'), realpath($vendorPath.'doctrine/'), realpath($vendorPath.'guzzlehttp'), realpath($vendorPath.'psr'), ...
php
{ "resource": "" }
q237094
Compiler.addComposerVendorFiles
train
private function addComposerVendorFiles(Phar $phar) { $vendorPath = __DIR__.'/../../vendor/'; $this ->addFile($phar, new \SplFileInfo($vendorPath.'autoload.php')) ->addFile($phar, new \SplFileInfo($vendorPath.'composer/autoload_namespaces.php')) ->addFile($phar, ...
php
{ "resource": "" }
q237095
iauEe00a.Ee00a
train
public static function Ee00a($date1, $date2) { $dpsipr; $depspr; $epsa; $dpsi; $deps; $ee; /* IAU 2000 precession-rate adjustments. */ IAU::Pr00($date1, $date2, $dpsipr, $depspr); /* Mean obliquity, consistent with IAU 2000 precession-nutation. */ $epsa = IAU::Obl80($date1, $da...
php
{ "resource": "" }
q237096
Network.assumeSocket
train
public static function assumeSocket($address, $port = 0): void { $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP); assumeThat($socket, is(not(false)), self::$SOCK_ERR_MSG . socket_last_error($socket)); assumeThat( @socket_connect($socket, $address, $port), is(...
php
{ "resource": "" }
q237097
PointerFormat.normalize
train
public static function normalize($pointer, array $context = null) { if (is_object($pointer)) { return ['value' => $pointer]; } if (is_string($pointer)) { return ['classname' => $pointer]; } if ($pointer === null) { return []; } ...
php
{ "resource": "" }
q237098
FrontendListUnsubscribeController.unsubscribe
train
public function unsubscribe($token) { // Does the token exist in the list_unsubscribe_token database table? if (!$this->model->isTokenValid($token)) { return view('lasallecrmlistmanagement::subscribe-unsubscribe-list.token_invalid', [ 'title' => 'Invalid Unsubscribe Token...
php
{ "resource": "" }
q237099
ConfigurationManager.get
train
public function get($configurationIdentifier, $defaultValue = null) { /** * Checks if the value is defined in the configuration elements. */ if (!array_key_exists($configurationIdentifier, $this->configurationElements)) { if (!is_null($defaultValue)) { r...
php
{ "resource": "" }