_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q8400
Initializations.initStrictExceptionsMode
train
protected static function initStrictExceptionsMode ($strictExceptionsMode) { $errorLevelsToExceptions = []; if ($strictExceptionsMode !== FALSE) { $sysCfgDebug = static::getSystemCfgDebugSection(); if (isset($sysCfgDebug['strictExceptions'])) { $rawStrictExceptions = $sysCfgDebug['strictExceptions']; ...
php
{ "resource": "" }
q8401
Initializations.initHandlers
train
protected static function initHandlers () { $className = version_compare(PHP_VERSION, '5.5', '>') ? static::class : get_called_class(); foreach (static::$handlers as $key => $value) { static::$handlers[$key] = [$className, $value]; } register_shutdown_function(static::$handlers['shutdownHandler']); }
php
{ "resource": "" }
q8402
Initializations.initLogDirectory
train
protected static function initLogDirectory () { //if (static::$logDirectoryInitialized) return; $sysCfgDebug = static::getSystemCfgDebugSection(); $logDirConfiguredPath = isset($sysCfgDebug['logDirectory']) ? $sysCfgDebug['logDirectory'] : static::$LogDirectory; if (mb_substr($logDirConfiguredPath, 0, 1...
php
{ "resource": "" }
q8403
Instancing.&
train
public function & InitAll () { /** @var $this \MvcCore\Request */ $this->GetScriptName(); $this->GetAppRoot(); $this->GetMethod(); $this->GetBasePath(); $this->GetScheme(); $this->IsSecure(); $this->GetHostName(); $this->GetHost(); $this->GetRequestPath(); $this->GetFullUrl(); $this->GetReferer(...
php
{ "resource": "" }
q8404
Configuration.createResolver
train
public function createResolver() { $resolver = $this->getResolver(); if (isset($resolver)) { $resolver_class = get_class($resolver); // Create new retriever. $retriever = $resolver->getUriRetriever(); if (isset($retriever)) { $retriever_class ...
php
{ "resource": "" }
q8405
DatabaseQuery.handle
train
public function handle(LogManager $logger): void { $db = \resolve('db'); $callback = $this->buildQueryCallback($logger); foreach ($db->getQueryLog() as $query) { $callback(new QueryExecuted($query['query'], $query['bindings'], $query['time'], $db)); } \resolve(...
php
{ "resource": "" }
q8406
DatabaseQuery.buildQueryCallback
train
protected function buildQueryCallback(LogManager $logger): callable { return function (QueryExecuted $query) use ($logger) { $sql = Str::replaceArray('?', $query->connection->prepareBindings($query->bindings), $query->sql); $logger->info("<comment>{$sql} [{$query->time}ms]</comment>...
php
{ "resource": "" }
q8407
UrlRewriteSubject.storeIsActive
train
public function storeIsActive($storeViewCode) { // query whether or not, the requested store is available if (isset($this->stores[$storeViewCode])) { return 1 === (integer) $this->stores[$storeViewCode][MemberNames::IS_ACTIVE]; } // throw an exception, if not th...
php
{ "resource": "" }
q8408
InternalInits.initReverseParamsGetGreedyInfo
train
protected function initReverseParamsGetGreedyInfo (& $reverseSectionsInfo, & $constraints, & $paramName, & $sectionIndex, & $greedyCaught) { // complete greedy flag by star character inside param name $greedyFlag = mb_strpos($paramName, '*') !== FALSE; $sectionIsLast = NULL; // check greedy param specifics if...
php
{ "resource": "" }
q8409
InternalInits.initFlagsByPatternOrReverse
train
protected function initFlagsByPatternOrReverse ($pattern) { $scheme = static::FLAG_SCHEME_NO; if (mb_strpos($pattern, '//') === 0) { $scheme = static::FLAG_SCHEME_ANY; } else if (mb_strpos($pattern, 'http://') === 0) { $scheme = static::FLAG_SCHEME_HTTP; } else if (mb_strpos($pattern, 'https://') === 0) {...
php
{ "resource": "" }
q8410
InternalInits.throwExceptionIfKeyPropertyIsMissing
train
protected function throwExceptionIfKeyPropertyIsMissing ($propsNames) { $propsNames = func_get_args(); $selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__; throw new \LogicException( "[".$selfClass."] Route configuration property/properties is/are" ." missing: `" . implode("`, `"...
php
{ "resource": "" }
q8411
Cookies.SetCookie
train
public function SetCookie ( $name, $value, $lifetime = 0, $path = '/', $domain = NULL, $secure = NULL, $httpOnly = TRUE ) { if ($this->IsSent()) { $selfClass = version_compare(PHP_VERSION, '5.5', '>') ? self::class : __CLASS__; throw new \RuntimeException( "[".$selfClass."] Cannot set cookie after HT...
php
{ "resource": "" }
q8412
Cookies.DeleteCookie
train
public function DeleteCookie ($name, $path = '/', $domain = NULL, $secure = NULL) { return $this->SetCookie($name, '', 0, $path, $domain, $secure); }
php
{ "resource": "" }
q8413
AttributeTrait.withAttribute
train
public function withAttribute($key, $value) { $newAttributes = $this->attributes->withAttribute($key, $value); $that = clone($this); $that->attributes = $newAttributes; return $that; }
php
{ "resource": "" }
q8414
AttributeTrait.withoutAttribute
train
public function withoutAttribute($key) { $newAttributes = $this->attributes->withoutAttribute($key); $that = clone($this); $that->attributes = $newAttributes; return $that; }
php
{ "resource": "" }
q8415
HttpRequest.createCurl
train
protected function createCurl() { $ch = curl_init(); // Add the body first so we can calculate a content length. $body = ''; if ($this->method === self::METHOD_HEAD) { curl_setopt($ch, CURLOPT_NOBODY, true); } elseif ($this->method !== self::METHOD_GET) { ...
php
{ "resource": "" }
q8416
HttpRequest.makeCurlBody
train
protected function makeCurlBody() { $body = $this->body; if (is_string($body)) { return (string)$body; } $contentType = $this->getHeader('Content-Type'); if (stripos($contentType, 'application/json') === 0) { $body = json_encode($body); } ...
php
{ "resource": "" }
q8417
HttpRequest.execCurl
train
protected function execCurl($ch) { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HEADER, true); $response = curl_exec($ch); // Split the full response into its headers and body $info = curl_getinfo($ch); $code = $info["http_code"]; if (...
php
{ "resource": "" }
q8418
RGBColor.isValidChannelValue
train
public function isValidChannelValue($value, $channel) { if (!in_array($channel, self::$channels)) { throw new \InvalidArgumentException('Invalid Channel Name'); } if ($channel == self::CHANNEL_ALPHA) { if ($value >= 0 && $value <= 127) { return true; ...
php
{ "resource": "" }
q8419
RGBColor.setAlpha
train
public function setAlpha($alpha) { $this->assertChannelValue($alpha, self::CHANNEL_ALPHA); $this->alpha = $alpha; return $this; }
php
{ "resource": "" }
q8420
RGBColor.setRed
train
public function setRed($value) { $this->assertChannelValue($value, self::CHANNEL_RED); $this->red = $value; return $this; }
php
{ "resource": "" }
q8421
RGBColor.setGreen
train
public function setGreen($value) { $this->assertChannelValue($value, self::CHANNEL_GREEN); $this->green = $value; return $this; }
php
{ "resource": "" }
q8422
RGBColor.setBlue
train
public function setBlue($value) { $this->assertChannelValue($value, self::CHANNEL_BLUE); $this->blue = $value; return $this; }
php
{ "resource": "" }
q8423
RGBColor.getValue
train
public function getValue() { return (((int) $this->getRed() & 0xFF) << 16) | (((int) $this->getGreen() & 0xFF) << 8) | (((int) $this->getBlue() & 0xFF)) | (((int) $this->getAlpha() & 0xFF) << 24); }
php
{ "resource": "" }
q8424
RGBColor.setFromRGBColor
train
public function setFromRGBColor(RGBColor $color) { return $this->setRed($color->getRed()) ->setGreen($color->getGreen()) ->setBlue($color->getBlue()) ->setAlpha($color->getAlpha()); }
php
{ "resource": "" }
q8425
RGBColor.setFromArray
train
public function setFromArray(array $color) { return $this->setRed($color[0]) ->setGreen($color[1]) ->setBlue($color[2]) ->setAlpha($color[3]); }
php
{ "resource": "" }
q8426
RGBColor.setFromValue
train
public function setFromValue($rgb, $hasalpha = true) { $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = ($rgb >> 0) & 0xFF; if ($hasalpha) { $a = ($rgb >> 24) & 0xff; return $this->setRed($r) ->setGreen($g) ...
php
{ "resource": "" }
q8427
RGBColor.setFromHex
train
public function setFromHex($hex, $alpha = 0) { if (!preg_match(self::$HexRegex, $hex)) { throw new \InvalidArgumentException(sprintf( 'Inavlid Hex Color "%s"', $hex )); } $ehex = ltrim($hex, '#'); if (strlen($ehex) === 3) { $e...
php
{ "resource": "" }
q8428
RGBColor.getRGBColor
train
public function getRGBColor() { return new self( $this->getRed() , $this->getGreen() , $this->getBlue() , $this->getAlpha() ); }
php
{ "resource": "" }
q8429
RGBColor.brighter
train
public function brighter($shade = 0.7) { $r = $this->getRed(); $g = $this->getGreen(); $b = $this->getBlue(); $alpha = $this->getAlpha(); $i = (integer) (1.0 / (1.0 - $shade)); if ($r == 0 && $g == 0 && $b == 0) { return new self($i, $i, $i, $alpha); ...
php
{ "resource": "" }
q8430
RGBColor.darker
train
public function darker($shade = 0.7) { return $this->setFromArray(array( max(array((integer) $this->getRed() * $shade, 0)) , max(array((integer) $this->getGreen() * $shade, 0)) , max(array((integer) $this->getBlue() * $shade, 0)) ...
php
{ "resource": "" }
q8431
RGBColor.blend
train
public function blend(RGBColor $color, $amount) { return $this->setFromArray(array( min(255, min($this->getRed(), $color->getRed()) + round(abs($color->getRed() - $this->getRed()) * $amount)) , min(255, min($this->getGreen(), $color->getGreen()) + round(abs($color->ge...
php
{ "resource": "" }
q8432
RGBColor.grayscale
train
public function grayscale() { $gray = min( 255 , round( 0.299 * $this->getRed() + 0.587 * $this->getGreen() + 0.114 * $this->getBlue() ) ); return $this->setFromArray(arra...
php
{ "resource": "" }
q8433
RGBColor.assertChannelValue
train
protected function assertChannelValue($value, $channel) { if (!$this->isValidChannelValue($value, $channel)) { throw new \InvalidArgumentException( sprintf('Invalid Value "%s" For The %s Channel' , $value, ucfirst($value)) ); } return ...
php
{ "resource": "" }
q8434
BuildMetaModelOperationsListener.buildCommand
train
private function buildCommand($attribute, array $propertyData) { if ($attribute->get('check_listview') == 1) { $commandName = 'listviewtoggle_' . $attribute->getColName(); } else { $commandName = 'publishtoggle_' . $attribute->getColName(); } $toggle = new Tog...
php
{ "resource": "" }
q8435
BuildMetaModelOperationsListener.createBackendViewDefinition
train
protected function createBackendViewDefinition($container) { if ($container->hasDefinition(Contao2BackendViewDefinitionInterface::NAME)) { $view = $container->getDefinition(Contao2BackendViewDefinitionInterface::NAME); } else { $view = new Contao2BackendViewDefinition(); ...
php
{ "resource": "" }
q8436
BuildMetaModelOperationsListener.handle
train
public function handle(BuildMetaModelOperationsEvent $event) { if (!$this->scopeMatcher->currentScopeIsBackend()) { return; } $allProps = $event->getScreen()['properties']; $properties = \array_map(function ($property) { return ($property['col_name'] ?? null...
php
{ "resource": "" }
q8437
BuildMetaModelOperationsListener.wantToAdd
train
private function wantToAdd($attribute, array $properties): bool { return ($attribute instanceof Checkbox) && (($attribute->get('check_publish') === '1') || ($attribute->get('check_listview') === '1')) && (\in_array($attribute->getColName(), $properties, true)); }
php
{ "resource": "" }
q8438
Select.buildBoostedFields
train
public function buildBoostedFields($fields) { // Assume strings are pre-formatted. if (is_string($fields)) { return $fields; } $processed = array(); foreach ($fields as $fieldName => $boost) { if (!is_array($boost)) { $processed[] = $f...
php
{ "resource": "" }
q8439
AbstractPixelate.setBlockSize
train
public function setBlockSize($size) { if ($size <= 1) { throw new \InvalidArgumentException("Pixel Size Must Be Greater Than One"); } $this->size = (int) abs($size); return $this; }
php
{ "resource": "" }
q8440
Migrator.initialize
train
public function initialize() { if ($this->versionStorage->hasVersioningNode()) { throw new MigratorException('This repository has already been initialized. Will not re-initialize.'); } foreach (array_keys($this->versionCollection->getAllVersions()) as $timestamp) { $...
php
{ "resource": "" }
q8441
Migrator.resolveTo
train
private function resolveTo($to, $from) { if (is_string($to)) { $to = strtolower($to); } if ($to === 'down') { $to = $this->versionCollection->getPreviousVersion($from); } if ($to === 'up') { $to = $this->versionCollection->getNextVersion(...
php
{ "resource": "" }
q8442
Directory.add
train
public function add($name, Closure $callback = null) { try { $path = $this->finder->find($name); if (isset($this->assets[$path])) { $asset = $this->assets[$path]; } else { $asset = $this->factory...
php
{ "resource": "" }
q8443
Directory.javascript
train
public function javascript($name, Closure $callback = null) { return $this->add($name, function($asset) use ($callback) { $asset->setGroup('javascripts'); is_callable($callback) and call_user_func($callback, $asset); }); }
php
{ "resource": "" }
q8444
Directory.directory
train
public function directory($path, Closure $callback = null) { try { $path = $this->finder->setWorkingDirectory($path); $this->directories[$path] = new Directory($this->factory, $this->finder, $path); // Once we've set the working directory we'll fire the callback...
php
{ "resource": "" }
q8445
Directory.requireDirectory
train
public function requireDirectory($path = null) { if ( ! is_null($path)) { return $this->directory($path)->requireDirectory(); } if ($iterator = $this->iterateDirectory($this->path)) { return $this->processRequire($iterator); } return ...
php
{ "resource": "" }
q8446
Directory.requireTree
train
public function requireTree($path = null) { if ( ! is_null($path)) { return $this->directory($path)->requireTree(); } if ($iterator = $this->recursivelyIterateDirectory($this->path)) { return $this->processRequire($iterator); } return...
php
{ "resource": "" }
q8447
Directory.processRequire
train
protected function processRequire(Iterator $iterator) { // sort iterator by name $iterator = new SortingIterator($iterator, 'strnatcasecmp'); // Spin through each of the files within the iterator and if their a valid asset they // are added to the array of assets for this directory....
php
{ "resource": "" }
q8448
Directory.except
train
public function except($assets) { $assets = array_flatten(func_get_args()); // Store the directory instance on a variable that we can inject into the scope of // the closure below. This allows us to call the path conversion method. $directory = $this; $this->assets = $this-...
php
{ "resource": "" }
q8449
Directory.getPathRelativeToDirectory
train
public function getPathRelativeToDirectory($path) { // Get the last segment of the directory as asset paths will be relative to this // path. We can then replace this segment with nothing in the assets path. $directoryLastSegment = substr($this->path, strrpos($this->path, '/') + 1); ...
php
{ "resource": "" }
q8450
Directory.rawOnEnvironment
train
public function rawOnEnvironment($environment) { $this->assets->each(function($asset) use ($environment) { $asset->rawOnEnvironment($environment); }); return $this; }
php
{ "resource": "" }
q8451
Directory.getAssets
train
public function getAssets() { $assets = $this->assets; // Spin through each directory and recursively merge the current directories assets // on to the directories assets. This maintains the order of adding in the array // structure. $this->directories->each(function($direct...
php
{ "resource": "" }
q8452
LinearGradient.setType
train
public function setType($type) { if (!in_array($type, self::$supported)) { throw new \InvalidArgumentException(sprintf( 'Invalid LinearGradient Gradient Type ""', (string) $type )); } $this->type = $type; }
php
{ "resource": "" }
q8453
MelisPageTreeTable.getFullDatasPage
train
public function getFullDatasPage($id, $type = '') { $select = $this->tableGateway->getSql()->select(); $select->columns(array('*')); $select->join('melis_cms_page_lang', 'melis_cms_page_lang.plang_page_id = melis_cms_page_tree.tree_page_id', array('plang_lang_id')); $select->join('melis_cms_lang',...
php
{ "resource": "" }
q8454
MelisPageTreeTable.getPageChildrenByidPage
train
public function getPageChildrenByidPage($id, $publishedOnly = 0) { $select = $this->tableGateway->getSql()->select(); $select->columns(array('*')); $select->join('melis_cms_page_lang', 'melis_cms_page_lang.plang_page_id = melis_cms_page_tree.tree_page_id', array('plang_lang_id')); $select->join('m...
php
{ "resource": "" }
q8455
MelisPageTreeTable.getPagesBySearchValue
train
public function getPagesBySearchValue($value, $type = '') { $select = $this->tableGateway->getSql()->select(); $select->columns(array('tree_page_id')); if ($type == 'published' || $type == ''){ $select->join('melis_cms_page_published', 'melis_cms_page_published.page_id = melis_cms_page_tr...
php
{ "resource": "" }
q8456
MelisTemplateTable.getSortedTemplates
train
public function getSortedTemplates() { $select = new Select('melis_cms_template'); $select->order('tpl_zf2_website_folder ASC'); $select->order('tpl_name ASC'); $resultSet = $this->tableGateway->selectWith($select); return $resultSet; }
php
{ "resource": "" }
q8457
AbstractPreset.getOverlayCanvas
train
public function getOverlayCanvas($file) { $canvas = new Canvas(); $canvas->fromFile(Util::getResourcePath('Preset/'.$file)); return $canvas; }
php
{ "resource": "" }
q8458
Headers.&
train
public function & SetDisabledHeaders ($disabledHeaders) { /** @var $this \MvcCore\Response */ $this->disabledHeaders = []; $args = func_get_args(); if (count($args) === 1 && is_array($args[0])) $args = $args[0]; foreach ($args as $arg) $this->disabledHeaders[$arg] = TRUE; return $this; }
php
{ "resource": "" }
q8459
TranslationManagerServiceProvider.registerCommands
train
private function registerCommands() { if ($this->app->runningInConsole()) { $this->commands([ \Brotzka\TranslationManager\Module\Console\Commands\TranslationToDatabase::class, \Brotzka\TranslationManager\Module\Console\Commands\TranslationToFile::class ...
php
{ "resource": "" }
q8460
IniDump.Dump
train
public function Dump () { $environment = static::GetEnvironment(TRUE); list($sections, $envSpecifics) = $this->dumpSectionsInfo(); $levelKey = ''; $basicData = []; $sectionsData = []; foreach ($this->data as $key => & $value) { if (is_object($value) || is_array($value)) { if ($sectionsData) $sections...
php
{ "resource": "" }
q8461
IniDump.dumpScalarValue
train
protected function dumpScalarValue ($value) { if (is_numeric($value)) { return (string) $value; } else if (is_bool($value)) { return $value ? 'true' : 'false'; } else if ($value === NULL) { return 'null'; } else { static $specialChars = [ '=', '/', '.', '#', '&', '!', '?', '-', '@', "'", '"', '*...
php
{ "resource": "" }
q8462
LeafProperty.initDefaultProperties
train
public function initDefaultProperties() { if (isset($this->schema) && $this->setPropertyDefaultValue($this->schema)) { $this->property_value = $this->schema->default; } }
php
{ "resource": "" }
q8463
BuildCommand.gatherCollections
train
protected function gatherCollections() { if ( ! is_null($collection = $this->input->getArgument('collection'))) { if ( ! $this->environment->has($collection)) { $this->comment('['.$collection.'] Collection not found.'); return array(); ...
php
{ "resource": "" }
q8464
AssetFactory.make
train
public function make($path) { $absolutePath = $this->buildAbsolutePath($path); $relativePath = $this->buildRelativePath($absolutePath); $asset = new Asset($this->files, $this->factory, $this->appEnvironment, $absolutePath, $relativePath); return $asset->setOrder($this->nextAssetOr...
php
{ "resource": "" }
q8465
AssetFactory.buildRelativePath
train
public function buildRelativePath($path) { if (is_null($path)) return $path; $relativePath = str_replace(array(realpath($this->publicPath), '\\'), array('', '/'), $path); // If the asset is not a remote asset then we'll trim the relative path even further to remove // any unnecessa...
php
{ "resource": "" }
q8466
ReadWrite.&
train
public static function & GetConfig ($appRootRelativePath) { if (!isset(self::$configsCache[$appRootRelativePath])) { $app = self::$app ?: self::$app = & \MvcCore\Application::GetInstance(); $systemConfigClass = $app->GetConfigClass(); $system = $systemConfigClass::GetSystemConfigPath() === '/' . ltrim($appRo...
php
{ "resource": "" }
q8467
ReadWrite.&
train
protected static function & getConfigInstance ($appRootRelativePath, $systemConfig = FALSE) { $app = self::$app ?: self::$app = & \MvcCore\Application::GetInstance(); $appRoot = self::$appRoot ?: self::$appRoot = $app->GetRequest()->GetAppRoot(); $fullPath = $appRoot . '/' . str_replace( '%appPath%', $app->Get...
php
{ "resource": "" }
q8468
SolrClient.normalizeParams
train
public function normalizeParams(RequestHandler $handler, $params) { if (is_string($params)) { $params = array('q' => $params); } elseif (!is_array($params)) { $params = (array) $params; } return array_merge($handler->getDefaultParams(), $params); }
php
{ "resource": "" }
q8469
OopChecking.CheckClassInterface
train
public static function CheckClassInterface ($testClassName, $interfaceName, $checkStaticMethods = FALSE, $throwException = TRUE) { $result = FALSE; $errorMsg = ''; // check given test class for all implemented instance methods by given interface $interfaceName = trim($interfaceName, '\\'); $testClassType = ne...
php
{ "resource": "" }
q8470
OopChecking.CheckClassTrait
train
public static function CheckClassTrait ($testClassName, $traitName, $checkParentClasses = FALSE, $throwException = TRUE) { $result = FALSE; $errorMsg = ''; // check given test class for all implemented instance methods by given interface $testClassType = new \ReflectionClass($testClassName); if (in_array($tra...
php
{ "resource": "" }
q8471
OopChecking.&
train
protected static function & checkClassInterfaceGetPublicStaticMethods ($interfaceName) { if (!isset(static::$interfacesStaticMethodsCache[$interfaceName])) { $methods = []; $interfaceType = new \ReflectionClass($interfaceName); $publicOrStaticMethods = $interfaceType->getMethods(\ReflectionMethod::IS_PUBLIC ...
php
{ "resource": "" }
q8472
HtmlAttributes.generateHtmlString
train
protected function generateHtmlString(...$attributesList): HtmlString { $attributesArray = $this->buildAttributesArray(...$attributesList); $html = $this->buildHtmlString($attributesArray); return new HtmlString($html); }
php
{ "resource": "" }
q8473
HtmlAttributes.buildHtmlString
train
protected function buildHtmlString(array $attributesArray): string { $html = ''; foreach ($attributesArray as $key => $attribute) { $spacer = strlen($html) ? ' ' : ''; if ($key && is_string($key)) { $html .= $spacer . $key . ($attribute ? '="' . $attribute . '...
php
{ "resource": "" }
q8474
StatusCodeContainerTrait.withStatusCode
train
public function withStatusCode(int $code) { if ($this->statusCode == $code) { return $this; } $that = clone($this); $that->statusCode = $code; return $that; }
php
{ "resource": "" }
q8475
Text.setLineSpacing
train
public function setLineSpacing($spacing) { if ($spacing < 0) { throw new \InvalidArgumentException(sprintf( 'Invalid Line Spacing "%s" - Spacing Must Be Greater Than Zero' , (string) $spacing )); } $this->spacing = (float) $spac...
php
{ "resource": "" }
q8476
Text.getBoundingBox
train
public function getBoundingBox($padding = 10) { $bare = imageftbbox( $this->getFontSize() , 0 , $this->getFont() , $this->getString() , array('linespacing' => $this->getLineSpacing()) ); $a = deg2rad($this->getA...
php
{ "resource": "" }
q8477
EndpointCompilerPass.createAuthentication
train
protected function createAuthentication(ContainerBuilder $container, $authentication, $type) { if ($authentication['type'] == 'basic' && (!isset($authentication['username']) || !isset($authentication['password']))) { throw new \LogicException('Username and password are mandatory if using the bas...
php
{ "resource": "" }
q8478
EndpointCompilerPass.createApiClient
train
protected function createApiClient(ContainerBuilder $container, $apiClient, $baseUrl, $type) { if ($apiClient == 'guzzle') { // Create an API client service $apiClientDefinition = new Definition( 'Bluetea\Api\Client\GuzzleClient', array($baseUrl, new R...
php
{ "resource": "" }
q8479
EndpointCompilerPass.initializeEndpoints
train
protected function initializeEndpoints(ContainerBuilder $container, $availableApi) { // Add the jira api client to the jira endpoints if (isset($availableApi['jira'])) { $taggedEndpoints = $container->findTaggedServiceIds('jira_rest_api.jira_endpoint'); foreach ($taggedEndpoi...
php
{ "resource": "" }
q8480
LoggingBackend.log
train
protected function log($operation, $id = null, $ttl = null, $hit = null) { $message = strtoupper($operation); if ($id !== null) { $id = implode(', ', (array) $id); if ($ttl !== null) { $message = sprintf('%s(%s, ttl=%s)', $message, $id, $ttl); } el...
php
{ "resource": "" }
q8481
PWELogger.debug_print
train
private static function debug_print($file, $level, $format, $data) { array_shift($data); foreach ($data as $k => $v) { if (is_string($v)) { $data[$k] = str_replace("\n", ' ', $v); } elseif ($v instanceof \Exception) { $data[$k] = $v->__toString...
php
{ "resource": "" }
q8482
DBRecordTrait.getListQuery
train
public static function getListQuery( ?array $condition = [], $key = null, $value = null, $indexBy = true, $orderBy = true, $alias = null ) { if( !$alias && is_subclass_of( get_called_class(), ActiveRecord::class ) ) { $table = Yii::$app->db->schema->getRawTableName( ( get_called_class() )::tableName() ); } ...
php
{ "resource": "" }
q8483
DBRecordTrait.getRawAttributes
train
public function getRawAttributes( ?array $only = null, ?array $except = [], ?bool $schemaOnly = false ) { $values = []; if( $only === null ) { $only = $this->attributes( $only, $except, $schemaOnly ); } foreach( $only as $name ) { $values[ $name ] = $this->getAttribute( $name ); } if( $excep...
php
{ "resource": "" }
q8484
Connection.start
train
public function start($browserName) { if (!$this->customSidProvided) { $this->sid = uniqid(); $this->executeCommand('launchPreconfiguredBrowser', array('browserType' => $browserName)); } }
php
{ "resource": "" }
q8485
Connection.executeCommand
train
public function executeCommand($command, array $parameters = array()) { $content = $this->post( sprintf('http://%s:%d/_s_/dyn/Driver_%s', $this->host, $this->port, $command), array_merge($parameters, array('sahisid' => $this->sid)) )->getContent(); if (false !== strp...
php
{ "resource": "" }
q8486
Connection.executeStep
train
public function executeStep($step, $limit = null) { $this->executeCommand('setStep', array('step' => $step)); $limit = $limit ?: $this->limit; $check = 'false'; while ('true' !== $check) { usleep(100000); if (--$limit <= 0) { throw new Excepti...
php
{ "resource": "" }
q8487
Connection.evaluateJavascript
train
public function evaluateJavascript($expression, $limit = null) { $key = '___lastValue___' . uniqid(); $this->executeStep( sprintf("_sahi.setServerVarPlain(%s, JSON.stringify(%s))", json_encode($key), $expression), $limit ); $resp = $this->executeCommand('getV...
php
{ "resource": "" }
q8488
Connection.post
train
private function post($url, array $query = array()) { return $this->browser->post($url, array(), $this->prepareQueryString($query)); }
php
{ "resource": "" }
q8489
Connection.prepareQueryString
train
private function prepareQueryString(array $query) { $items = array(); foreach ($query as $key => $val) { $items[] = $key . '=' . urlencode($val); } return implode('&', $items); }
php
{ "resource": "" }
q8490
PluginRegistry.getPlugin
train
public function getPlugin($name) { if (!$this->has($name)) { throw new PluginNotFoundException($name, array_keys($this->plugins)); } return $this->plugins[$name]; }
php
{ "resource": "" }
q8491
LuceneIndexManager.getIndex
train
public function getIndex($indexName) { if (array_key_exists($indexName, $this->indices)) { return $this->indices[$indexName]; } return null; }
php
{ "resource": "" }
q8492
MelisFrontNavigation.getChildrenRecursive
train
public function getChildrenRecursive($idPage) { $results = array(); $melisTree = $this->serviceLocator->get('MelisEngineTree'); $publishedOnly = 1; $pages = $melisTree->getPageChildren($idPage,$publishedOnly); if ($pages) { $rpages = $pages->toArray(); foreach ($rpages as $page) { ...
php
{ "resource": "" }
q8493
MelisFrontNavigation.getAllSubpages
train
public function getAllSubpages($pageId) { $results = array(); //Services $melisTree = $this->serviceLocator->get('MelisEngineTree'); $pagePub = $this->getServiceLocator()->get('MelisEngineTablePagePublished'); $pageSave = $this->getServiceLocator()->get('MelisEngineTablePa...
php
{ "resource": "" }
q8494
CropExtension.getCropEndpoint
train
public function getCropEndpoint( $endpoint, $parameters = array(), $absolute = UrlGeneratorInterface::ABSOLUTE_PATH ) { $parameters = array_merge($parameters, array('endpoint' => $endpoint)); return $this->router->generate($this->routeName, $parameters, $absolute); }
php
{ "resource": "" }
q8495
HOTP.setDigits
train
public function setDigits($digits) { $digits = abs(intval($digits)); if ($digits < 1 || $digits > 10) { throw new \InvalidArgumentException('Digits must be a number between 1 and 10 inclusive'); } $this->digits = $digits; return $this; }
php
{ "resource": "" }
q8496
HOTP.setHashFunction
train
public function setHashFunction($hashFunction) { $hashFunction = strtolower($hashFunction); if (!in_array($hashFunction, hash_algos())) { throw new \InvalidArgumentException("$hashFunction is not a supported hash function"); } $this->hashFunction = $hashFunction; ...
php
{ "resource": "" }
q8497
HOTP.setWindow
train
public function setWindow($window) { $window = abs(intval($window)); $this->window = $window; return $this; }
php
{ "resource": "" }
q8498
Document.getFieldType
train
public function getFieldType($fieldName) { if (!array_key_exists($fieldName, $this->_fields)) { throw new \Exception("Field name \"$fieldName\" not found in document."); } return $this->_fields[$fieldName]->getType (); }
php
{ "resource": "" }
q8499
Net_SmartIRC_irccommands.message
train
public function message($type, $destination, $messagearray, $priority = SMARTIRC_MEDIUM ) { if (!is_array($messagearray)) { $messagearray = array($messagearray); } switch ($type) { case SMARTIRC_TYPE_CHANNEL: case SMARTIRC_TYPE_QUERY: ...
php
{ "resource": "" }