_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q260000 | ResourceProvider.createResources | test | private function createResources(array $resources, $type)
{
foreach ($resources as $resource) {
if ($type === "string") {
$this->vars->pathsLoadedCheck($resource);
if ($this->vars->cache->checkCache()) {
return;
}
... | php | {
"resource": ""
} |
q260001 | ResourceProvider.addContent | test | private function addContent($content)
{
if ($this->relative) {
$this->content = $this->mergeContents($this->content, $content);
} else {
$this->parent_content = $this->mergeContents($this->parent_content, $content);
}
} | php | {
"resource": ""
} |
q260002 | ResourceProvider.getSupportedFilesInDir | test | private function getSupportedFilesInDir($entity)
{
$dir_loader = new DirectoryLoader($entity, $this->recursive);
$dir_loader->setSupports($this->vars->loader->getExtensions());
$dir_loader->load();
return $dir_loader->getContent();
} | php | {
"resource": ""
} |
q260003 | ResourceProvider.mergeParentContent | test | public function mergeParentContent()
{
$this->content = $this->mergeContents($this->content, $this->parent_content);
return $this;
} | php | {
"resource": ""
} |
q260004 | AbstractResource.internalGet | test | private function internalGet(array $array, $key, $exists = false)
{
if (isset($array[$key])) {
return (!$exists) ? $array[$key] : true;
}
$parts = explode('.', $key);
foreach ($parts as $part) {
if (!is_array($array) || !isset($array[$part])) {
... | php | {
"resource": ""
} |
q260005 | AbstractResource.arrayKeyExists | test | public function arrayKeyExists($key)
{
if (array_key_exists($key, $this->content)) {
return true;
}
$parts = explode('.', $key);
$arr = $this->content;
foreach ($parts as $part) {
if (!is_array($arr) || !array_key_exists($part, $arr)) {
... | php | {
"resource": ""
} |
q260006 | VariableProvider.parse | test | public function parse($value)
{
foreach (self::$variable_types as $variable_type) {
$value = $this->typeParse($value, $variable_type);
}
return $value;
} | php | {
"resource": ""
} |
q260007 | VariableProvider.typeParse | test | private function typeParse($value, $type)
{
$const_str = sprintf('REGEX_%s_SYNTAX', strtoupper($type));
$regex = constant('\M1\Vars\Variables\VariableProvider::'.$const_str);
$matches = $this->fetchVariableMatches($value, $regex);
if (is_array($matches)) {
if (count($ma... | php | {
"resource": ""
} |
q260008 | VariableProvider.fetchVariableMatches | test | private function fetchVariableMatches($value, $regex)
{
preg_match_all('/' . $regex . '/', $value, $matches);
if (!is_array($matches) || !isset($matches[0]) || empty($matches[0])) {
return false;
}
return $matches;
} | php | {
"resource": ""
} |
q260009 | VariableProvider.fetchVariable | test | private function fetchVariable($variable_name, $type)
{
$this->checkVariableExists($variable_name, $type);
if ($type === 'env') {
return getenv($variable_name);
} elseif ($type === 'replacement') {
return $this->rstore->get($variable_name);
}
return ... | php | {
"resource": ""
} |
q260010 | VariableProvider.checkVariableExists | test | private function checkVariableExists($variable, $type)
{
if (($type === 'env' && !getenv($variable)) ||
($type === 'replacement' && !$this->rstore->arrayKeyExists($variable)) ||
($type === 'variable' && !$this->vstore->arrayKeyExists($variable))
) {
thr... | php | {
"resource": ""
} |
q260011 | VariableProvider.doReplacements | test | public function doReplacements($value, $matches, $type)
{
$replacements = array();
for ($i = 0; $i <= (count($matches[0]) - 1); $i++) {
$replacement = $this->fetchVariable($matches[1][$i], $type);
$replacements[$matches[0][$i]] = $replacement;
}
if (!empty($r... | php | {
"resource": ""
} |
q260012 | svg_dom.export | test | protected static function export($dom = null) {
if (!is_a($dom, 'DOMDocument')) {
return false;
}
try {
$svgs = $dom->getElementsByTagName('svg');
if (!$svgs->length) {
return false;
}
$svg = $svgs->item(0)->ownerDocument->saveXML($svgs->item(0), LIBXML_NOBLANKS);
// Remove comments.
$s... | php | {
"resource": ""
} |
q260013 | svg_dom.remove_nodes | test | protected static function remove_nodes($nodes) {
if (!is_a($nodes, 'DOMNodeList')) {
return false;
}
try {
while ($nodes->length) {
static::remove_node($nodes->item(0));
}
return true;
} catch (\Throwable $e) {
error_log($e->getMessage());
return false;
} catch (\Exception $e) {
retu... | php | {
"resource": ""
} |
q260014 | svg_dom.remove_node | test | protected static function remove_node($node) {
if (
!is_a($node, 'DOMElement') &&
!is_a($node, 'DOMNode')
) {
return false;
}
try {
// @codingStandardsIgnoreStart
$node->parentNode->removeChild($node);
// @codingStandardsIgnoreEnd
return true;
} catch (\Throwable $e) {
error_log($e->g... | php | {
"resource": ""
} |
q260015 | PathTrait.setPath | test | public function setPath($path, $check_writeable = false)
{
if (is_null($path)) {
return;
}
if (!is_dir($path) || ($check_writeable && !is_writable($path))) {
throw new \InvalidArgumentException(sprintf(
"'%s' base path does not exist or is not writabl... | php | {
"resource": ""
} |
q260016 | FileResource.makePaths | test | private function makePaths($file)
{
$file = realpath($file);
$base_path = $this->provider->vars->getPath();
$filesystem = new Filesystem();
$abs_path = $filesystem->makePathRelative(
$file,
$base_path
);
$this->file = $file;
$this->f... | php | {
"resource": ""
} |
q260017 | FileResource.searchForResources | test | private function searchForResources($content = array(), $prefix = '')
{
$returned_content = array();
foreach ($content as $ck => $cv) {
$this->variables->vstore->setCurrentPrefix($prefix);
$returned_content = $this->parseContent($ck, $cv, $returned_content, $prefix);
... | php | {
"resource": ""
} |
q260018 | FileResource.parseContent | test | private function parseContent($key, $value, $returned_content, $prefix)
{
if ($key === 'imports' && !is_null($value) && !empty($value)) {
$imported_resource = $this->useImports($value);
if ($imported_resource) {
$returned_content = array_replace_recursive($returned_c... | php | {
"resource": ""
} |
q260019 | FileResource.useImports | test | private function useImports($imports)
{
$imported_resources = array();
if ((is_array($imports) && $this->isAssoc($imports)) || is_string($imports)) {
$imports = array($imports);
}
foreach ($imports as $import) {
$imported_resources = $this->processImport($th... | php | {
"resource": ""
} |
q260020 | FileResource.import2Resource | test | private function import2Resource($import, array $imported_resources)
{
$resource = $this->createResource($import);
if ($resource) {
$imported_resources = $this->importResource($resource, $imported_resources);
}
return $imported_resources;
} | php | {
"resource": ""
} |
q260021 | FileResource.createResource | test | private function createResource($import)
{
if (is_array($import) && array_key_exists('resource', $import)) {
$import_resource = $import;
$import_resource['relative'] = $this->checkBooleanValue('relative', $import_resource);
$import_resource['recursive'] = $this->checkBool... | php | {
"resource": ""
} |
q260022 | FileResource.createImportName | test | private function createImportName($resource)
{
$resource = $this->explodeResourceIfElse($resource);
$resource_pieces = array();
foreach ($resource as $r) {
$parsed_r = $this->trimFlags($r);
$parsed_r = sprintf('%s/%s', dirname($this->file), $parsed_r);
... | php | {
"resource": ""
} |
q260023 | FileResource.importResource | test | private function importResource(ResourceProvider $provider, $imported_resources)
{
$content = $provider->getContent();
$parent_content = $provider->getParentContent();
if (!empty($content)) {
$imported_resources = array_replace_recursive($imported_resources, $content);
}... | php | {
"resource": ""
} |
q260024 | FileResource.checkBooleanValue | test | public function checkBooleanValue($value, $import)
{
$default = false;
if ($value === 'relative') {
$default = true;
}
$value = (isset($import[$value])) ? $import[$value] : $default;
return $this->getBooleanValue($value);
} | php | {
"resource": ""
} |
q260025 | FileResource.getBooleanValue | test | private function getBooleanValue($value)
{
$value = strtolower($value);
if (!$value || $value === "false" || $value === "no") {
return false;
}
return true;
} | php | {
"resource": ""
} |
q260026 | mime.get_aliases | test | public static function get_aliases($ext='') {
$ext = trim(strtolower($ext));
$ext = ltrim($ext, '.');
if (strlen($ext) && array_key_exists($ext, mime\aliases::$data)) {
$match = mime\aliases::$data[$ext];
} else {
$match = false;
}
// Filter.
return apply_filters('blobmimes_get_mime_aliases', $matc... | php | {
"resource": ""
} |
q260027 | mime.update_filename_extension | test | public static function update_filename_extension($filename, $ext) {
$ext = strtolower($ext);
$ext = rtrim($ext, '.');
$ext = ltrim($ext, '.');
$filename_parts = explode('.', $filename);
// Remove the old extension.
if (count($filename_parts) > 1) {
array_pop($filename_parts);
}
// Add the new exte... | php | {
"resource": ""
} |
q260028 | mime.check_alias | test | public static function check_alias($ext='', $mime='') {
// Standardize inputs.
$mime = strtolower(sanitize_mime_type($mime));
$ext = trim(strtolower($ext));
$ext = ltrim($ext, '.');
// Can't continue if the extension is not in the database.
if (false === ($mimes = static::get_aliases($ext))) {
// Filter... | php | {
"resource": ""
} |
q260029 | mime.check_allowed_aliases | test | public static function check_allowed_aliases($alias, $mimes=null) {
// Default MIMEs.
if (empty($mimes)) {
$mimes = get_allowed_mime_types();
}
$alias = strtolower(sanitize_mime_type($alias));
$ext = $type = false;
// Early bail opportunity.
if (!$alias || !count($mimes)) {
return false;
}
/... | php | {
"resource": ""
} |
q260030 | ReplacementStore.load | test | public function load($replacements)
{
if (is_array($replacements)) {
$variables = $replacements;
} elseif (is_file($replacements)) {
$variables = $this->loadContent($replacements);
} else {
throw new \RuntimeException('Config replacements must be a array o... | php | {
"resource": ""
} |
q260031 | DirectoryLoader.getSupportedFilesRecursively | test | private function getSupportedFilesRecursively()
{
$dir_it = new \RecursiveDirectoryIterator($this->entity, \RecursiveDirectoryIterator::SKIP_DOTS);
$files = new \RecursiveIteratorIterator(
$dir_it,
\RecursiveIteratorIterator::LEAVES_ONLY,
\RecursiveIteratorIterat... | php | {
"resource": ""
} |
q260032 | DirectoryLoader.makeResources | test | private function makeResources($paths)
{
if ($paths && !empty($paths)) {
$resources = array();
foreach ($paths as $path) {
$resources[] = $path;
}
return $resources;
}
return false;
} | php | {
"resource": ""
} |
q260033 | CacheProvider.checkCache | test | public function checkCache()
{
if ($this->provide && $this->path && !$this->getAttempted()) {
$file = sprintf('%s/vars/%s.php', $this->path, $this->name);
$this->attempted = true;
if (is_file($file) &&
filemtime($file) >= (time() - $this->expire)) {
... | php | {
"resource": ""
} |
q260034 | CacheProvider.makeCache | test | public function makeCache(Vars $vars)
{
if ($this->provide) {
$cache_folder = sprintf("%s/vars", $this->path);
if (!file_exists($cache_folder)) {
mkdir($cache_folder, 0777, true);
}
$cache_file = sprintf('%s/%s.php', $cache_folder, $this->name... | php | {
"resource": ""
} |
q260035 | AssetsVersionManager.setVersion | test | public function setVersion($value)
{
if (!is_string($value) && !is_numeric($value)) {
throw new \InvalidArgumentException(sprintf(
'Wrong value for assets version: %s - it must be string or numeric',
var_export($value, true)
));
}
... | php | {
"resource": ""
} |
q260036 | AssetsVersionManager.readFile | test | protected function readFile()
{
$fileExtension = pathinfo($this->filePath, PATHINFO_EXTENSION);
if ($fileExtension != 'yml' && $fileExtension != 'yaml')
throw new InvalidConfigurationException(sprintf(
'Could not use "%s" - only yml files are supported by AssetsVersi... | php | {
"resource": ""
} |
q260037 | RESTClient.send | test | public function send($request)
{
$this->request = $request;
switch (strtoupper($request->getVerb())) {
case 'GET':
$this->response = $this->get($request);
break;
case 'PUT':
$this->response = $this->put($request);
... | php | {
"resource": ""
} |
q260038 | RESTClient.setOptions | test | protected function setOptions(&$ch, $urlStr, $headers)
{
$url = $this->prefix . $urlStr; // Build full URL
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPAUTH, $this->auth);
curl_setopt($ch, CURLOPT_USERPWD, $... | php | {
"resource": ""
} |
q260039 | RESTClient.get | test | public function get($request)
{
$ch = curl_init();
$this->setOptions($ch, $request->getUrlStr(), $request->getHeaders());
// Options specific to GET
curl_setopt($ch, CURLOPT_HTTPGET, true);
$this->logger->debug("GET");
return $this->execute($ch);
} | php | {
"resource": ""
} |
q260040 | RESTClient.put | test | public function put($request)
{
$this->logger->debug("PUT ");
$ch = curl_init();
// Handle body
$body = $request->getBody();
$requestLength = strlen($body);
$fh = fopen('php://temp', 'rw');
fwrite($fh, $body);
rewind($fh);
$this->setOptions... | php | {
"resource": ""
} |
q260041 | RESTClient.delete | test | public function delete($request)
{
$this->logger->debug("DELETE");
$ch = curl_init();
$this->setOptions($ch, $request->getUrlStr(), $request->getHeaders());
// Options specific to DELETE
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
return $this->execute($ch... | php | {
"resource": ""
} |
q260042 | RESTClient.post | test | public function post($request)
{
$ch = curl_init();
$this->setOptions($ch, $request->getUrlStr(), $request->getHeaders());
curl_setopt($ch, CURLOPT_POST, true);
if ($request->isWWWFormURLEncodedPost()) {
$this->logger->debug("POST www-form-urlencoded");
$r... | php | {
"resource": ""
} |
q260043 | RESTClient.head | test | public function head($request)
{
$ch = curl_init();
$this->setOptions($ch, $request->getUrlStr(), $request->getHeaders());
// Options specific to HEAD
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQU... | php | {
"resource": ""
} |
q260044 | RESTClient.execute | test | protected function execute(&$ch)
{
$response = new RESTResponse();
$curl_exec = curl_exec($ch);
// print('******* START $curl_exec (body) *******' . PHP_EOL);
// print_r($curl_exec);
// print('******* END $curl_exec (body) *******' . PHP_EOL);
$response->setBody($cu... | php | {
"resource": ""
} |
q260045 | RESTClient.installExtension | test | public function installExtension($resource, $params, $filename)
{
if (!isset($params["provider"])) {
$params["provider"] = 'MLPHP';
}
$path = __DIR__ . DIRECTORY_SEPARATOR . "xquery" . DIRECTORY_SEPARATOR . $filename;
$body = file_get_contents($path);
$key = ser... | php | {
"resource": ""
} |
q260046 | RangeConstraint.addBuckets | test | public function addBuckets($buckets) {
if (is_array($buckets)) {
$this->buckets = array_merge($this->buckets, $buckets);
} else {
$this->buckets[] = $buckets;
}
} | php | {
"resource": ""
} |
q260047 | XMLDocument.read | test | public function read($uri = null, $params = array())
{
$this->uri = (isset($uri)) ? (string)$uri : $this->uri;
$params = array_merge(array('format' => 'xml'), $params);
return parent::read($this->uri, $params);
} | php | {
"resource": ""
} |
q260048 | XMLDocument.write | test | public function write($uri = null, $params = array())
{
if ($this->isValidXML($this->getContent())) {
$this->uri = (isset($uri)) ? (string)$uri : $this->uri;
$params = array_merge(array('format' => 'xml'), $params);
return parent::write($this->uri, $params);
} els... | php | {
"resource": ""
} |
q260049 | XMLDocument.isValidXML | test | public function isValidXML($xml)
{
$doc = new \DOMDocument();
try {
return $doc->loadXML($xml) === true;
} catch(\Exception $e) {
$this->logger->warning('XMLDocument::isValidXML() - ' . $e->getMessage());
return false;
}
} | php | {
"resource": ""
} |
q260050 | Values.setUpRange | test | public function setUpRange($elem, $ns = '', $attr = '', $attrNs = '', $datatype = 'string')
{
$this->type = 'range';
$this->elem = (string)$elem;
$this->ns = (string)$ns;
$this->attr = (string)$attr;
$this->attrNs = (string)$attrNs;
$this->datatype = (string)$datatype... | php | {
"resource": ""
} |
q260051 | Values.getValuesAsElem | test | public function getValuesAsElem($dom)
{
$valsElem = $dom->createElement('values');
$valsElem->setAttribute('name', $this->name);
switch ($this->type) {
case 'range':
$rangeElem = $dom->createElement('range');
$rangeElem->setAttribute('type', $this... | php | {
"resource": ""
} |
q260052 | Values.addValuesOptions | test | private function addValuesOptions($dom, $elem)
{
if (!empty($this->valuesOptions)) {
foreach($this->valuesOptions as $opt) {
$valuesElem = $dom->createElement('values-option');
$valuesElem->nodeValue = $opt;
$elem->appendChild($valuesElem);
... | php | {
"resource": ""
} |
q260053 | Values.addAggregate | test | private function addAggregate($dom, $elem)
{
if(!empty($this->aggregate)) {
$aggregateElem = $dom->createElement('aggregate');
$aggregateElem->setAttribute('apply', $this->aggregate);
$elem->appendChild($aggregateElem);
}
return $elem;
} | php | {
"resource": ""
} |
q260054 | Search.getParams | test | public function getParams()
{
$params = array(
'start' => $this->start, 'pageLength' => $this->pageLength,
'view' => $this->view, 'format' => $this->format
);
if(!empty($this->options)) {
$params['options'] = $this->options;
}
if(!empty($th... | php | {
"resource": ""
} |
q260055 | Search.retrieve | test | public function retrieve($query, $params = array(), $structured = false)
{
$this->query = (string)$query;
$params = array_merge(array(($structured ? 'structuredQuery' : 'q') =>
$this->query), $this->getParams(), $params);
$request = new RESTRequest('GET', 'search', $params);
... | php | {
"resource": ""
} |
q260056 | Search.retrieveKeyValue | test | public function retrieveKeyValue($key, $value, $params = array())
{
// /v1/keyvalue is deprecated, use /v1/search with structured
$this->key = (string)$key;
$this->value = (string)$value;
$query = '<query xmlns="http://marklogic.com/appservices/search">
<container... | php | {
"resource": ""
} |
q260057 | Search.retrieveKeyValueElement | test | public function retrieveKeyValueElement(
$element, $attribute, $value, $params = array()
)
{
$this->element = (string)$element;
$this->attribute = (string)$attribute;
$this->value = (string)$value;
// /v1/keyvalue is deprecated, use /v1/search with structured
// $... | php | {
"resource": ""
} |
q260058 | Search.highlight | test | public function highlight(
$content, $contentType, $class, $query,
$params = array(), $structured = false
)
{
// Install the API extension
$resource = "resources/highlight";
$this->client->installExtension("config/" . $resource, array(
'method' => 'post',
... | php | {
"resource": ""
} |
q260059 | MLPHP.getClient | test | public function getClient()
{
return new RESTClient(
$this->config['host'],
$this->config['port'],
$this->config['path'],
$this->config['version'],
$this->config['username'],
$this->config['password'],
$this->config['auth'],... | php | {
"resource": ""
} |
q260060 | MLPHP.getManageClient | test | public function getManageClient()
{
return new RESTClient(
$this->config['host'],
$this->config['managePort'],
$this->config['managePath'],
$this->config['manageVersion'],
$this->config['username'],
$this->config['password'],
... | php | {
"resource": ""
} |
q260061 | MLPHP.getAdminClient | test | public function getAdminClient()
{
return new RESTClient(
$this->config['host'],
$this->config['adminPort'],
$this->config['adminPath'],
$this->config['adminVersion'],
$this->config['username'],
$this->config['password'],
$t... | php | {
"resource": ""
} |
q260062 | MLPHP.getAPI | test | public function getAPI()
{
return new RESTAPI(
$this->config['api'],
$this->config['host'],
$this->config['db'],
$this->config['port'],
$this->config['username'],
$this->config['password']
);
} | php | {
"resource": ""
} |
q260063 | MLPHP.getDatabase | test | public function getDatabase($name = null)
{
$name = $name ? $name : $this->config['db'];
return new Database(
$this->getManageClient(),
$name
);
} | php | {
"resource": ""
} |
q260064 | MLPHP.getOptions | test | public function getOptions($name = null)
{
$name = $name ? $name : $this->config['options'];
return new Options(
$this->getClient(),
$name
);
} | php | {
"resource": ""
} |
q260065 | MLPHP.autoload | test | public static function autoload($className)
{
$thisClass = str_replace(__NAMESPACE__ . '\\', '', __CLASS__);
$baseDir = __DIR__;
if (substr($baseDir, -strlen($thisClass)) === $thisClass) {
$baseDir = substr($baseDir, 0, -strlen($thisClass));
}
$className = ltri... | php | {
"resource": ""
} |
q260066 | Options.getAsXML | test | public function getAsXML()
{
// root
$this->dom = new \DOMDocument(); // reset so we don't continually to add to the options node
$root = $this->dom->createElement('options');
$root->setAttribute('xmlns', 'http://marklogic.com/appservices/search');
$this->dom->appendChild($ro... | php | {
"resource": ""
} |
q260067 | Options.addOption | test | public function addOption($root, $name, $value)
{
if (isset($value)) {
$elem = $this->dom->createElement($name);
$elem->nodeValue = $value;
$root->appendChild($elem);
}
} | php | {
"resource": ""
} |
q260068 | Options.addOptionXML | test | public function addOptionXML($root, $name, $xmlString)
{
if (isset($xmlString)) {
$elem = $this->dom->createElement($name);
$xmlDoc = new \DOMDocument();
$xmlDoc->loadXML($xmlString);
// http://stackoverflow.com/questions/5783716/php-xml-dom-uncaught-exception... | php | {
"resource": ""
} |
q260069 | Options.read | test | public function read($name = null)
{
$name = $name ? $name : $this->name;
try {
$params = array('format' => 'xml');
$request = new RESTRequest('GET', 'config/query/' . $name, $params);
$response = $this->client->send($request);
return $response->getBod... | php | {
"resource": ""
} |
q260070 | Options.write | test | public function write($name = null)
{
$name = $name ? $name : $this->name;
try {
$params = array('format' => 'xml');
$headers = array('Content-type' => 'application/xml');
$request = new RESTRequest('PUT', 'config/query/' . $name, $params, $this->getAsXML(), $head... | php | {
"resource": ""
} |
q260071 | Options.delete | test | public function delete($name)
{
$name = $name ? $name : $this->name;
try {
$request = new RESTRequest('DELETE', 'config/query/' . $name);
$this->response = $response = $this->client->send($request);
return $this;
} catch(Exception $e) {
echo $e... | php | {
"resource": ""
} |
q260072 | Options.setSearchOptions | test | public function setSearchOptions($searchOptions)
{
if (is_array($searchOptions)) {
$this->searchOptions = array_unique(array_merge($this->searchOptions, $searchOptions));
} else {
$this->searchOptions[] = $searchOptions;
$this->searchOptions = array_unique($this->... | php | {
"resource": ""
} |
q260073 | Document.read | test | public function read($uri = null, $params = array())
{
$this->uri = (isset($uri)) ? (string)$uri : $this->uri;
try {
$params = array_merge(array('uri' => $this->uri), $params);
$request = new RESTRequest('GET', 'documents', $params);
$this->response = $this->clien... | php | {
"resource": ""
} |
q260074 | Document.write | test | public function write($uri = null, $params = array())
{
$this->uri = (isset($uri)) ? (string)$uri : $this->uri;
try {
$params = array_merge(array('uri' => $this->uri), $params);
$headers = array();
if ($this->getContentType()) {
$headers = array('C... | php | {
"resource": ""
} |
q260075 | Document.delete | test | public function delete($uri = null)
{
$this->uri = (isset($uri)) ? (string)$uri : $this->uri;
try {
$params = array('uri' => $this->uri);
$request = new RESTRequest('DELETE', 'documents', $params);
$this->response = $this->client->send($request);
} catch(\... | php | {
"resource": ""
} |
q260076 | Document.readMetadata | test | public function readMetadata()
{
try {
$params = array('uri' => $this->uri, 'category' => 'metadata');
$request = new RESTRequest('GET', 'documents', $params);
$this->response = $this->client->send($request);
$metadata = new Metadata();
$metadata->... | php | {
"resource": ""
} |
q260077 | Document.writeMetadata | test | public function writeMetadata($metadata)
{
$metaxml = $metadata->getAsXML();
try {
$params = array('uri' => $this->uri, 'category' => 'metadata', 'format' => 'xml');
$headers = array('Content-type' => 'application/xml');
$request = new RESTRequest('PUT', 'document... | php | {
"resource": ""
} |
q260078 | Document.deleteMetadata | test | public function deleteMetadata()
{
try {
$params = array('uri' => $this->uri, 'category' => 'metadata');
$request = new RESTRequest('DELETE', 'documents', $params);
$this->response = $this->client->send($request);
} catch(\Exception $e) {
$this->logger... | php | {
"resource": ""
} |
q260079 | Document.setContentFile | test | public function setContentFile($file)
{
try {
$content = file_get_contents((string)$file);
} catch(\Exception $e) {
$this->logger->error( $e->getMessage() );
}
$this->setContent($content);
return $this;
} | php | {
"resource": ""
} |
q260080 | Document.getFileMimeType | test | public function getFileMimeType($file)
{
if (function_exists('finfo_file')) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$type = finfo_file($finfo, $file);
finfo_close($finfo);
} else if (function_exists('mime_content_type')) {
$type = mime_content_type(... | php | {
"resource": ""
} |
q260081 | Callmanager.log_soap_call | test | private function log_soap_call($CALL, $TIME, $QUERY, $REPLY)
{
array_push($this->SOAPCALLS,
[
'call' => $CALL,
'time' => $TIME,
'query' => $QUERY,
'reply' => $REPLY,
... | php | {
"resource": ""
} |
q260082 | Callmanager.decode_soap_reply | test | public function decode_soap_reply($SOAPREPLY)
{
if (!is_object($SOAPREPLY)) {
throw new \Exception('SOAP reply is not an object');
}
if (!property_exists($SOAPREPLY, 'return')) {
throw new \Exception('SOAP reply does not have the property return');
}
$... | php | {
"resource": ""
} |
q260083 | Callmanager.assoc_key_values_to_array | test | public function assoc_key_values_to_array($ASSOC, $AKEY, $STOPONERROR = true)
{
$RETURN = [];
// Make sure its $ASSOC is an array or it errors out.
if (is_array($ASSOC)) {
// Loop through the array of key=>value pairs
foreach ($ASSOC as $KEY => $VALUE) {
... | php | {
"resource": ""
} |
q260084 | Callmanager.do_ldap_sync | test | public function do_ldap_sync($NAME, $BOOLEAN)
{
$SEARCH = ['name' => $NAME, 'sync' => $BOOLEAN];
// Search the CUCM for all phones
$BASETIME = $this->microtimeTicks();
$RETURN = $this->SOAPCLIENT->doLdapSync($SEARCH);
$DIFFTIME = $this->microtimeTicks() - $BASETIME;
/... | php | {
"resource": ""
} |
q260085 | Callmanager.get_phone_names | test | public function get_phone_names()
{
$SEARCH = $this->axl_search_return_array(['devicePoolName' => '%'], ['name' => '']);
// Search the CUCM for all phones
$BASETIME = $this->microtimeTicks();
$RETURN = $this->SOAPCLIENT->listPhone($SEARCH);
$DIFFTIME = $this->microtimeTicks()... | php | {
"resource": ""
} |
q260086 | Callmanager.list_all_phones_summary_by_site | test | public function list_all_phones_summary_by_site($SITE)
{
$SEARCH = $this->axl_search_return_array(['devicePoolName' => "%{$SITE}%"], [
'name' => '',
'desc... | php | {
"resource": ""
} |
q260087 | Callmanager.phone_search_by_name | test | public function phone_search_by_name($NAME)
{
$SEARCH = $this->axl_search_return_array(['name' => "%{$NAME}%"], [
'name' => '',
'description' ... | php | {
"resource": ""
} |
q260088 | Callmanager.phone_search | test | public function phone_search($KEY, $SEARCH)
{
/*
$KEYS =
['name',
'description',
'protocol',
'callingSearchSpaceName',
'devicePoolName',
'securityProfileName']
*/
$SEARCH = $this->axl... | php | {
"resource": ""
} |
q260089 | Callmanager.get_phone_by_name | test | public function get_phone_by_name($NAME)
{
$SEARCH = ['name' => $NAME];
$BASETIME = $this->microtimeTicks();
$RETURN = $this->SOAPCLIENT->getPhone($SEARCH);
$DIFFTIME = $this->microtimeTicks() - $BASETIME;
// log our soap call
$this->log_soap_call('getPhone', $DIFFTIM... | php | {
"resource": ""
} |
q260090 | Callmanager.get_directory_numbers_by_name | test | public function get_directory_numbers_by_name($NAME)
{
// Get our phone by name from the previous function
$PHONE = $this->get_phone_by_name($NAME);
if (!isset($PHONE['lines'])) {
throw new \Exception('Phone record does not contain the lines element');
}
if (!is_a... | php | {
"resource": ""
} |
q260091 | Callmanager.get_device_pool_names | test | public function get_device_pool_names()
{
$SEARCH = $this->axl_search_return_array(['name' => '%'], ['name' => '']);
// Search the CUCM for all device pools
$BASETIME = $this->microtimeTicks();
$RETURN = $this->SOAPCLIENT->listDevicePool($SEARCH);
$DIFFTIME = $this->microtime... | php | {
"resource": ""
} |
q260092 | Callmanager.get_site_names | test | public function get_site_names()
{
// Get the list of device pools
$DEVICEPOOLS = $this->get_device_pool_names();
$SITES = [];
// Loop through all of the device pools
foreach ($DEVICEPOOLS as $DP) {
// Detect the DP_SITECODE format and put it into an array
... | php | {
"resource": ""
} |
q260093 | Callmanager.get_lines_by_site | test | public function get_lines_by_site($SITE)
{
// Get all the phone object uuid=>names for a given site (based on device pool)
$PHONES = $this->get_object_type_by_site($SITE, 'Phone');
$LINES = [];
// Loop through our phones at a site and use the UUID to get its detailed object informati... | php | {
"resource": ""
} |
q260094 | Callmanager.get_lines_details_by_phone_name | test | public function get_lines_details_by_phone_name($NAME)
{
// Get all the phone object uuid=>names for a given site (based on device pool)
$LINES = [];
// get phone Line detailed object information
$PHONE = $this->get_object_type_by_name($NAME, 'Phone');
// if there are lines ... | php | {
"resource": ""
} |
q260095 | Callmanager.get_all_object_types_by_site | test | public function get_all_object_types_by_site($SITE)
{
// Get our valid object types
$TYPES = $this->object_types();
// Do not get these objects by site. - They need to be requested directly.
$DISCARD_TYPES = [
'Phone',
'Line',
... | php | {
"resource": ""
} |
q260096 | Callmanager.get_object_type_by_name | test | public function get_object_type_by_name($NAME, $TYPE)
{
// Get our valid object types
$TYPES = $this->object_types();
// TransPattern is not valid for get-item-by-NAME, must use UUID or a combination of name and routepartitionname
$TYPES = array_diff($TYPES, ['TransPattern']);
... | php | {
"resource": ""
} |
q260097 | Callmanager.delete_object_type_by_uuid | test | public function delete_object_type_by_uuid($UUID, $TYPE)
{
// Get our valid object types
$TYPES = $this->object_types();
// Check to see if the one we were passed is valid for this function
if (!in_array($TYPE, $TYPES)) {
throw new \Exception("Object type provided {$TYPE}... | php | {
"resource": ""
} |
q260098 | Permission.addCapabilities | test | public function addCapabilities($capabilities)
{
if (is_array($capabilities)) {
$this->capabilities = array_merge((array)$this->capabilities, (array)$capabilities);
} else {
$this->capabilities[] = (string)$capabilities;
}
} | php | {
"resource": ""
} |
q260099 | IPhoneImageDocument.getLatitude | test | public function getLatitude()
{
if (isset($this->exif)) {
return (float)$this->getGps($this->exif['GPSLatitude'], $this->exif['GPSLatitudeRef']);
} else {
return null;
}
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.