_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q245300 | ModelToLabelListener.drawLegend | validation | private function drawLegend(ModelToLabelEvent $event)
{
$model = $event->getModel();
$metaModel = $this->getMetaModelFromModel($model);
if (is_array($legend = StringUtil::deserialize($model->getProperty('legendtitle')))) {
foreach ([$metaModel->getActiveLanguage(), $metaModel... | php | {
"resource": ""
} |
q245301 | DifferentValuesException.compare | validation | public static function compare($expected, $actual, $strict = true)
{
try {
self::calculateDiff($expected, $actual, $strict);
} catch (\Exception $exception) {
$instance = new DifferentValuesException(
$expected,
$actual,
$strict... | php | {
"resource": ""
} |
q245302 | DifferentValuesException.getLongMessage | validation | public function getLongMessage($glue = ' ')
{
$messages = array();
$exception = $this;
do {
$messages[] = $exception->getMessage();
} while (null !== ($exception = $exception->getPrevious()));
return implode($glue, $messages);
} | php | {
"resource": ""
} |
q245303 | DifferentValuesException.isEmptyArrayEquivalent | validation | private static function isEmptyArrayEquivalent($expected, $actual)
{
return (gettype($expected) == 'string')
&& ((gettype($actual) == 'array') || (gettype($actual) == 'NULL'))
&& empty($actual)
&& empty($expected);
} | php | {
"resource": ""
} |
q245304 | DifferentValuesException.calculateArrayDiff | validation | private static function calculateArrayDiff($expected, $actual, $strict)
{
if (count($expected) !== count($actual)) {
throw new \LogicException(
sprintf(
'Array element count mismatch. Found %s, expected %s.',
count($actual),
... | php | {
"resource": ""
} |
q245305 | DifferentValuesException.calculateDiff | validation | private static function calculateDiff($expected, $actual, $strict)
{
if ($expected === $actual) {
return;
}
if (gettype($expected) !== gettype($actual)) {
// Only exception of the rule: array values are transported as empty string.
if (!$strict && self::i... | php | {
"resource": ""
} |
q245306 | WithChildren.getReferencedAttributes | validation | public function getReferencedAttributes()
{
$arrAttributes = array();
foreach ($this->arrChildren as $objSetting) {
$arrAttributes = array_merge($arrAttributes, $objSetting->getReferencedAttributes());
}
return $arrAttributes;
} | php | {
"resource": ""
} |
q245307 | DisableMandatoryListener.handle | validation | public function handle(BuildWidgetEvent $event)
{
$environment = $event->getEnvironment();
if (($environment->getDataDefinition()->getName() !== 'tl_metamodel_dcasetting')
|| ($event->getProperty()->getName() !== 'mandatory')
|| (null === $event->getModel()->getId())) {
... | php | {
"resource": ""
} |
q245308 | Simple.get | validation | public function get($strName)
{
return isset($this->arrBase[$strName]) ? $this->arrBase[$strName] : null;
} | php | {
"resource": ""
} |
q245309 | ServiceContainerInitializer.configure | validation | public function configure(MetaModelsServiceContainer $serviceContainer)
{
$serviceContainer
->setEventDispatcher(function () {
return $this->container->get('event_dispatcher');
})
->setDatabase(function () {
return $this->container->get('cc... | php | {
"resource": ""
} |
q245310 | LanguageOptionsListener.handle | validation | public function handle(GetOptionsEvent $event)
{
if (!$this->wantToHandle($event)) {
return;
}
$event->setOptions(array_flip(array_filter(array_flip(System::getLanguages()), function ($langCode) {
// Disable >2 char long language codes for the moment.
ret... | php | {
"resource": ""
} |
q245311 | AddAssetListener.getStylesheets | validation | public function getStylesheets(GetOptionsEvent $event)
{
if (!$this->wantToHandle($event)
|| ($event->getPropertyName() !== 'additionalCss')
|| ($event->getSubPropertyName() !== 'file')) {
return;
}
$event->setOptions($this->scanFiles('css'));
} | php | {
"resource": ""
} |
q245312 | AddAssetListener.getJavascripts | validation | public function getJavascripts(GetOptionsEvent $event)
{
if (($event->getEnvironment()->getDataDefinition()->getName() !== 'tl_metamodel_rendersettings')
|| ($event->getPropertyName() !== 'additionalJs')
|| ($event->getSubPropertyName() !== 'file')) {
return;
}
... | php | {
"resource": ""
} |
q245313 | AddAssetListener.scanFiles | validation | private function scanFiles($extension)
{
$files = [];
foreach (Finder::create()->in($this->uploadPath)->name('*.' . $extension)->getIterator() as $item) {
$files[] = 'files/' . Path::normalize($item->getRelativePathname());
}
return $files;
} | php | {
"resource": ""
} |
q245314 | ViewCombinations.getUser | validation | public function getUser()
{
static $authenticated;
if (!isset($authenticated)) {
$authenticated = true;
$this->authenticateUser();
}
return $this->user;
} | php | {
"resource": ""
} |
q245315 | ViewCombinations.resolve | validation | protected function resolve()
{
$factory = $this->container->getFactory();
$names = $factory->collectNames();
foreach ($names as $name) {
$this->information[$name] = array
(
self::COMBINATION => null,
self::INPUTSCREEN => null,... | php | {
"resource": ""
} |
q245316 | ViewCombinations.setTableMapping | validation | protected function setTableMapping($modelId, $tableName)
{
$this->information[$tableName][self::MODELID] = $modelId;
$this->tableMap[$modelId] = $tableName;
} | php | {
"resource": ""
} |
q245317 | ViewCombinations.getMetaModelName | validation | protected function getMetaModelName($nameOrId)
{
return isset($this->tableMap[$nameOrId]) ? $this->tableMap[$nameOrId] : $nameOrId;
} | php | {
"resource": ""
} |
q245318 | ViewCombinations.getPaletteCombinationRows | validation | protected function getPaletteCombinationRows()
{
$combinations = $this->getCombinationsFromDatabase();
$success = array();
// No combinations present, nothing to resolve.
if (!$combinations) {
return array_keys($this->information);
}
foreach ($combi... | php | {
"resource": ""
} |
q245319 | ViewCombinations.fetchInputScreenDetails | validation | protected function fetchInputScreenDetails()
{
$inputScreenIds = array();
foreach ($this->information as $info) {
$inputScreenIds[] = $info[self::COMBINATION]['dca_id'];
}
if (!$inputScreenIds) {
return;
}
$statement = $this->connection->quer... | php | {
"resource": ""
} |
q245320 | ViewCombinations.buildInputScreen | validation | protected function buildInputScreen($metaModel)
{
$metaModelName = $this->getMetaModelName($metaModel);
$inputScreen = $this->information[$metaModelName][self::INPUTSCREEN];
if (!is_object($inputScreen)) {
$inputScreen = $this->information[$metaModelName][self::INPUTSCREEN] = ... | php | {
"resource": ""
} |
q245321 | ViewCombinations.isInputScreenStandalone | validation | protected function isInputScreenStandalone($metaModel)
{
$information = $this->information[$metaModel];
$inputScreen = isset($information[self::INPUTSCREEN]) ? $information[self::INPUTSCREEN] : null;
if (!is_object($inputScreen)) {
return ($inputScreen['row']['rendertype'] == 'st... | php | {
"resource": ""
} |
q245322 | ViewCombinations.getRenderSetting | validation | public function getRenderSetting($metaModel)
{
$metaModelName = $this->getMetaModelName($metaModel);
return isset($this->information[$metaModelName][self::COMBINATION]['view_id'])
? $this->information[$metaModelName][self::COMBINATION]['view_id']
: null;
} | php | {
"resource": ""
} |
q245323 | ViewCombinations.getInputScreen | validation | public function getInputScreen($metaModel)
{
$inputScreen = $this->getInputScreenDetails($metaModel);
return $inputScreen ? $inputScreen->getId() : null;
} | php | {
"resource": ""
} |
q245324 | ViewCombinations.getStandaloneInputScreens | validation | public function getStandaloneInputScreens()
{
$result = array();
foreach (array_keys($this->information) as $modelName) {
if ($this->isInputScreenStandalone($modelName)) {
$result[] = $this->getInputScreenDetails($modelName);
}
}
return $resul... | php | {
"resource": ""
} |
q245325 | ViewCombinations.getParentOf | validation | public function getParentOf($metaModel)
{
$metaModelName = $this->getMetaModelName($metaModel);
return isset($this->childMap[$metaModelName]) ? $this->childMap[$metaModelName] : null;
} | php | {
"resource": ""
} |
q245326 | BreadcrumbStoreFactory.createStore | validation | public function createStore()
{
$request = $this->requestStack->getCurrentRequest();
return new BreadcrumbStore($this->iconBuilder, $this->translator, $request ? $request->getUri() : '');
} | php | {
"resource": ""
} |
q245327 | FilterParamWidgetListener.handle | validation | public function handle(BuildWidgetEvent $event)
{
if (!$this->wantToHandle($event) || ($event->getProperty()->getName() !== 'filterparams')) {
return;
}
$model = $event->getModel();
$objFilterSettings = $this->settingFactory->createCollection($model->getProperty('filte... | php | {
"resource": ""
} |
q245328 | Stringify.transformDSLTermToString | validation | protected function transformDSLTermToString($dslTerm) {
$string = "";
if (is_array($dslTerm)) {
$key = key($dslTerm);
$value = $dslTerm[$key];
if (is_string($key))
$string .= "$key:";
}
else
$value = $dslTerm;
/**
... | php | {
"resource": ""
} |
q245329 | Stringify.transformDSLSortToString | validation | protected function transformDSLSortToString($dslSort) {
$string = "";
if (is_array($dslSort)) {
foreach ($dslSort as $sort) {
if (is_array($sort)) {
$field = key($sort);
$info = current($sort);
}
else
... | php | {
"resource": ""
} |
q245330 | Base.buildUrl | validation | protected function buildUrl($path = false, array $options = array()) {
$isAbsolute = (is_array($path) ? $path[0][0] : $path[0]) === '/';
$url = $isAbsolute || null === $this->index ? '' : "/" . $this->index;
if ($path && is_array($path) && count($path) > 0)
$url .= "/" . implode("/"... | php | {
"resource": ""
} |
q245331 | Bulk.delete | validation | public function delete($id=false, $index, $type, array $options = array()) {
$params = array( '_id' => $id,
'_index' => $index,
'_type' => $type);
foreach ($options as $key => $value) {
$params['_' . $key] = $value;
}
$operation = array(
array('delete' => $params)
);
$this->... | php | {
"resource": ""
} |
q245332 | Bulk.createPayload | validation | public function createPayload()
{
$payloads = array();
foreach ($this->operations as $operation) {
foreach ($operation as $partial) {
$payloads[] = json_encode($partial);
}
}
return join("\n", $payloads)."\n";
} | php | {
"resource": ""
} |
q245333 | Query.term | validation | public function term($term, $field=false) {
$this->term = ($field)
? array($field => $term)
: $term;
return $this;
} | php | {
"resource": ""
} |
q245334 | Query.wildcard | validation | public function wildcard($val, $field=false) {
$this->wildcard = ($field)
? array($field => $val)
: $val;
return $this;
} | php | {
"resource": ""
} |
q245335 | Builder.query | validation | public function query(array $options=array()) {
if (!($this->query instanceof Query))
$this->query = new Query($options);
return $this->query;
} | php | {
"resource": ""
} |
q245336 | HTTP.call | validation | protected function call($url, $method="GET", $payload=null) {
$conn = $this->ch;
$protocol = "http";
$requestURL = $protocol . "://" . $this->host . $url;
curl_setopt($conn, CURLOPT_URL, $requestURL);
curl_setopt($conn, CURLOPT_TIMEOUT, $this->timeout);
curl_setopt($conn,... | php | {
"resource": ""
} |
q245337 | RangeQuery.build | validation | public function build() {
$built = array();
if ($this->fieldname) {
$built[$this->fieldname] = array();
foreach (array("from","to","includeLower","includeUpper", "boost") as $opt) {
if ($this->$opt !== null)
$built[$this->fieldname][$opt] = $th... | php | {
"resource": ""
} |
q245338 | Mapping.field | validation | public function field($field, $config = array()) {
if (is_string($config)) $config = array('type' => $config);
$this->properties[$field] = $config;
return $this;
} | php | {
"resource": ""
} |
q245339 | Mapping.config | validation | public function config($key, $value = null) {
if (is_array($key))
$this->config = $key + $this->config;
else {
if ($value !== null) $this->config[$key] = $value;
if (!isset($this->config[$key]))
throw new \Exception("Configuration key `type` is not set... | php | {
"resource": ""
} |
q245340 | Client.setIndex | validation | public function setIndex($index) {
if (is_array($index))
$index = implode(",", array_filter($index));
$this->index = $index;
$this->transport->setIndex($index);
return $this;
} | php | {
"resource": ""
} |
q245341 | Client.setType | validation | public function setType($type) {
if (is_array($type))
$type = implode(",", array_filter($type));
$this->type = $type;
$this->transport->setType($type);
return $this;
} | php | {
"resource": ""
} |
q245342 | Client.map | validation | public function map($mapping, array $config = array()) {
if (is_array($mapping)) $mapping = new Mapping($mapping);
$mapping->config($config);
try {
$type = $mapping->config('type');
}
catch (\Exception $e) {} // No type is cool
if (isset($type) && !$this->pas... | php | {
"resource": ""
} |
q245343 | Client.request | validation | public function request($path, $method = 'GET', $payload = false, $verbose=false) {
$response = $this->transport->request($this->expandPath($path), $method, $payload);
return ($verbose || !isset($response['_source']))
? $response
: $response['_source'];
} | php | {
"resource": ""
} |
q245344 | Client.search | validation | public function search($query, array $options = array()) {
$start = microtime(true);
$result = $this->transport->search($query, $options);
$result['time'] = microtime(true) - $start;
return $result;
} | php | {
"resource": ""
} |
q245345 | Client.parseDsn | validation | protected static function parseDsn($dsn) {
$parts = parse_url($dsn);
$protocol = $parts['scheme'];
$servers = $parts['host'] . ':' . $parts['port'];
if (isset($parts['path'])) {
$path = explode('/', $parts['path']);
list($index, $type) = array_values(array_filter(... | php | {
"resource": ""
} |
q245346 | Client.beginBulk | validation | public function beginBulk() {
if (!$this->bulk) {
$this->bulk = $this->createBulk($this);
}
return $this->bulk;
} | php | {
"resource": ""
} |
q245347 | Client.commitBulk | validation | public function commitBulk() {
if ($this->bulk && $this->bulk->count()) {
$result = $this->bulk->commit();
$this->bulk = null;
return $result;
}
} | php | {
"resource": ""
} |
q245348 | Aoe_TemplateHints_Model_Observer.showHints | validation | public function showHints() {
if (is_null($this->showHints)) {
$this->showHints = false;
if (Mage::helper('core')->isDevAllowed()) {
if (Mage::getSingleton('core/cookie')->get('ath') || Mage::app()->getRequest()->get('ath')) {
$this->showHints = true;
... | php | {
"resource": ""
} |
q245349 | Aoe_TemplateHints_Helper_Data.getSkinFileContent | validation | public function getSkinFileContent($file) {
$package = Mage::getSingleton('core/design_package');
$areaBackup = $package->getArea();
$path = $package
->setArea('frontend')
->getFilename($file, array('_type' => 'skin'));
$content = file_get_contents($path);
... | php | {
"resource": ""
} |
q245350 | Aoe_TemplateHints_Model_Adminhtml_System_Config_Source_HintRenderer.toOptionArray | validation | public function toOptionArray() {
$options = array();
$options[] = array(
'value'=> 'aoe_templatehints/renderer_comment',
'label'=> Mage::helper('aoe_templatehints')->__('Comments')
);
$options[] = array(
'value'=> 'aoe_templatehints/renderer_opentip',... | php | {
"resource": ""
} |
q245351 | Aoe_TemplateHints_Model_Renderer_Comment.arrayToTabList | validation | protected function arrayToTabList(array $array, array $skipKeys=array(), $indentationLevel = 1) {
$output = '';
foreach($array as $key => $value) {
if (in_array($key, $skipKeys, true)) {
continue;
}
$output .= $this->tabsForIndentation($indentatio... | php | {
"resource": ""
} |
q245352 | Aoe_TemplateHints_Helper_ClassInfo.findFileAndLine | validation | public function findFileAndLine($className) {
$result = false;
$fullPath = $this->searchFullPath($this->getFileFromClassName($className));
if ($fullPath) {
$result = array('file' => $fullPath, 'line' => 0);
$lineNumber = $this->getLineNumber($fullPath, '/class\s+'.$classN... | php | {
"resource": ""
} |
q245353 | Aoe_TemplateHints_Helper_ClassInfo.searchFullPath | validation | public function searchFullPath($filename) {
$paths = explode(PATH_SEPARATOR, get_include_path());
foreach ($paths as $path) {
$fullPath = $path . DIRECTORY_SEPARATOR . $filename;
if (file_exists($fullPath)) {
return $fullPath;
}
}
retur... | php | {
"resource": ""
} |
q245354 | Aoe_TemplateHints_Helper_BlockInfo.getBlockInfo | validation | public function getBlockInfo(Mage_Core_Block_Abstract $block, $fullInfo=true) {
$info = array(
'name' => $block->getNameInLayout(),
'alias' => $block->getBlockAlias(),
);
if (!$fullInfo) {
return $info;
}
$info['class'] = get_class($block);
... | php | {
"resource": ""
} |
q245355 | Aoe_TemplateHints_Helper_BlockInfo.getRemoteCallEnabled | validation | public function getRemoteCallEnabled() {
if (is_null($this->remoteCallEnabled)) {
$this->remoteCallEnabled = Mage::getStoreConfigFlag('dev/aoe_templatehints/enablePhpstormRemoteCall');
}
return $this->remoteCallEnabled;
} | php | {
"resource": ""
} |
q245356 | Aoe_TemplateHints_Helper_BlockInfo.getRemoteCallUrlTemplate | validation | public function getRemoteCallUrlTemplate() {
if (is_null($this->remoteCallUrlTemplate)) {
$this->remoteCallUrlTemplate = Mage::getStoreConfig('dev/aoe_templatehints/remoteCallUrlTemplate');
}
return $this->remoteCallUrlTemplate;
} | php | {
"resource": ""
} |
q245357 | Aoe_TemplateHints_Helper_BlockInfo.getBlockPath | validation | public function getBlockPath(Mage_Core_Block_Abstract $block) {
$blockPath = array();
$step = $block->getParentBlock();
$i = 0;
while ($i++ < 20 && $step instanceof Mage_Core_Block_Abstract) {
$blockPath[] = $this->getBlockInfo($step, false);
$step = $step->getParentBloc... | php | {
"resource": ""
} |
q245358 | Aoe_TemplateHints_Helper_BlockInfo.isWithinCachedBlock | validation | public function isWithinCachedBlock(Mage_Core_Block_Abstract $block) {
$step = $block;
$i = 0;
while ($i++ < 20 && $step instanceof Mage_Core_Block_Abstract) {
if (!is_null($step->getCacheLifetime())) {
return true;
}
$step = $step->getParentBlock();
... | php | {
"resource": ""
} |
q245359 | Type.getType | validation | public static function getType($name)
{
if ( ! isset(self::$_typeObjects[$name])) {
if ( ! isset(self::$_typesMap[$name])) {
throw TypeException::unknownType($name);
}
self::$_typeObjects[$name] = new self::$_typesMap[$name]();
}
return se... | php | {
"resource": ""
} |
q245360 | Type.addType | validation | public static function addType($name, $className)
{
if (isset(self::$_typesMap[$name])) {
throw TypeException::typeExists($name);
}
self::$_typesMap[$name] = $className;
} | php | {
"resource": ""
} |
q245361 | Type.overrideType | validation | public static function overrideType($name, $className)
{
if ( ! isset(self::$_typesMap[$name])) {
throw TypeException::typeNotFound($name);
}
self::$_typesMap[$name] = $className;
} | php | {
"resource": ""
} |
q245362 | ProxyFactory.getProxy | validation | public function getProxy($className, $identifier)
{
$fqn = ClassUtils::generateProxyClassName($className, $this->proxyNamespace);
if ( ! class_exists($fqn, false)) {
$fileName = $this->getProxyFileName($className);
if ($this->autoGenerate) {
$this->generatePr... | php | {
"resource": ""
} |
q245363 | ProxyFactory.getProxyFileName | validation | private function getProxyFileName($className, $baseDir = null)
{
$proxyDir = $baseDir ?: $this->proxyDir;
return $proxyDir . DIRECTORY_SEPARATOR . '__CG__' . str_replace('\\', '', $className) . '.php';
} | php | {
"resource": ""
} |
q245364 | ProxyFactory.generateProxyClasses | validation | public function generateProxyClasses(array $classes, $toDir = null)
{
$proxyDir = $toDir ?: $this->proxyDir;
$proxyDir = rtrim($proxyDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
foreach ($classes as $class) {
/* @var $class ClassMetadata */
if ($class->isMappedSup... | php | {
"resource": ""
} |
q245365 | ProxyFactory.generateProxyClass | validation | private function generateProxyClass($class, $fileName, $template)
{
$methods = $this->generateMethods($class);
$sleepImpl = $this->generateSleep($class);
$placeholders = array(
'<namespace>',
'<proxyClassName>', '<className>',
'<methods>', '<sleepImpl>'
... | php | {
"resource": ""
} |
q245366 | ProxyFactory.generateMethods | validation | private function generateMethods(ClassMetadata $class)
{
$methods = '';
foreach ($class->reflClass->getMethods() as $method) {
/* @var $method \ReflectionMethod */
if ($method->isConstructor() || strtolower($method->getName()) == "__sleep") {
continue;
... | php | {
"resource": ""
} |
q245367 | Configuration.getDocumentNamespace | validation | public function getDocumentNamespace($documentNamespaceAlias)
{
if ( ! isset($this->attributes['documentNamespaces'][$documentNamespaceAlias])) {
throw CouchDBException::unknownDocumentNamespace($documentNamespaceAlias);
}
return trim($this->attributes['documentNamespaces'][$doc... | php | {
"resource": ""
} |
q245368 | Configuration.newDefaultAnnotationDriver | validation | public function newDefaultAnnotationDriver($paths = array())
{
$reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader();
$reader->addNamespace('Doctrine\ODM\CouchDB\Mapping\Annotations');
return new \Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver($reader, (array) $paths);
... | php | {
"resource": ""
} |
q245369 | ClassMetadataFactory.loadMetadata | validation | protected function loadMetadata($className)
{
if (class_exists($className)) {
return parent::loadMetadata($className);
}
throw MappingException::classNotFound($className);
} | php | {
"resource": ""
} |
q245370 | DocumentManager.createQuery | validation | public function createQuery($designDocName, $viewName)
{
$designDoc = $this->config->getDesignDocument($designDocName);
if ($designDoc) {
$designDoc = new $designDoc['className']($designDoc['options']);
}
$query = new ODMQuery($this->couchDBClient->getHttpClient(), $this-... | php | {
"resource": ""
} |
q245371 | DocumentManager.createNativeQuery | validation | public function createNativeQuery($designDocName, $viewName)
{
$designDoc = $this->config->getDesignDocument($designDocName);
if ($designDoc) {
$designDoc = new $designDoc['className']($designDoc['options']);
}
$query = new Query($this->couchDBClient->getHttpClient(), $th... | php | {
"resource": ""
} |
q245372 | DocumentManager.createLuceneQuery | validation | public function createLuceneQuery($designDocName, $viewName)
{
$luceneHandlerName = $this->config->getLuceneHandlerName();
$designDoc = $this->config->getDesignDocument($designDocName);
if ($designDoc) {
$designDoc = new $designDoc['className']($designDoc['options']);
}
... | php | {
"resource": ""
} |
q245373 | DocumentManager.clear | validation | public function clear($objectName = null)
{
if ($objectName === null) {
// Todo: Do a real delegated clear?
$this->unitOfWork = new UnitOfWork($this);
} else {
//TODO
throw new CouchDBException("DocumentManager#clear(\$objectName) not yet implemented."... | php | {
"resource": ""
} |
q245374 | DocumentManager.initializeObject | validation | public function initializeObject($obj)
{
if ($obj instanceof PersistentCollection) {
$obj->initialize();
} else if ($obj instanceof Proxy\Proxy) {
$obj->__doctrineLoad__();
}
} | php | {
"resource": ""
} |
q245375 | AESGCM.encryptAndAppendTag | validation | public static function encryptAndAppendTag($K, $IV, $P = null, $A = null, $tag_length = 128)
{
return implode(self::encrypt($K, $IV, $P, $A, $tag_length));
} | php | {
"resource": ""
} |
q245376 | AESGCM.decryptWithAppendedTag | validation | public static function decryptWithAppendedTag($K, $IV, $Ciphertext = null, $A = null, $tag_length = 128)
{
$tag_length_in_bits = $tag_length / 8;
$C = mb_substr($Ciphertext, 0, -$tag_length_in_bits, '8bit');
$T = mb_substr($Ciphertext, -$tag_length_in_bits, null, '8bit');
return sel... | php | {
"resource": ""
} |
q245377 | Curl.getParams | validation | public function getParams(array $params)
{
$r = '';
ksort($params);
foreach ($params as $key => $value) {
$r .= '&' . $key . '=' . rawurlencode($value);
}
unset($params, $key, $value);
return trim($r, '&');
} | php | {
"resource": ""
} |
q245378 | Curl.processHeaders | validation | protected function processHeaders($headers)
{
$out = array();
$headers = explode("\r\n", trim($headers));
foreach ($headers as $header) {
if (strpos($header, ':') !== false) {
$tmp = explode(':', $header);
$out[reset($tmp)] = end($tmp);
... | php | {
"resource": ""
} |
q245379 | SingleUserAuth.postMedia | validation | public function postMedia($call, $filename)
{
$this->resetCallState();
$this->call = $call;
$this->method = 'POST';
$this->withMedia = true;
$mimeBoundary = sha1($call . microtime());
$params = array(
'post' => $this->buildMultipart($mimeBoundary, $fi... | php | {
"resource": ""
} |
q245380 | SingleUserAuth.getOauthParameters | validation | protected function getOauthParameters()
{
$time = time();
return array(
'oauth_consumer_key' => $this->getConsumerKey(),
'oauth_nonce' => trim(base64_encode($time), '='),
'oauth_signature_method' => 'HMAC-SHA1',
'oauth_timestamp' => $time,
... | php | {
"resource": ""
} |
q245381 | SingleUserAuth.getRequestString | validation | protected function getRequestString()
{
$params = array_merge($this->getParams, $this->postParams, $this->getOauthParameters());
$params = $this->curl->getParams($params);
return rawurlencode($params);
} | php | {
"resource": ""
} |
q245382 | SingleUserAuth.getSignatureBaseString | validation | protected function getSignatureBaseString()
{
$method = strtoupper($this->method);
$url = rawurlencode($this->getUrl());
return $method . '&' . $url . '&' . $this->getRequestString();
} | php | {
"resource": ""
} |
q245383 | SingleUserAuth.getOauthString | validation | protected function getOauthString()
{
$oauth = array_merge($this->getOauthParameters(), array('oauth_signature' => $this->calculateSignature()));
ksort($oauth);
$values = array();
foreach ($oauth as $key => $value) {
$values[] = $key . '="' . rawurlencode($value) . '"'... | php | {
"resource": ""
} |
q245384 | AuthAbstract.getHeaders | validation | public function getHeaders($key = null)
{
if ($key === null) {
return $this->headers;
}
if (isset($this->headers[$key])) {
return $this->headers[$key];
}
return false;
} | php | {
"resource": ""
} |
q245385 | AuthAbstract.get | validation | public function get($call, array $getParams = null)
{
$this->resetCallState();
$this->call = $call;
$this->method = 'GET';
if ($getParams !== null && is_array($getParams)) {
$this->getParams = $getParams;
}
$response = $this->getResponse();
$r... | php | {
"resource": ""
} |
q245386 | AuthAbstract.validateCredentials | validation | protected function validateCredentials($credentials)
{
$credentials = array_filter($credentials);
$keys = array_keys($credentials);
$diff = array_diff($this->requiredCredentials, $keys);
if (!empty($diff)) {
throw new MissingCredentialsException('Missing Credentials: '... | php | {
"resource": ""
} |
q245387 | AuthAbstract.getUrl | validation | protected function getUrl()
{
$domain = $this->urls['domain'];
$apiVersion = $this->urls['api'];
$jsonExt = '.json';
if (isset($this->withMedia) && $this->withMedia === true) {
$domain = $this->urls['upload'];
}
if ($this->call === 'oauth/request_token... | php | {
"resource": ""
} |
q245388 | AuthAbstract.getResponse | validation | protected function getResponse()
{
$url = $this->getUrl();
$params = array(
'get' => $this->getParams,
'post' => $this->postParams,
'headers' => $this->buildRequestHeader(),
);
return $this->curl->send($url, $params);
} | php | {
"resource": ""
} |
q245389 | AuthAbstract.findExceptions | validation | protected function findExceptions($response)
{
$response = $response['body'];
$data = json_decode($response, true);
if (isset($response[0]) && $response[0] !== '{' && $response[0] !== '[' && !$data) {
if (strpos($response, 'oauth_token=') !== false) {
parse_str(... | php | {
"resource": ""
} |
q245390 | AuthAbstract.buildMultipart | validation | protected function buildMultipart($mimeBoundary, $filename)
{
$binary = $this->getBinaryFile($filename);
$details = pathinfo($filename);
$type = $this->supportedMimes($details['extension']);
$data = '--' . $mimeBoundary . static::EOL;
$data .= 'Content-Disposition: form-da... | php | {
"resource": ""
} |
q245391 | AuthAbstract.getBinaryFile | validation | protected function getBinaryFile($filename)
{
if (!file_exists($filename)) {
throw new FileNotFoundException;
}
if (!is_readable($filename)) {
throw new FileNotReadableException;
}
ob_start();
readfile($filename);
$binary = ob_get_c... | php | {
"resource": ""
} |
q245392 | AuthAbstract.resetCallState | validation | protected function resetCallState()
{
$this->call = null;
$this->method = null;
$this->withMedia = null;
$this->getParams = array();
$this->postParams = array();
$this->headers = null;
} | php | {
"resource": ""
} |
q245393 | ApplicationOnlyAuth.getBearerToken | validation | public function getBearerToken()
{
$url = $this->getBearerTokenUrl();
$params = array(
'post' => array('grant_type' => 'client_credentials'),
'headers' => $this->buildBearerTokenHeader(),
);
$response = $this->curl->send($url, $params);
$obj = json_... | php | {
"resource": ""
} |
q245394 | ApplicationOnlyAuth.invalidateBearerToken | validation | public function invalidateBearerToken()
{
$url = $this->getInvalidateBearerTokenUrl();
$bearerToken = $this->bearerToken;
if ($bearerToken === null) {
$bearerToken = $this->getBearerToken();
}
$params = array(
'post' => array('access_token' => $bear... | php | {
"resource": ""
} |
q245395 | ApplicationOnlyAuth.getBearerTokenCredentials | validation | protected function getBearerTokenCredentials()
{
$signingKey = rawurlencode($this->getConsumerKey()) . ':' . rawurlencode($this->getConsumerSecret());
return base64_encode($signingKey);
} | php | {
"resource": ""
} |
q245396 | ApplicationOnlyAuth.buildRequestHeader | validation | protected function buildRequestHeader()
{
$bearerToken = $this->bearerToken;
if ($this->bearerToken === null) {
$bearerToken = $this->getBearerToken();
}
return array(
'Authorization: Bearer ' . rawurlencode($bearerToken),
'Expect:'
);
... | php | {
"resource": ""
} |
q245397 | Scheduler.every | validation | function every($interval, Job $job)
{
$expression = new SimpleExpression($interval);
$this->add($expression, $job);
return $this;
} | php | {
"resource": ""
} |
q245398 | Scheduler.cron | validation | function cron($expression, Job $job)
{
$expression = new CronExpression($expression);
$this->add($expression, $job);
return $this;
} | php | {
"resource": ""
} |
q245399 | Scheduler.run | validation | function run()
{
$now = new DateTime('now');
$sleep = min(array_map(
function($entry) use ($now) {
list($expression, $job) = $entry;
return $expression->getNextRunDate($now)->getTimestamp();
},
$this->entries
));
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.