repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
census-instrumentation/opencensus-php
src/Trace/Propagator/HttpHeaderPropagator.php
HttpHeaderPropagator.extract
public function extract($headers) { if (array_key_exists($this->header, $headers)) { return $this->formatter->deserialize($headers[$this->header]); } return new SpanContext(); }
php
public function extract($headers) { if (array_key_exists($this->header, $headers)) { return $this->formatter->deserialize($headers[$this->header]); } return new SpanContext(); }
[ "public", "function", "extract", "(", "$", "headers", ")", "{", "if", "(", "array_key_exists", "(", "$", "this", "->", "header", ",", "$", "headers", ")", ")", "{", "return", "$", "this", "->", "formatter", "->", "deserialize", "(", "$", "headers", "["...
Generate a SpanContext object from the all the HTTP headers @param array $headers @return SpanContext
[ "Generate", "a", "SpanContext", "object", "from", "the", "all", "the", "HTTP", "headers" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Propagator/HttpHeaderPropagator.php#L61-L67
census-instrumentation/opencensus-php
src/Trace/Propagator/HttpHeaderPropagator.php
HttpHeaderPropagator.inject
public function inject(SpanContext $context, $container) { $header = $this->key(); $value = $this->formatter->serialize($context); if (!headers_sent()) { header("$header: $value"); } return [ $header => $value ]; }
php
public function inject(SpanContext $context, $container) { $header = $this->key(); $value = $this->formatter->serialize($context); if (!headers_sent()) { header("$header: $value"); } return [ $header => $value ]; }
[ "public", "function", "inject", "(", "SpanContext", "$", "context", ",", "$", "container", ")", "{", "$", "header", "=", "$", "this", "->", "key", "(", ")", ";", "$", "value", "=", "$", "this", "->", "formatter", "->", "serialize", "(", "$", "context...
Persists the current SpanContext back into the results of this request @param SpanContext $context @param array $container @return array
[ "Persists", "the", "current", "SpanContext", "back", "into", "the", "results", "of", "this", "request" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Propagator/HttpHeaderPropagator.php#L76-L86
census-instrumentation/opencensus-php
src/Trace/RequestHandler.php
RequestHandler.onExit
public function onExit() { $this->addCommonRequestAttributes($this->headers); $this->scope->close(); $this->exporter->export($this->tracer->spans()); }
php
public function onExit() { $this->addCommonRequestAttributes($this->headers); $this->scope->close(); $this->exporter->export($this->tracer->spans()); }
[ "public", "function", "onExit", "(", ")", "{", "$", "this", "->", "addCommonRequestAttributes", "(", "$", "this", "->", "headers", ")", ";", "$", "this", "->", "scope", "->", "close", "(", ")", ";", "$", "this", "->", "exporter", "->", "export", "(", ...
The function registered as the shutdown function. Cleans up the trace and reports using the provided ExporterInterface. Adds additional attributes to the root span detected from the response.
[ "The", "function", "registered", "as", "the", "shutdown", "function", ".", "Cleans", "up", "the", "trace", "and", "reports", "using", "the", "provided", "ExporterInterface", ".", "Adds", "additional", "attributes", "to", "the", "root", "span", "detected", "from"...
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/RequestHandler.php#L135-L142
census-instrumentation/opencensus-php
src/Trace/RequestHandler.php
RequestHandler.addAttribute
public function addAttribute($attribute, $value, $options = []) { $this->tracer->addAttribute($attribute, $value, $options); }
php
public function addAttribute($attribute, $value, $options = []) { $this->tracer->addAttribute($attribute, $value, $options); }
[ "public", "function", "addAttribute", "(", "$", "attribute", ",", "$", "value", ",", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "tracer", "->", "addAttribute", "(", "$", "attribute", ",", "$", "value", ",", "$", "options", ")", ";", ...
Add an attribute to the provided Span @param string $attribute @param string $value @param array $options [optional] Configuration options. @type Span $span The span to add the attribute to.
[ "Add", "an", "attribute", "to", "the", "provided", "Span" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/RequestHandler.php#L204-L207
census-instrumentation/opencensus-php
src/Trace/RequestHandler.php
RequestHandler.addLink
public function addLink($traceId, $spanId, $options = []) { $this->tracer->addLink($traceId, $spanId, $options); }
php
public function addLink($traceId, $spanId, $options = []) { $this->tracer->addLink($traceId, $spanId, $options); }
[ "public", "function", "addLink", "(", "$", "traceId", ",", "$", "spanId", ",", "$", "options", "=", "[", "]", ")", "{", "$", "this", "->", "tracer", "->", "addLink", "(", "$", "traceId", ",", "$", "spanId", ",", "$", "options", ")", ";", "}" ]
Add a link to the provided Span @param string $traceId @param string $spanId @param array $options [optional] Configuration options. @type Span $span The span to add the link to. @type string $type The relationship of the current span relative to the linked span: child, parent, or unspecified. @type array $attributes...
[ "Add", "a", "link", "to", "the", "provided", "Span" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/RequestHandler.php#L237-L240
census-instrumentation/opencensus-php
src/Trace/RequestHandler.php
RequestHandler.addMessageEvent
public function addMessageEvent($type, $id, $options) { $this->tracer->addMessageEvent($type, $id, $options); }
php
public function addMessageEvent($type, $id, $options) { $this->tracer->addMessageEvent($type, $id, $options); }
[ "public", "function", "addMessageEvent", "(", "$", "type", ",", "$", "id", ",", "$", "options", ")", "{", "$", "this", "->", "tracer", "->", "addMessageEvent", "(", "$", "type", ",", "$", "id", ",", "$", "options", ")", ";", "}" ]
Add an message event to the provided Span @param string $type @param string $id @param array $options [optional] Configuration options. @type Span $span The span to add the message event to. @type int $uncompressedSize The number of uncompressed bytes sent or received. @type int $compressedSize The number of compress...
[ "Add", "an", "message", "event", "to", "the", "provided", "Span" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/RequestHandler.php#L257-L260
census-instrumentation/opencensus-php
src/Trace/Sampler/MultiSampler.php
MultiSampler.shouldSample
public function shouldSample() { foreach ($this->samplers as $sampler) { if ($sampler->shouldSample() === false) { return false; } } return true; }
php
public function shouldSample() { foreach ($this->samplers as $sampler) { if ($sampler->shouldSample() === false) { return false; } } return true; }
[ "public", "function", "shouldSample", "(", ")", "{", "foreach", "(", "$", "this", "->", "samplers", "as", "$", "sampler", ")", "{", "if", "(", "$", "sampler", "->", "shouldSample", "(", ")", "===", "false", ")", "{", "return", "false", ";", "}", "}",...
Returns false if any provided sampler chooses not to sample this request. @return bool
[ "Returns", "false", "if", "any", "provided", "sampler", "chooses", "not", "to", "sample", "this", "request", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Sampler/MultiSampler.php#L59-L67
census-instrumentation/opencensus-php
src/Trace/Sampler/QpsSampler.php
QpsSampler.shouldSample
public function shouldSample() { // We will store the microtime timestamp in the cache because some // cache implementations will not let you use expiry for anything less // than 1 minute if ($item = $this->cache->getItem($this->key)) { if ((float) $item->get() > microtim...
php
public function shouldSample() { // We will store the microtime timestamp in the cache because some // cache implementations will not let you use expiry for anything less // than 1 minute if ($item = $this->cache->getItem($this->key)) { if ((float) $item->get() > microtim...
[ "public", "function", "shouldSample", "(", ")", "{", "// We will store the microtime timestamp in the cache because some", "// cache implementations will not let you use expiry for anything less", "// than 1 minute", "if", "(", "$", "item", "=", "$", "this", "->", "cache", "->", ...
Returns whether or not the request should be sampled. @return bool
[ "Returns", "whether", "or", "not", "the", "request", "should", "be", "sampled", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Sampler/QpsSampler.php#L121-L139
census-instrumentation/opencensus-php
src/Trace/Sampler/QpsSampler.php
QpsSampler.defaultCache
private function defaultCache() { if (extension_loaded('apcu') && class_exists('\\Cache\\Adapter\\Apcu\\ApcuCachePool')) { return new \Cache\Adapter\Apcu\ApcuCachePool(); } elseif (extension_loaded('apc') && class_exists('\\Cache\\Adapter\\Apc\\ApcCachePool')) { return new \C...
php
private function defaultCache() { if (extension_loaded('apcu') && class_exists('\\Cache\\Adapter\\Apcu\\ApcuCachePool')) { return new \Cache\Adapter\Apcu\ApcuCachePool(); } elseif (extension_loaded('apc') && class_exists('\\Cache\\Adapter\\Apc\\ApcCachePool')) { return new \C...
[ "private", "function", "defaultCache", "(", ")", "{", "if", "(", "extension_loaded", "(", "'apcu'", ")", "&&", "class_exists", "(", "'\\\\Cache\\\\Adapter\\\\Apcu\\\\ApcuCachePool'", ")", ")", "{", "return", "new", "\\", "Cache", "\\", "Adapter", "\\", "Apcu", "...
Detect a usable PSR-6 cache implementation @return CacheItemPoolInterface
[ "Detect", "a", "usable", "PSR", "-", "6", "cache", "implementation" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Sampler/QpsSampler.php#L146-L154
census-instrumentation/opencensus-php
src/Tags/Codec/Binary.php
Binary.encode
public static function encode(TagContext $tagContext): string { $str = self::TAGS_VERSION_ID; /** @var Tag $tag */ foreach ($tagContext->tags() as $tag) { $str .= self::KEYTYPE_STRING; $key = $tag->getKey()->getName(); $buf = ''; self::encodeUn...
php
public static function encode(TagContext $tagContext): string { $str = self::TAGS_VERSION_ID; /** @var Tag $tag */ foreach ($tagContext->tags() as $tag) { $str .= self::KEYTYPE_STRING; $key = $tag->getKey()->getName(); $buf = ''; self::encodeUn...
[ "public", "static", "function", "encode", "(", "TagContext", "$", "tagContext", ")", ":", "string", "{", "$", "str", "=", "self", "::", "TAGS_VERSION_ID", ";", "/** @var Tag $tag */", "foreach", "(", "$", "tagContext", "->", "tags", "(", ")", "as", "$", "t...
Encode the provided TagContext to our binary wire format. @param TagContext $tagContext the object holding the Tag's to encode. @return string the bytestring holding our binary encoded Tag's.
[ "Encode", "the", "provided", "TagContext", "to", "our", "binary", "wire", "format", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Tags/Codec/Binary.php#L48-L64
census-instrumentation/opencensus-php
src/Tags/Codec/Binary.php
Binary.decode
public static function decode(string $str, \Exception &$err = null): TagContext { $tagContext = TagContext::empty(); $strLen = strlen($str); if ($strLen == 0) { return $tagContext; } if ($str[0] > self::TAGS_VERSION_ID) { $err = new \Exception("cannot ...
php
public static function decode(string $str, \Exception &$err = null): TagContext { $tagContext = TagContext::empty(); $strLen = strlen($str); if ($strLen == 0) { return $tagContext; } if ($str[0] > self::TAGS_VERSION_ID) { $err = new \Exception("cannot ...
[ "public", "static", "function", "decode", "(", "string", "$", "str", ",", "\\", "Exception", "&", "$", "err", "=", "null", ")", ":", "TagContext", "{", "$", "tagContext", "=", "TagContext", "::", "empty", "(", ")", ";", "$", "strLen", "=", "strlen", ...
Decode the provided TagContext from the binary wire format. @param string $str The bytestring holding our encoded TagContext. @param \Exception $err Set on deserialization errors and size constraints. @return TagContext
[ "Decode", "the", "provided", "TagContext", "from", "the", "binary", "wire", "format", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Tags/Codec/Binary.php#L73-L163
census-instrumentation/opencensus-php
src/Trace/Propagator/GrpcMetadataPropagator.php
GrpcMetadataPropagator.extract
public function extract($metadata) { if (array_key_exists($this->key, $metadata)) { return $this->formatter->deserialize($metadata[$this->key]); } return new SpanContext(); }
php
public function extract($metadata) { if (array_key_exists($this->key, $metadata)) { return $this->formatter->deserialize($metadata[$this->key]); } return new SpanContext(); }
[ "public", "function", "extract", "(", "$", "metadata", ")", "{", "if", "(", "array_key_exists", "(", "$", "this", "->", "key", ",", "$", "metadata", ")", ")", "{", "return", "$", "this", "->", "formatter", "->", "deserialize", "(", "$", "metadata", "["...
Generate a SpanContext object from the all the HTTP headers @param array $metadata @return SpanContext
[ "Generate", "a", "SpanContext", "object", "from", "the", "all", "the", "HTTP", "headers" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Propagator/GrpcMetadataPropagator.php#L61-L67
census-instrumentation/opencensus-php
src/Trace/Propagator/GrpcMetadataPropagator.php
GrpcMetadataPropagator.inject
public function inject(SpanContext $context, $metadata) { $metadata[$this->key] = $this->formatter->serialize($context); return $metadata; }
php
public function inject(SpanContext $context, $metadata) { $metadata[$this->key] = $this->formatter->serialize($context); return $metadata; }
[ "public", "function", "inject", "(", "SpanContext", "$", "context", ",", "$", "metadata", ")", "{", "$", "metadata", "[", "$", "this", "->", "key", "]", "=", "$", "this", "->", "formatter", "->", "serialize", "(", "$", "context", ")", ";", "return", ...
Persiste the current SpanContext back into the results of this request @param SpanContext $context @param array $container @return array
[ "Persiste", "the", "current", "SpanContext", "back", "into", "the", "results", "of", "this", "request" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Propagator/GrpcMetadataPropagator.php#L76-L80
census-instrumentation/opencensus-php
src/Trace/Propagator/TraceContextFormatter.php
TraceContextFormatter.deserialize
public function deserialize($header) { if (preg_match(self::CONTEXT_HEADER_FORMAT, $header, $matches)) { if ($matches[1] == "00") { return $this->deserializeVersion0($matches[2]); } else { trigger_error("Unrecognized SpanContext header version: " . $ma...
php
public function deserialize($header) { if (preg_match(self::CONTEXT_HEADER_FORMAT, $header, $matches)) { if ($matches[1] == "00") { return $this->deserializeVersion0($matches[2]); } else { trigger_error("Unrecognized SpanContext header version: " . $ma...
[ "public", "function", "deserialize", "(", "$", "header", ")", "{", "if", "(", "preg_match", "(", "self", "::", "CONTEXT_HEADER_FORMAT", ",", "$", "header", ",", "$", "matches", ")", ")", "{", "if", "(", "$", "matches", "[", "1", "]", "==", "\"00\"", ...
Generate a SpanContext object from the Trace Context header @param string $header @return SpanContext
[ "Generate", "a", "SpanContext", "object", "from", "the", "Trace", "Context", "header" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Propagator/TraceContextFormatter.php#L38-L48
census-instrumentation/opencensus-php
src/Trace/Propagator/TraceContextFormatter.php
TraceContextFormatter.serialize
public function serialize(SpanContext $context) { $ret = '00-' . $context->traceId(); if ($context->spanId()) { $ret .= '-' . str_pad($context->spanId(), 16, "0", STR_PAD_LEFT); } if ($context->enabled() !== null) { $ret .= '-' . ($context->enabled() ? '01' : ...
php
public function serialize(SpanContext $context) { $ret = '00-' . $context->traceId(); if ($context->spanId()) { $ret .= '-' . str_pad($context->spanId(), 16, "0", STR_PAD_LEFT); } if ($context->enabled() !== null) { $ret .= '-' . ($context->enabled() ? '01' : ...
[ "public", "function", "serialize", "(", "SpanContext", "$", "context", ")", "{", "$", "ret", "=", "'00-'", ".", "$", "context", "->", "traceId", "(", ")", ";", "if", "(", "$", "context", "->", "spanId", "(", ")", ")", "{", "$", "ret", ".=", "'-'", ...
Convert a SpanContext to header string. Uses version 0. @param SpanContext $context @return string
[ "Convert", "a", "SpanContext", "to", "header", "string", ".", "Uses", "version", "0", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Propagator/TraceContextFormatter.php#L56-L66
census-instrumentation/opencensus-php
src/Trace/Propagator/CloudTraceFormatter.php
CloudTraceFormatter.deserialize
public function deserialize($header) { if (preg_match(self::CONTEXT_HEADER_FORMAT, $header, $matches)) { return new SpanContext( strtolower($matches[1]), array_key_exists(2, $matches) && !empty($matches[2]) ? $this->decToHex($matches[2]) ...
php
public function deserialize($header) { if (preg_match(self::CONTEXT_HEADER_FORMAT, $header, $matches)) { return new SpanContext( strtolower($matches[1]), array_key_exists(2, $matches) && !empty($matches[2]) ? $this->decToHex($matches[2]) ...
[ "public", "function", "deserialize", "(", "$", "header", ")", "{", "if", "(", "preg_match", "(", "self", "::", "CONTEXT_HEADER_FORMAT", ",", "$", "header", ",", "$", "matches", ")", ")", "{", "return", "new", "SpanContext", "(", "strtolower", "(", "$", "...
Generate a SpanContext object from the Trace Context header @param string $header @return SpanContext
[ "Generate", "a", "SpanContext", "object", "from", "the", "Trace", "Context", "header" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Propagator/CloudTraceFormatter.php#L39-L52
census-instrumentation/opencensus-php
src/Trace/Propagator/CloudTraceFormatter.php
CloudTraceFormatter.serialize
public function serialize(SpanContext $context) { $ret = '' . $context->traceId(); if ($context->spanId()) { $ret .= '/' . $this->hexToDec($context->spanId()); } if ($context->enabled() !== null) { $ret .= ';o=' . ($context->enabled() ? '1' : '0'); } ...
php
public function serialize(SpanContext $context) { $ret = '' . $context->traceId(); if ($context->spanId()) { $ret .= '/' . $this->hexToDec($context->spanId()); } if ($context->enabled() !== null) { $ret .= ';o=' . ($context->enabled() ? '1' : '0'); } ...
[ "public", "function", "serialize", "(", "SpanContext", "$", "context", ")", "{", "$", "ret", "=", "''", ".", "$", "context", "->", "traceId", "(", ")", ";", "if", "(", "$", "context", "->", "spanId", "(", ")", ")", "{", "$", "ret", ".=", "'/'", "...
Convert a SpanContext to header string @param SpanContext $context @return string
[ "Convert", "a", "SpanContext", "to", "header", "string" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Propagator/CloudTraceFormatter.php#L60-L70
census-instrumentation/opencensus-php
src/Trace/Integrations/Laravel.php
Laravel.load
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load Laravel integrations.', E_USER_WARNING); return; } Eloquent::load(); // Create a trace span for every template rendered // pub...
php
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load Laravel integrations.', E_USER_WARNING); return; } Eloquent::load(); // Create a trace span for every template rendered // pub...
[ "public", "static", "function", "load", "(", ")", "{", "if", "(", "!", "extension_loaded", "(", "'opencensus'", ")", ")", "{", "trigger_error", "(", "'opencensus extension required to load Laravel integrations.'", ",", "E_USER_WARNING", ")", ";", "return", ";", "}",...
Static method to add instrumentation to the Laravel framework
[ "Static", "method", "to", "add", "instrumentation", "to", "the", "Laravel", "framework" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Integrations/Laravel.php#L37-L56
census-instrumentation/opencensus-php
src/Stats/Measure.php
Measure.newIntMeasure
public static function newIntMeasure(string $name, string $description, string $unit): IntMeasure { return IntMeasure::create($name, $description, $unit); }
php
public static function newIntMeasure(string $name, string $description, string $unit): IntMeasure { return IntMeasure::create($name, $description, $unit); }
[ "public", "static", "function", "newIntMeasure", "(", "string", "$", "name", ",", "string", "$", "description", ",", "string", "$", "unit", ")", ":", "IntMeasure", "{", "return", "IntMeasure", "::", "create", "(", "$", "name", ",", "$", "description", ",",...
Constructs a new IntMeasure. @param string $name Unique name of the Measure. @param string $description Human readable discription of the Measure. @param string $unit Unit of the Measure. See <a href="http://unitsofmeasure.org/ucum.html">Unified Code for Units of Measure</a> @return IntMeasure @throws \Exception Throw...
[ "Constructs", "a", "new", "IntMeasure", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Stats/Measure.php#L132-L135
census-instrumentation/opencensus-php
src/Stats/Measure.php
Measure.newFloatMeasure
public static function newFloatMeasure(string $name, string $description, string $unit): FloatMeasure { return FloatMeasure::create($name, $description, $unit); }
php
public static function newFloatMeasure(string $name, string $description, string $unit): FloatMeasure { return FloatMeasure::create($name, $description, $unit); }
[ "public", "static", "function", "newFloatMeasure", "(", "string", "$", "name", ",", "string", "$", "description", ",", "string", "$", "unit", ")", ":", "FloatMeasure", "{", "return", "FloatMeasure", "::", "create", "(", "$", "name", ",", "$", "description", ...
Constructs a new FloatMeasure. @param string $name Unique name of the Measure. @param string $description Human readable discription of the Measure. @param string $unit Unit of the Measure. See <a href="http://unitsofmeasure.org/ucum.html">Unified Code for Units of Measure</a> @return FloatMeasure @throws \Exception T...
[ "Constructs", "a", "new", "FloatMeasure", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Stats/Measure.php#L147-L150
census-instrumentation/opencensus-php
src/Trace/Integrations/Doctrine.php
Doctrine.load
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load Doctrine integrations.', E_USER_WARNING); return; } PDO::load(); $persisterClass = (Version::compare('2.5.0') < 0) ? 'Doct...
php
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load Doctrine integrations.', E_USER_WARNING); return; } PDO::load(); $persisterClass = (Version::compare('2.5.0') < 0) ? 'Doct...
[ "public", "static", "function", "load", "(", ")", "{", "if", "(", "!", "extension_loaded", "(", "'opencensus'", ")", ")", "{", "trigger_error", "(", "'opencensus extension required to load Doctrine integrations.'", ",", "E_USER_WARNING", ")", ";", "return", ";", "}"...
Static method to add instrumentation to Doctrine ORM calls
[ "Static", "method", "to", "add", "instrumentation", "to", "Doctrine", "ORM", "calls" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Integrations/Doctrine.php#L38-L78
census-instrumentation/opencensus-php
src/Utils/PrintableTrait.php
PrintableTrait.isPrintable
private static function isPrintable($str) { for ($i = 0; $i < strlen($str); $i++) { if (!($str[$i] >= ' ' && $str[$i] <= '~')) { return false; } } return true; }
php
private static function isPrintable($str) { for ($i = 0; $i < strlen($str); $i++) { if (!($str[$i] >= ' ' && $str[$i] <= '~')) { return false; } } return true; }
[ "private", "static", "function", "isPrintable", "(", "$", "str", ")", "{", "for", "(", "$", "i", "=", "0", ";", "$", "i", "<", "strlen", "(", "$", "str", ")", ";", "$", "i", "++", ")", "{", "if", "(", "!", "(", "$", "str", "[", "$", "i", ...
Determines whether the string contains only printable characters. @param string $str string to test. @return bool returns true if string is printable.
[ "Determines", "whether", "the", "string", "contains", "only", "printable", "characters", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Utils/PrintableTrait.php#L31-L39
census-instrumentation/opencensus-php
src/Trace/Span.php
Span.spanData
public function spanData() { return new SpanData( $this->name, $this->traceId, $this->spanId, $this->startTime, $this->endTime, [ 'parentSpanId' => $this->parentSpanId, 'attributes' => $this->attributes, ...
php
public function spanData() { return new SpanData( $this->name, $this->traceId, $this->spanId, $this->startTime, $this->endTime, [ 'parentSpanId' => $this->parentSpanId, 'attributes' => $this->attributes, ...
[ "public", "function", "spanData", "(", ")", "{", "return", "new", "SpanData", "(", "$", "this", "->", "name", ",", "$", "this", "->", "traceId", ",", "$", "this", "->", "spanId", ",", "$", "this", "->", "startTime", ",", "$", "this", "->", "endTime",...
Return a read-only version of this span. @return SpanData
[ "Return", "a", "read", "-", "only", "version", "of", "this", "span", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Span.php#L280-L299
census-instrumentation/opencensus-php
src/Trace/Span.php
Span.addAttribute
public function addAttribute($attribute, $value) { $this->attributes[$attribute] = (string) $value; $this->eventHandler->attributeAdded($this, $attribute, $value); }
php
public function addAttribute($attribute, $value) { $this->attributes[$attribute] = (string) $value; $this->eventHandler->attributeAdded($this, $attribute, $value); }
[ "public", "function", "addAttribute", "(", "$", "attribute", ",", "$", "value", ")", "{", "$", "this", "->", "attributes", "[", "$", "attribute", "]", "=", "(", "string", ")", "$", "value", ";", "$", "this", "->", "eventHandler", "->", "attributeAdded", ...
Add an attribute to this span. @param string $attribute The name of the attribute to add @param string $value The attribute value
[ "Add", "an", "attribute", "to", "this", "span", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Span.php#L325-L329
census-instrumentation/opencensus-php
src/Trace/Span.php
Span.addTimeEvent
public function addTimeEvent(TimeEvent $timeEvent) { $this->timeEvents[] = $timeEvent; $this->eventHandler->timeEventAdded($this, $timeEvent); }
php
public function addTimeEvent(TimeEvent $timeEvent) { $this->timeEvents[] = $timeEvent; $this->eventHandler->timeEventAdded($this, $timeEvent); }
[ "public", "function", "addTimeEvent", "(", "TimeEvent", "$", "timeEvent", ")", "{", "$", "this", "->", "timeEvents", "[", "]", "=", "$", "timeEvent", ";", "$", "this", "->", "eventHandler", "->", "timeEventAdded", "(", "$", "this", ",", "$", "timeEvent", ...
Add a time event to this span. @param TimeEvent $timeEvent
[ "Add", "a", "time", "event", "to", "this", "span", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Span.php#L348-L352
census-instrumentation/opencensus-php
src/Trace/Span.php
Span.addLink
public function addLink(Link $link) { $this->links[] = $link; $this->eventHandler->linkAdded($this, $link); }
php
public function addLink(Link $link) { $this->links[] = $link; $this->eventHandler->linkAdded($this, $link); }
[ "public", "function", "addLink", "(", "Link", "$", "link", ")", "{", "$", "this", "->", "links", "[", "]", "=", "$", "link", ";", "$", "this", "->", "eventHandler", "->", "linkAdded", "(", "$", "this", ",", "$", "link", ")", ";", "}" ]
Add a link to this span. @param Link $link
[ "Add", "a", "link", "to", "this", "span", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Span.php#L371-L375
census-instrumentation/opencensus-php
src/Trace/Span.php
Span.filterStackTrace
private function filterStackTrace($stackTrace) { return array_values( array_filter($stackTrace, function ($st) { return !array_key_exists('class', $st) || substr($st['class'], 0, 16) != 'OpenCensus\Trace'; }) ); }
php
private function filterStackTrace($stackTrace) { return array_values( array_filter($stackTrace, function ($st) { return !array_key_exists('class', $st) || substr($st['class'], 0, 16) != 'OpenCensus\Trace'; }) ); }
[ "private", "function", "filterStackTrace", "(", "$", "stackTrace", ")", "{", "return", "array_values", "(", "array_filter", "(", "$", "stackTrace", ",", "function", "(", "$", "st", ")", "{", "return", "!", "array_key_exists", "(", "'class'", ",", "$", "st", ...
Return a filtered stackTrace where we strip out all functions from the OpenCensus\Trace namespace @return array
[ "Return", "a", "filtered", "stackTrace", "where", "we", "strip", "out", "all", "functions", "from", "the", "OpenCensus", "\\", "Trace", "namespace" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Span.php#L404-L411
census-instrumentation/opencensus-php
src/Trace/Span.php
Span.generateSpanName
private function generateSpanName() { // Try to find the first stacktrace class entry that doesn't start with OpenCensus\Trace foreach ($this->stackTrace as $st) { $st += ['line' => null]; if (!array_key_exists('class', $st)) { return implode('/', array_filter...
php
private function generateSpanName() { // Try to find the first stacktrace class entry that doesn't start with OpenCensus\Trace foreach ($this->stackTrace as $st) { $st += ['line' => null]; if (!array_key_exists('class', $st)) { return implode('/', array_filter...
[ "private", "function", "generateSpanName", "(", ")", "{", "// Try to find the first stacktrace class entry that doesn't start with OpenCensus\\Trace", "foreach", "(", "$", "this", "->", "stackTrace", "as", "$", "st", ")", "{", "$", "st", "+=", "[", "'line'", "=>", "nu...
Generate a name for this span. Attempts to generate a name based on the caller's code. @return string
[ "Generate", "a", "name", "for", "this", "span", ".", "Attempts", "to", "generate", "a", "name", "based", "on", "the", "caller", "s", "code", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Span.php#L419-L433
census-instrumentation/opencensus-php
src/Core/Context.php
Context.withValue
public function withValue($key, $value) { $copy = $this->values; $copy[$key] = $value; return new Context($copy); }
php
public function withValue($key, $value) { $copy = $this->values; $copy[$key] = $value; return new Context($copy); }
[ "public", "function", "withValue", "(", "$", "key", ",", "$", "value", ")", "{", "$", "copy", "=", "$", "this", "->", "values", ";", "$", "copy", "[", "$", "key", "]", "=", "$", "value", ";", "return", "new", "Context", "(", "$", "copy", ")", "...
Creates a new context with the given key/value set. @param string $key @param mixed $value @return Context
[ "Creates", "a", "new", "context", "with", "the", "given", "key", "/", "value", "set", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Core/Context.php#L66-L71
census-instrumentation/opencensus-php
src/Core/Context.php
Context.withValues
public function withValues($data) { $copy = $this->values; foreach ($data as $key => $value) { $copy[$key] = $value; } return new Context($copy); }
php
public function withValues($data) { $copy = $this->values; foreach ($data as $key => $value) { $copy[$key] = $value; } return new Context($copy); }
[ "public", "function", "withValues", "(", "$", "data", ")", "{", "$", "copy", "=", "$", "this", "->", "values", ";", "foreach", "(", "$", "data", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "copy", "[", "$", "key", "]", "=", "$", "value...
Creates a new context with the given key/values. @param array $data @return Context
[ "Creates", "a", "new", "context", "with", "the", "given", "key", "/", "values", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Core/Context.php#L79-L86
census-instrumentation/opencensus-php
src/Core/Context.php
Context.value
public function value($key, $default = null) { return array_key_exists($key, $this->values) ? $this->values[$key] : $default; }
php
public function value($key, $default = null) { return array_key_exists($key, $this->values) ? $this->values[$key] : $default; }
[ "public", "function", "value", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "return", "array_key_exists", "(", "$", "key", ",", "$", "this", "->", "values", ")", "?", "$", "this", "->", "values", "[", "$", "key", "]", ":", "$", "d...
Fetches the value for a given key in this context. Returns the provided default if not set. @param string $key @param mixed $default [optional] @return mixed
[ "Fetches", "the", "value", "for", "a", "given", "key", "in", "this", "context", ".", "Returns", "the", "provided", "default", "if", "not", "set", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Core/Context.php#L96-L101
census-instrumentation/opencensus-php
src/Core/Context.php
Context.detach
public function detach(Context $toAttach) { if (self::current() !== $this) { trigger_error('Unexpected context to detach.', E_USER_WARNING); } self::$current = $toAttach; }
php
public function detach(Context $toAttach) { if (self::current() !== $this) { trigger_error('Unexpected context to detach.', E_USER_WARNING); } self::$current = $toAttach; }
[ "public", "function", "detach", "(", "Context", "$", "toAttach", ")", "{", "if", "(", "self", "::", "current", "(", ")", "!==", "$", "this", ")", "{", "trigger_error", "(", "'Unexpected context to detach.'", ",", "E_USER_WARNING", ")", ";", "}", "self", ":...
Reverses an attach(), restoring the previous context and exiting the current scope. @param Context $toAttach
[ "Reverses", "an", "attach", "()", "restoring", "the", "previous", "context", "and", "exiting", "the", "current", "scope", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Core/Context.php#L132-L139
census-instrumentation/opencensus-php
src/Trace/Integrations/Wordpress.php
Wordpress.load
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load Wordpress integrations.', E_USER_WARNING); return; } Mysql::load(); $nameClosure = function () { if (func_num_args() > 0) ...
php
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load Wordpress integrations.', E_USER_WARNING); return; } Mysql::load(); $nameClosure = function () { if (func_num_args() > 0) ...
[ "public", "static", "function", "load", "(", ")", "{", "if", "(", "!", "extension_loaded", "(", "'opencensus'", ")", ")", "{", "trigger_error", "(", "'opencensus extension required to load Wordpress integrations.'", ",", "E_USER_WARNING", ")", ";", "return", ";", "}...
Static method to add instrumentation to the Wordpress framework
[ "Static", "method", "to", "add", "instrumentation", "to", "the", "Wordpress", "framework" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Integrations/Wordpress.php#L35-L75
census-instrumentation/opencensus-php
src/Tags/TagKey.php
TagKey.create
public static function create(string $name): TagKey { if (strlen($name) == 0 || strlen($name) > self::MAX_LENGTH || !self::isPrintable($name)) { throw new \Exception("Invalid TagKey name: ". $name); } return new self($name); }
php
public static function create(string $name): TagKey { if (strlen($name) == 0 || strlen($name) > self::MAX_LENGTH || !self::isPrintable($name)) { throw new \Exception("Invalid TagKey name: ". $name); } return new self($name); }
[ "public", "static", "function", "create", "(", "string", "$", "name", ")", ":", "TagKey", "{", "if", "(", "strlen", "(", "$", "name", ")", "==", "0", "||", "strlen", "(", "$", "name", ")", ">", "self", "::", "MAX_LENGTH", "||", "!", "self", "::", ...
Constructs a TagKey with the given name. The name must meet the following requirements: <ol> <li>It cannot be empty <li>It cannot be longer than TagKey::MAX_LENGTH <li>It can only contain printable ASCII characters. </ol> @param string $name the name of the key @return TagKey @throws \Exception if name is not valid.
[ "Constructs", "a", "TagKey", "with", "the", "given", "name", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Tags/TagKey.php#L54-L60
census-instrumentation/opencensus-php
src/Trace/Integrations/Postgres.php
Postgres.load
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load pg integrations.', E_USER_WARNING); return; } // resource pg_connect ( string $connection_string [, int $connect_type ] ) // resource p...
php
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load pg integrations.', E_USER_WARNING); return; } // resource pg_connect ( string $connection_string [, int $connect_type ] ) // resource p...
[ "public", "static", "function", "load", "(", ")", "{", "if", "(", "!", "extension_loaded", "(", "'opencensus'", ")", ")", "{", "trigger_error", "(", "'opencensus extension required to load pg integrations.'", ",", "E_USER_WARNING", ")", ";", "return", ";", "}", "/...
Static method to add instrumentation to the postgres requests
[ "Static", "method", "to", "add", "instrumentation", "to", "the", "postgres", "requests" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Integrations/Postgres.php#L37-L98
census-instrumentation/opencensus-php
src/Trace/Integrations/Symfony.php
Symfony.load
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load Symfony integrations.', E_USER_WARNING); return; } Doctrine::load(); // public function handle(Request $request, $type = HttpKernelInt...
php
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load Symfony integrations.', E_USER_WARNING); return; } Doctrine::load(); // public function handle(Request $request, $type = HttpKernelInt...
[ "public", "static", "function", "load", "(", ")", "{", "if", "(", "!", "extension_loaded", "(", "'opencensus'", ")", ")", "{", "trigger_error", "(", "'opencensus extension required to load Symfony integrations.'", ",", "E_USER_WARNING", ")", ";", "return", ";", "}",...
Static method to add instrumentation to the Symfony framework
[ "Static", "method", "to", "add", "instrumentation", "to", "the", "Symfony", "framework" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Integrations/Symfony.php#L38-L61
census-instrumentation/opencensus-php
src/Trace/Integrations/Grpc.php
Grpc.load
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load grpc integrations.', E_USER_WARNING); return; } // protected function _simpleRequest($method, $argument, $deserialize, array $metadata = [], ...
php
public static function load() { if (!extension_loaded('opencensus')) { trigger_error('opencensus extension required to load grpc integrations.', E_USER_WARNING); return; } // protected function _simpleRequest($method, $argument, $deserialize, array $metadata = [], ...
[ "public", "static", "function", "load", "(", ")", "{", "if", "(", "!", "extension_loaded", "(", "'opencensus'", ")", ")", "{", "trigger_error", "(", "'opencensus extension required to load grpc integrations.'", ",", "E_USER_WARNING", ")", ";", "return", ";", "}", ...
Static method to add instrumentation to grpc requests
[ "Static", "method", "to", "add", "instrumentation", "to", "grpc", "requests" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Integrations/Grpc.php#L40-L97
census-instrumentation/opencensus-php
src/Trace/Integrations/Grpc.php
Grpc.updateMetadata
public static function updateMetadata($metadata, $jwtAuthUri) { $context = Tracer::spanContext(); if ($context->enabled()) { $propagator = new GrpcMetadataPropagator(); $metadata += [ $propagator->key() => [$propagator->formatter()->serialize($context)] ...
php
public static function updateMetadata($metadata, $jwtAuthUri) { $context = Tracer::spanContext(); if ($context->enabled()) { $propagator = new GrpcMetadataPropagator(); $metadata += [ $propagator->key() => [$propagator->formatter()->serialize($context)] ...
[ "public", "static", "function", "updateMetadata", "(", "$", "metadata", ",", "$", "jwtAuthUri", ")", "{", "$", "context", "=", "Tracer", "::", "spanContext", "(", ")", ";", "if", "(", "$", "context", "->", "enabled", "(", ")", ")", "{", "$", "propagato...
Update metadata handler for grpc clients. Example: ``` use OpenCensus\Trace\Integrations\Grpc; # MathClient is the generated client from the proto definition $client = new Math\MathClient($host, ['update_metadata' => [Grpc::class, 'updateMetadata']]); # The call will pass the current trace context using the GrpcMet...
[ "Update", "metadata", "handler", "for", "grpc", "clients", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Integrations/Grpc.php#L119-L129
census-instrumentation/opencensus-php
src/Trace/Integrations/Guzzle/EventSubscriber.php
EventSubscriber.onBefore
public function onBefore(BeforeEvent $event) { $request = $event->getRequest(); $context = Tracer::spanContext(); if ($context->enabled()) { $request->setHeader($this->propagator->key(), $this->propagator->formatter()->serialize($context)); } $span = Tracer::start...
php
public function onBefore(BeforeEvent $event) { $request = $event->getRequest(); $context = Tracer::spanContext(); if ($context->enabled()) { $request->setHeader($this->propagator->key(), $this->propagator->formatter()->serialize($context)); } $span = Tracer::start...
[ "public", "function", "onBefore", "(", "BeforeEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "$", "context", "=", "Tracer", "::", "spanContext", "(", ")", ";", "if", "(", "$", "context", "->", "e...
Handler for the BeforeEvent request lifecycle event. Adds the current trace context as the trace context header. Also starts a span representing this outgoing http request. @param BeforeEvent $event Event object emitted before a request is sent
[ "Handler", "for", "the", "BeforeEvent", "request", "lifecycle", "event", ".", "Adds", "the", "current", "trace", "context", "as", "the", "trace", "context", "header", ".", "Also", "starts", "a", "span", "representing", "this", "outgoing", "http", "request", "....
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Integrations/Guzzle/EventSubscriber.php#L86-L102
census-instrumentation/opencensus-php
src/Stats/View/Aggregation.php
Aggregation.distribution
final public static function distribution(array $bounds): Aggregation { foreach ($bounds as &$value) { if (!is_float($value) && !is_integer($value)) { throw new \Exception("provided bucket boundaries need to be of type float"); } $value = (float) $value; ...
php
final public static function distribution(array $bounds): Aggregation { foreach ($bounds as &$value) { if (!is_float($value) && !is_integer($value)) { throw new \Exception("provided bucket boundaries need to be of type float"); } $value = (float) $value; ...
[ "final", "public", "static", "function", "distribution", "(", "array", "$", "bounds", ")", ":", "Aggregation", "{", "foreach", "(", "$", "bounds", "as", "&", "$", "value", ")", "{", "if", "(", "!", "is_float", "(", "$", "value", ")", "&&", "!", "is_i...
Returns a new Distribution Aggregation with the provided Bucket Boundaries. Bucket Boundaries needs to be an array of integer and/or floats. @param float[] $bounds The bucket boundaries for distribution aggregation. @throws \Exception Throws on invalid bucket boundaries. @return Aggregation
[ "Returns", "a", "new", "Distribution", "Aggregation", "with", "the", "provided", "Bucket", "Boundaries", ".", "Bucket", "Boundaries", "needs", "to", "be", "an", "array", "of", "integer", "and", "/", "or", "floats", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Stats/View/Aggregation.php#L94-L105
census-instrumentation/opencensus-php
src/Stats/IntMeasure.php
IntMeasure.create
final public static function create( string $name, string $description = "", string $unit = Measure::DIMENSIONLESS ): IntMeasure { return self::registerMeasureHandle($name, $description, $unit); }
php
final public static function create( string $name, string $description = "", string $unit = Measure::DIMENSIONLESS ): IntMeasure { return self::registerMeasureHandle($name, $description, $unit); }
[ "final", "public", "static", "function", "create", "(", "string", "$", "name", ",", "string", "$", "description", "=", "\"\"", ",", "string", "$", "unit", "=", "Measure", "::", "DIMENSIONLESS", ")", ":", "IntMeasure", "{", "return", "self", "::", "register...
Constructs a new IntMeasure. @param string $name Unique name of the Measure. @param string $description Human readable discription of the Measure. @param string $unit Unit of the Measure. See <a href="http://unitsofmeasure.org/ucum.html">Unified Code for Units of Measure</a> @return IntMeasure @throws \Exception Throw...
[ "Constructs", "a", "new", "IntMeasure", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Stats/IntMeasure.php#L51-L57
census-instrumentation/opencensus-php
src/Stats/IntMeasure.php
IntMeasure.m
final public function m(int $value): Measurement { return new class($this, $value) extends Measurement { /** * @internal * * @param Measure $measure The Measure. * @param int $value The Measurement value. */ pub...
php
final public function m(int $value): Measurement { return new class($this, $value) extends Measurement { /** * @internal * * @param Measure $measure The Measure. * @param int $value The Measurement value. */ pub...
[ "final", "public", "function", "m", "(", "int", "$", "value", ")", ":", "Measurement", "{", "return", "new", "class", "(", "$", "this", ",", "$", "value", ")", "extends", "Measurement", "{", "/**\n * @internal\n *\n * @param Measu...
Creates a Measurement of provided value. @param int $value the measurement value. @return Measurement Returns a Measurement object which can be recorded.
[ "Creates", "a", "Measurement", "of", "provided", "value", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Stats/IntMeasure.php#L65-L80
census-instrumentation/opencensus-php
src/Tags/TagContext.php
TagContext.insert
final public function insert(TagKey $key, TagValue $value): bool { if (\array_key_exists($key->getName(), $this->m)) { return false; } $this->m[$key->getName()] = new Tag($key, $value); return true; }
php
final public function insert(TagKey $key, TagValue $value): bool { if (\array_key_exists($key->getName(), $this->m)) { return false; } $this->m[$key->getName()] = new Tag($key, $value); return true; }
[ "final", "public", "function", "insert", "(", "TagKey", "$", "key", ",", "TagValue", "$", "value", ")", ":", "bool", "{", "if", "(", "\\", "array_key_exists", "(", "$", "key", "->", "getName", "(", ")", ",", "$", "this", "->", "m", ")", ")", "{", ...
Insert a Tag into TagContext given provided TagKey and string value. If TagKey already exists in TagContext this method is a noop. @param TagKey $key the key of the Tag. @param TagValue $value the value of the Tag. @return bool returns true on successful insert.
[ "Insert", "a", "Tag", "into", "TagContext", "given", "provided", "TagKey", "and", "string", "value", ".", "If", "TagKey", "already", "exists", "in", "TagContext", "this", "method", "is", "a", "noop", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Tags/TagContext.php#L74-L82
census-instrumentation/opencensus-php
src/Tags/TagContext.php
TagContext.upsert
final public function upsert(TagKey $key, TagValue $value) { $this->m[$key->getName()] = new Tag($key, $value); }
php
final public function upsert(TagKey $key, TagValue $value) { $this->m[$key->getName()] = new Tag($key, $value); }
[ "final", "public", "function", "upsert", "(", "TagKey", "$", "key", ",", "TagValue", "$", "value", ")", "{", "$", "this", "->", "m", "[", "$", "key", "->", "getName", "(", ")", "]", "=", "new", "Tag", "(", "$", "key", ",", "$", "value", ")", ";...
Insert or Update a Tag into TagContext given provided TagKey with provided string value. @param TagKey $key key of the Tag. @param TagValue $value value of the Tag.
[ "Insert", "or", "Update", "a", "Tag", "into", "TagContext", "given", "provided", "TagKey", "with", "provided", "string", "value", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Tags/TagContext.php#L109-L112
census-instrumentation/opencensus-php
src/Tags/TagContext.php
TagContext.delete
final public function delete(TagKey $key): bool { if (!\array_key_exists($key->getName(), $this->m)) { return false; } unset($this->m[$key->getName()]); return true; }
php
final public function delete(TagKey $key): bool { if (!\array_key_exists($key->getName(), $this->m)) { return false; } unset($this->m[$key->getName()]); return true; }
[ "final", "public", "function", "delete", "(", "TagKey", "$", "key", ")", ":", "bool", "{", "if", "(", "!", "\\", "array_key_exists", "(", "$", "key", "->", "getName", "(", ")", ",", "$", "this", "->", "m", ")", ")", "{", "return", "false", ";", "...
Deletes Tag from TagContext identified by its TagKey. @param TagKey $key @return bool returns true if Tag was found and deleted.
[ "Deletes", "Tag", "from", "TagContext", "identified", "by", "its", "TagKey", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Tags/TagContext.php#L120-L127
census-instrumentation/opencensus-php
src/Tags/TagContext.php
TagContext.fromContext
final public static function fromContext(Context $ctx = null): TagContext { if ($ctx === null) { $ctx = Context::current(); } return $ctx->value(self::CTX_KEY, new self()); }
php
final public static function fromContext(Context $ctx = null): TagContext { if ($ctx === null) { $ctx = Context::current(); } return $ctx->value(self::CTX_KEY, new self()); }
[ "final", "public", "static", "function", "fromContext", "(", "Context", "$", "ctx", "=", "null", ")", ":", "TagContext", "{", "if", "(", "$", "ctx", "===", "null", ")", "{", "$", "ctx", "=", "Context", "::", "current", "(", ")", ";", "}", "return", ...
Extract a TagContext from the provided Context object. If Context is not provided, the current Context is used. If no TagContext is found, a new empty TagContext is returned. @param Context $ctx The Context to extract the TagContext from. @return TagContext
[ "Extract", "a", "TagContext", "from", "the", "provided", "Context", "object", ".", "If", "Context", "is", "not", "provided", "the", "current", "Context", "is", "used", ".", "If", "no", "TagContext", "is", "found", "a", "new", "empty", "TagContext", "is", "...
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Tags/TagContext.php#L173-L179
census-instrumentation/opencensus-php
src/Tags/TagContext.php
TagContext.newContext
final public function newContext(Context $ctx = null): Context { if ($ctx === null) { $ctx = Context::current(); } return $ctx->withValue(self::CTX_KEY, $this); }
php
final public function newContext(Context $ctx = null): Context { if ($ctx === null) { $ctx = Context::current(); } return $ctx->withValue(self::CTX_KEY, $this); }
[ "final", "public", "function", "newContext", "(", "Context", "$", "ctx", "=", "null", ")", ":", "Context", "{", "if", "(", "$", "ctx", "===", "null", ")", "{", "$", "ctx", "=", "Context", "::", "current", "(", ")", ";", "}", "return", "$", "ctx", ...
Creates a new Context with our TagContext attached. To propagate a TagContext to downstream methods and downstream RPCs, add a TagContext to the current Context. If there is already a TagContext in the current context, it will be replaced with this TagContext. @param Context $ctx The source context to copy. @return Co...
[ "Creates", "a", "new", "Context", "with", "our", "TagContext", "attached", ".", "To", "propagate", "a", "TagContext", "to", "downstream", "methods", "and", "downstream", "RPCs", "add", "a", "TagContext", "to", "the", "current", "Context", ".", "If", "there", ...
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Tags/TagContext.php#L202-L208
census-instrumentation/opencensus-php
src/Trace/Exporter/OneLineEchoExporter.php
OneLineEchoExporter.export
public function export(array $spans) { foreach ($spans as $span) { $time = (float) ($span->endTime()->format('U.u')) - (float) ($span->startTime()->format('U.u')); printf("[ %8.2f ms] %s%s", $time * 1000, $span->name(), PHP_EOL); foreach ($span->attributes() as $key => $v...
php
public function export(array $spans) { foreach ($spans as $span) { $time = (float) ($span->endTime()->format('U.u')) - (float) ($span->startTime()->format('U.u')); printf("[ %8.2f ms] %s%s", $time * 1000, $span->name(), PHP_EOL); foreach ($span->attributes() as $key => $v...
[ "public", "function", "export", "(", "array", "$", "spans", ")", "{", "foreach", "(", "$", "spans", "as", "$", "span", ")", "{", "$", "time", "=", "(", "float", ")", "(", "$", "span", "->", "endTime", "(", ")", "->", "format", "(", "'U.u'", ")", ...
Report the provided Trace to a backend. @param SpanData[] $spans @return bool
[ "Report", "the", "provided", "Trace", "to", "a", "backend", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Exporter/OneLineEchoExporter.php#L31-L41
census-instrumentation/opencensus-php
src/Trace/Exporter/LoggerExporter.php
LoggerExporter.export
public function export(array $spans) { try { $this->logger->log($this->level, json_encode($spans)); } catch (\Exception $e) { error_log('Reporting the Trace data failed: ' . $e->getMessage()); return false; } return true; }
php
public function export(array $spans) { try { $this->logger->log($this->level, json_encode($spans)); } catch (\Exception $e) { error_log('Reporting the Trace data failed: ' . $e->getMessage()); return false; } return true; }
[ "public", "function", "export", "(", "array", "$", "spans", ")", "{", "try", "{", "$", "this", "->", "logger", "->", "log", "(", "$", "this", "->", "level", ",", "json_encode", "(", "$", "spans", ")", ")", ";", "}", "catch", "(", "\\", "Exception",...
Report the provided Trace to a backend. @param SpanData[] $spans @return bool
[ "Report", "the", "provided", "Trace", "to", "a", "backend", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Exporter/LoggerExporter.php#L71-L80
census-instrumentation/opencensus-php
src/Trace/Exporter/FileExporter.php
FileExporter.export
public function export(array $spans) { $spans = $this->convertSpans($spans); return file_put_contents($this->filename, json_encode($spans) . PHP_EOL, FILE_APPEND) !== false; }
php
public function export(array $spans) { $spans = $this->convertSpans($spans); return file_put_contents($this->filename, json_encode($spans) . PHP_EOL, FILE_APPEND) !== false; }
[ "public", "function", "export", "(", "array", "$", "spans", ")", "{", "$", "spans", "=", "$", "this", "->", "convertSpans", "(", "$", "spans", ")", ";", "return", "file_put_contents", "(", "$", "this", "->", "filename", ",", "json_encode", "(", "$", "s...
Report the provided SpanData to a file in json format. @param SpanData[] $spans @return bool
[ "Report", "the", "provided", "SpanData", "to", "a", "file", "in", "json", "format", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Exporter/FileExporter.php#L59-L63
census-instrumentation/opencensus-php
src/Trace/Exporter/FileExporter.php
FileExporter.convertSpans
private function convertSpans(array $spans) { return array_map(function (SpanData $span) { return [ 'traceId' => $span->traceId(), 'name' => $span->name(), 'spanId' => $span->spanId(), 'parentSpanId' => $span->parentSpanId(), ...
php
private function convertSpans(array $spans) { return array_map(function (SpanData $span) { return [ 'traceId' => $span->traceId(), 'name' => $span->name(), 'spanId' => $span->spanId(), 'parentSpanId' => $span->parentSpanId(), ...
[ "private", "function", "convertSpans", "(", "array", "$", "spans", ")", "{", "return", "array_map", "(", "function", "(", "SpanData", "$", "span", ")", "{", "return", "[", "'traceId'", "=>", "$", "span", "->", "traceId", "(", ")", ",", "'name'", "=>", ...
Convert spans into array ready for serialization. @param SpanData[] $spans @return array Representation of the collected trace spans ready for serialization
[ "Convert", "spans", "into", "array", "ready", "for", "serialization", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Exporter/FileExporter.php#L71-L89
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.inSpan
public function inSpan(array $spanOptions, callable $callable, array $arguments = []) { $span = $this->startSpan($spanOptions + [ 'sameProcessAsParentSpan' => $this->hasSpans ]); $scope = $this->withSpan($span); try { return call_user_func_array($callable, $ar...
php
public function inSpan(array $spanOptions, callable $callable, array $arguments = []) { $span = $this->startSpan($spanOptions + [ 'sameProcessAsParentSpan' => $this->hasSpans ]); $scope = $this->withSpan($span); try { return call_user_func_array($callable, $ar...
[ "public", "function", "inSpan", "(", "array", "$", "spanOptions", ",", "callable", "$", "callable", ",", "array", "$", "arguments", "=", "[", "]", ")", "{", "$", "span", "=", "$", "this", "->", "startSpan", "(", "$", "spanOptions", "+", "[", "'sameProc...
Instrument a callable by creating a Span @param array $spanOptions Options for the span. See <a href="../Span.html#method___construct">OpenCensus\Trace\Span::__construct()</a> @param callable $callable The callable to instrument. @param array $arguments [optional] Arguments for the callable. @return mixed The result o...
[ "Instrument", "a", "callable", "by", "creating", "a", "Span" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L67-L78
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.startSpan
public function startSpan(array $spanOptions) { if (!array_key_exists('name', $spanOptions)) { $spanOptions['name'] = $this->generateSpanName(); } $spanOptions['eventHandler'] = $this; return new Span($spanOptions); }
php
public function startSpan(array $spanOptions) { if (!array_key_exists('name', $spanOptions)) { $spanOptions['name'] = $this->generateSpanName(); } $spanOptions['eventHandler'] = $this; return new Span($spanOptions); }
[ "public", "function", "startSpan", "(", "array", "$", "spanOptions", ")", "{", "if", "(", "!", "array_key_exists", "(", "'name'", ",", "$", "spanOptions", ")", ")", "{", "$", "spanOptions", "[", "'name'", "]", "=", "$", "this", "->", "generateSpanName", ...
Start a new Span. The start time is already set to the current time. @param array $spanOptions [optional] Options for the span. See <a href="../Span.html#method___construct">OpenCensus\Trace\Span::__construct()</a>
[ "Start", "a", "new", "Span", ".", "The", "start", "time", "is", "already", "set", "to", "the", "current", "time", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L86-L93
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.withSpan
public function withSpan(Span $span) { $spanData = $span->spanData(); $startTime = $spanData->startTime() ? (float)($spanData->startTime()->format('U.u')) : microtime(true); $info = [ 'traceId' => $spanData->traceId(), 'spanId' => $spanData->sp...
php
public function withSpan(Span $span) { $spanData = $span->spanData(); $startTime = $spanData->startTime() ? (float)($spanData->startTime()->format('U.u')) : microtime(true); $info = [ 'traceId' => $spanData->traceId(), 'spanId' => $spanData->sp...
[ "public", "function", "withSpan", "(", "Span", "$", "span", ")", "{", "$", "spanData", "=", "$", "span", "->", "spanData", "(", ")", ";", "$", "startTime", "=", "$", "spanData", "->", "startTime", "(", ")", "?", "(", "float", ")", "(", "$", "spanDa...
Attaches the provided span as the current span and returns a Scope object which must be closed. @param Span $span @return Scope
[ "Attaches", "the", "provided", "span", "as", "the", "current", "span", "and", "returns", "a", "Scope", "object", "which", "must", "be", "closed", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L102-L130
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.spans
public function spans() { // each span returned from opencensus_trace_list should be a // OpenCensus\Span object $traceId = $this->spanContext()->traceId(); return array_map(function ($span) use ($traceId) { return $this->mapSpan($span, $traceId); }, opencensus_tr...
php
public function spans() { // each span returned from opencensus_trace_list should be a // OpenCensus\Span object $traceId = $this->spanContext()->traceId(); return array_map(function ($span) use ($traceId) { return $this->mapSpan($span, $traceId); }, opencensus_tr...
[ "public", "function", "spans", "(", ")", "{", "// each span returned from opencensus_trace_list should be a", "// OpenCensus\\Span object", "$", "traceId", "=", "$", "this", "->", "spanContext", "(", ")", "->", "traceId", "(", ")", ";", "return", "array_map", "(", "...
Return the spans collected. @return Span[]
[ "Return", "the", "spans", "collected", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L137-L145
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.addAttribute
public function addAttribute($attribute, $value, $options = []) { if (array_key_exists('span', $options)) { $options['spanId'] = $options['span']->spanId(); } opencensus_trace_add_attribute($attribute, $value, $options); }
php
public function addAttribute($attribute, $value, $options = []) { if (array_key_exists('span', $options)) { $options['spanId'] = $options['span']->spanId(); } opencensus_trace_add_attribute($attribute, $value, $options); }
[ "public", "function", "addAttribute", "(", "$", "attribute", ",", "$", "value", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "array_key_exists", "(", "'span'", ",", "$", "options", ")", ")", "{", "$", "options", "[", "'spanId'", "]", "=",...
Add an attribute to the provided Span @param string $attribute @param string $value @param array $options [optional] Configuration options. @type Span $span The span to add the attribute to.
[ "Add", "an", "attribute", "to", "the", "provided", "Span" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L156-L162
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.addAnnotation
public function addAnnotation($description, $options = []) { if (array_key_exists('span', $options)) { $options['spanId'] = $options['span']->spanId(); } opencensus_trace_add_annotation($description, $options); }
php
public function addAnnotation($description, $options = []) { if (array_key_exists('span', $options)) { $options['spanId'] = $options['span']->spanId(); } opencensus_trace_add_annotation($description, $options); }
[ "public", "function", "addAnnotation", "(", "$", "description", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "array_key_exists", "(", "'span'", ",", "$", "options", ")", ")", "{", "$", "options", "[", "'spanId'", "]", "=", "$", "options", ...
Add an annotation to the provided Span @param string $description @param array $options [optional] Configuration options. @type Span $span The span to add the annotation to. @type array $attributes Attributes for this annotation. @type \DateTimeInterface|int|float $time The time of this event.
[ "Add", "an", "annotation", "to", "the", "provided", "Span" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L174-L180
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.addLink
public function addLink($traceId, $spanId, $options = []) { if (array_key_exists('span', $options)) { $options['spanId'] = $options['span']->spanId(); } opencensus_trace_add_link($traceId, $spanId, $options); }
php
public function addLink($traceId, $spanId, $options = []) { if (array_key_exists('span', $options)) { $options['spanId'] = $options['span']->spanId(); } opencensus_trace_add_link($traceId, $spanId, $options); }
[ "public", "function", "addLink", "(", "$", "traceId", ",", "$", "spanId", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "array_key_exists", "(", "'span'", ",", "$", "options", ")", ")", "{", "$", "options", "[", "'spanId'", "]", "=", "$"...
Add a link to the provided Span @param string $traceId @param string $spanId @param array $options [optional] Configuration options. @type Span $span The span to add the link to. @type string $type The relationship of the current span relative to the linked span: child, parent, or unspecified. @type array $attributes...
[ "Add", "a", "link", "to", "the", "provided", "Span" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L195-L201
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.addMessageEvent
public function addMessageEvent($type, $id, $options = []) { if (array_key_exists('span', $options)) { $options['spanId'] = $options['span']->spanId(); } opencensus_trace_add_message_event($type, $id, $options); }
php
public function addMessageEvent($type, $id, $options = []) { if (array_key_exists('span', $options)) { $options['spanId'] = $options['span']->spanId(); } opencensus_trace_add_message_event($type, $id, $options); }
[ "public", "function", "addMessageEvent", "(", "$", "type", ",", "$", "id", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "array_key_exists", "(", "'span'", ",", "$", "options", ")", ")", "{", "$", "options", "[", "'spanId'", "]", "=", "$...
Add an message event to the provided Span @param string $type @param string $id @param array $options [optional] Configuration options. @type Span $span The span to add the message event to. @type int $uncompressedSize The number of uncompressed bytes sent or received. @type int $compressedSize The number of compress...
[ "Add", "an", "message", "event", "to", "the", "provided", "Span" ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L218-L224
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.attributeAdded
public function attributeAdded(Span $span, $attribute, $value) { // If the span is already attached (managed by the extension), then // tell the extension to add the attribute. if ($span->attached()) { $this->addAttribute($attribute, $value, [ 'span' => $span ...
php
public function attributeAdded(Span $span, $attribute, $value) { // If the span is already attached (managed by the extension), then // tell the extension to add the attribute. if ($span->attached()) { $this->addAttribute($attribute, $value, [ 'span' => $span ...
[ "public", "function", "attributeAdded", "(", "Span", "$", "span", ",", "$", "attribute", ",", "$", "value", ")", "{", "// If the span is already attached (managed by the extension), then", "// tell the extension to add the attribute.", "if", "(", "$", "span", "->", "attac...
Triggers when an attribute is added to a span. @param Span $span The span the attribute was added to @param string $attribute The name of the attribute added @param string $value The attribute value
[ "Triggers", "when", "an", "attribute", "is", "added", "to", "a", "span", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L258-L267
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.linkAdded
public function linkAdded(Span $span, Link $link) { // If the span is already attached (managed by the extension), then // tell the extension to add the link. if ($span->attached()) { $this->addLink($link->traceId(), $link->spanId(), [ 'type' => $link->type(), ...
php
public function linkAdded(Span $span, Link $link) { // If the span is already attached (managed by the extension), then // tell the extension to add the link. if ($span->attached()) { $this->addLink($link->traceId(), $link->spanId(), [ 'type' => $link->type(), ...
[ "public", "function", "linkAdded", "(", "Span", "$", "span", ",", "Link", "$", "link", ")", "{", "// If the span is already attached (managed by the extension), then", "// tell the extension to add the link.", "if", "(", "$", "span", "->", "attached", "(", ")", ")", "...
Triggers when a link is added to a span. @param Span $span The span the link was added to @param Link $link The link added to the span
[ "Triggers", "when", "a", "link", "is", "added", "to", "a", "span", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L275-L286
census-instrumentation/opencensus-php
src/Trace/Tracer/ExtensionTracer.php
ExtensionTracer.timeEventAdded
public function timeEventAdded(Span $span, TimeEvent $timeEvent) { if ($span->attached()) { if ($timeEvent instanceof Annotation) { $this->addAnnotation($timeEvent->description(), [ 'time' => $timeEvent->time(), 'attributes' => $timeEvent->...
php
public function timeEventAdded(Span $span, TimeEvent $timeEvent) { if ($span->attached()) { if ($timeEvent instanceof Annotation) { $this->addAnnotation($timeEvent->description(), [ 'time' => $timeEvent->time(), 'attributes' => $timeEvent->...
[ "public", "function", "timeEventAdded", "(", "Span", "$", "span", ",", "TimeEvent", "$", "timeEvent", ")", "{", "if", "(", "$", "span", "->", "attached", "(", ")", ")", "{", "if", "(", "$", "timeEvent", "instanceof", "Annotation", ")", "{", "$", "this"...
Triggers when a time event is added to a span. @param Span $span The span the time event was added to @param TimeEvent $timeEvent The time event added to the span
[ "Triggers", "when", "a", "time", "event", "is", "added", "to", "a", "span", "." ]
train
https://github.com/census-instrumentation/opencensus-php/blob/1327147dc2ea99c06df01db4daa8c4ab2656514d/src/Trace/Tracer/ExtensionTracer.php#L294-L312
hautelook/AliceBundle
src/DependencyInjection/HautelookAliceExtension.php
HautelookAliceExtension.load
public function load(array $configs, ContainerBuilder $container) { $missingBundles = [DoctrineBundle::class => true, FidryAliceDataFixturesBundle::class => true]; foreach ($container->getParameter('kernel.bundles') as $bundle) { unset($missingBundles[$bundle]); if (!$missing...
php
public function load(array $configs, ContainerBuilder $container) { $missingBundles = [DoctrineBundle::class => true, FidryAliceDataFixturesBundle::class => true]; foreach ($container->getParameter('kernel.bundles') as $bundle) { unset($missingBundles[$bundle]); if (!$missing...
[ "public", "function", "load", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "missingBundles", "=", "[", "DoctrineBundle", "::", "class", "=>", "true", ",", "FidryAliceDataFixturesBundle", "::", "class", "=>", "true", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/DependencyInjection/HautelookAliceExtension.php#L38-L58
hautelook/AliceBundle
fixtures/DataFixtures/Loader/FakeLoader.php
FakeLoader.load
public function load(array $fixturesFiles, array $parameters = [], array $objects = [], PurgeMode $purgeMode = null): array { $this->__call(__METHOD__, \func_get_args()); }
php
public function load(array $fixturesFiles, array $parameters = [], array $objects = [], PurgeMode $purgeMode = null): array { $this->__call(__METHOD__, \func_get_args()); }
[ "public", "function", "load", "(", "array", "$", "fixturesFiles", ",", "array", "$", "parameters", "=", "[", "]", ",", "array", "$", "objects", "=", "[", "]", ",", "PurgeMode", "$", "purgeMode", "=", "null", ")", ":", "array", "{", "$", "this", "->",...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/fixtures/DataFixtures/Loader/FakeLoader.php#L28-L31
hautelook/AliceBundle
src/Resolver/Bundle/NoBundleResolver.php
NoBundleResolver.resolveBundles
public function resolveBundles(Application $application, array $names) { if ([] === $names) { return array_values($application->getKernel()->getBundles()); } return $this->decoratedResolver->resolveBundles($application, $names); }
php
public function resolveBundles(Application $application, array $names) { if ([] === $names) { return array_values($application->getKernel()->getBundles()); } return $this->decoratedResolver->resolveBundles($application, $names); }
[ "public", "function", "resolveBundles", "(", "Application", "$", "application", ",", "array", "$", "names", ")", "{", "if", "(", "[", "]", "===", "$", "names", ")", "{", "return", "array_values", "(", "$", "application", "->", "getKernel", "(", ")", "->"...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Resolver/Bundle/NoBundleResolver.php#L35-L42
hautelook/AliceBundle
src/DependencyInjection/Configuration.php
Configuration.getConfigTreeBuilder
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('hautelook_alice'); if (method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->getRootNode(); } else { // BC for symfony/config < 4.2 $rootNode = $treeBuilder->root('...
php
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('hautelook_alice'); if (method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->getRootNode(); } else { // BC for symfony/config < 4.2 $rootNode = $treeBuilder->root('...
[ "public", "function", "getConfigTreeBuilder", "(", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", "'hautelook_alice'", ")", ";", "if", "(", "method_exists", "(", "$", "treeBuilder", ",", "'getRootNode'", ")", ")", "{", "$", "rootNode", "=", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/DependencyInjection/Configuration.php#L28-L59
hautelook/AliceBundle
src/Alice/FileLocator/KernelFileLocator.php
KernelFileLocator.locate
public function locate(string $name, string $currentPath = null): string { if ('@' === $name[0]) { return $this->kernel->locateResource($name); } return $this->fileLocator->locate($name, $currentPath); }
php
public function locate(string $name, string $currentPath = null): string { if ('@' === $name[0]) { return $this->kernel->locateResource($name); } return $this->fileLocator->locate($name, $currentPath); }
[ "public", "function", "locate", "(", "string", "$", "name", ",", "string", "$", "currentPath", "=", "null", ")", ":", "string", "{", "if", "(", "'@'", "===", "$", "name", "[", "0", "]", ")", "{", "return", "$", "this", "->", "kernel", "->", "locate...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Alice/FileLocator/KernelFileLocator.php#L36-L43
hautelook/AliceBundle
fixtures/Loader/FakeLoader.php
FakeLoader.load
public function load( Application $application, EntityManagerInterface $manager, array $bundles, string $environment, bool $append, bool $purgeWithTruncate, string $shard = null ) { $this->__call(__METHOD__, \func_get_args()); }
php
public function load( Application $application, EntityManagerInterface $manager, array $bundles, string $environment, bool $append, bool $purgeWithTruncate, string $shard = null ) { $this->__call(__METHOD__, \func_get_args()); }
[ "public", "function", "load", "(", "Application", "$", "application", ",", "EntityManagerInterface", "$", "manager", ",", "array", "$", "bundles", ",", "string", "$", "environment", ",", "bool", "$", "append", ",", "bool", "$", "purgeWithTruncate", ",", "strin...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/fixtures/Loader/FakeLoader.php#L29-L39
hautelook/AliceBundle
fixtures/Functional/AppKernel.php
AppKernel.build
public function build(ContainerBuilder $container) { parent::build($container); if ('public' !== $this->getEnvironment()) { return; } $container->addCompilerPass(new class() implements CompilerPassInterface { public function process(ContainerBuilder $contain...
php
public function build(ContainerBuilder $container) { parent::build($container); if ('public' !== $this->getEnvironment()) { return; } $container->addCompilerPass(new class() implements CompilerPassInterface { public function process(ContainerBuilder $contain...
[ "public", "function", "build", "(", "ContainerBuilder", "$", "container", ")", "{", "parent", "::", "build", "(", "$", "container", ")", ";", "if", "(", "'public'", "!==", "$", "this", "->", "getEnvironment", "(", ")", ")", "{", "return", ";", "}", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/fixtures/Functional/AppKernel.php#L53-L72
hautelook/AliceBundle
src/Resolver/File/KernelFileResolver.php
KernelFileResolver.resolve
public function resolve(array $filePaths): array { $resolvedFixtures = []; foreach ($filePaths as $file) { $resolvedFixtures[$this->resolveFile($file)] = true; } return array_keys($resolvedFixtures); }
php
public function resolve(array $filePaths): array { $resolvedFixtures = []; foreach ($filePaths as $file) { $resolvedFixtures[$this->resolveFile($file)] = true; } return array_keys($resolvedFixtures); }
[ "public", "function", "resolve", "(", "array", "$", "filePaths", ")", ":", "array", "{", "$", "resolvedFixtures", "=", "[", "]", ";", "foreach", "(", "$", "filePaths", "as", "$", "file", ")", "{", "$", "resolvedFixtures", "[", "$", "this", "->", "resol...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Resolver/File/KernelFileResolver.php#L35-L43
hautelook/AliceBundle
src/Locator/EnvironmentlessFilesLocator.php
EnvironmentlessFilesLocator.locateFiles
public function locateFiles(array $bundles, string $environment): array { $fixtureFiles = array_flip($this->fixtureLocator->locateFiles($bundles, $environment)); $fixtureFiles = $fixtureFiles + array_flip($this->fixtureLocator->locateFiles($bundles, '')); return array_keys($fixtureFiles); ...
php
public function locateFiles(array $bundles, string $environment): array { $fixtureFiles = array_flip($this->fixtureLocator->locateFiles($bundles, $environment)); $fixtureFiles = $fixtureFiles + array_flip($this->fixtureLocator->locateFiles($bundles, '')); return array_keys($fixtureFiles); ...
[ "public", "function", "locateFiles", "(", "array", "$", "bundles", ",", "string", "$", "environment", ")", ":", "array", "{", "$", "fixtureFiles", "=", "array_flip", "(", "$", "this", "->", "fixtureLocator", "->", "locateFiles", "(", "$", "bundles", ",", "...
Locate fixture files found matching the environment name. For example, if the given fixture path is 'Resources/fixtures', it will try to locate the files in the 'Resources/fixtures/*.dev.yml' for each bundle passed ('dev' being the environment). {@inheritdoc}
[ "Locate", "fixture", "files", "found", "matching", "the", "environment", "name", "." ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Locator/EnvironmentlessFilesLocator.php#L37-L43
hautelook/AliceBundle
src/Exception/Resolver/BundleNotFoundException.php
BundleNotFoundException.create
public static function create(string $bundle, array $bundles, int $code = 0, Throwable $previous = null) { return new static( sprintf( 'The bundle "%s" was not found. Bundles available are: ["%s"].', $bundle, implode('", "', array_keys($bundles)) ...
php
public static function create(string $bundle, array $bundles, int $code = 0, Throwable $previous = null) { return new static( sprintf( 'The bundle "%s" was not found. Bundles available are: ["%s"].', $bundle, implode('", "', array_keys($bundles)) ...
[ "public", "static", "function", "create", "(", "string", "$", "bundle", ",", "array", "$", "bundles", ",", "int", "$", "code", "=", "0", ",", "Throwable", "$", "previous", "=", "null", ")", "{", "return", "new", "static", "(", "sprintf", "(", "'The bun...
@param BundleInterface[] $bundles @return static
[ "@param", "BundleInterface", "[]", "$bundles" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Exception/Resolver/BundleNotFoundException.php#L24-L35
hautelook/AliceBundle
src/Alice/Generator/Instantiator/Chainable/InstantiatedReferenceInstantiator.php
InstantiatedReferenceInstantiator.canInstantiate
public function canInstantiate(FixtureInterface $fixture): bool { $constructor = $fixture->getSpecs()->getConstructor(); return null !== $constructor && $constructor instanceof MethodCallWithReference && $constructor->getCaller() instanceof InstantiatedReference ...
php
public function canInstantiate(FixtureInterface $fixture): bool { $constructor = $fixture->getSpecs()->getConstructor(); return null !== $constructor && $constructor instanceof MethodCallWithReference && $constructor->getCaller() instanceof InstantiatedReference ...
[ "public", "function", "canInstantiate", "(", "FixtureInterface", "$", "fixture", ")", ":", "bool", "{", "$", "constructor", "=", "$", "fixture", "->", "getSpecs", "(", ")", "->", "getConstructor", "(", ")", ";", "return", "null", "!==", "$", "constructor", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Alice/Generator/Instantiator/Chainable/InstantiatedReferenceInstantiator.php#L45-L54
hautelook/AliceBundle
src/Alice/Generator/Instantiator/Chainable/InstantiatedReferenceInstantiator.php
InstantiatedReferenceInstantiator.instantiate
public function instantiate( FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, GenerationContext $context ): ResolvedFixtureSet { $this->checkContainer(__METHOD__); $instance = $this->createInstance($fixture); return $this->generateSet($fixture, $fixtureSet,...
php
public function instantiate( FixtureInterface $fixture, ResolvedFixtureSet $fixtureSet, GenerationContext $context ): ResolvedFixtureSet { $this->checkContainer(__METHOD__); $instance = $this->createInstance($fixture); return $this->generateSet($fixture, $fixtureSet,...
[ "public", "function", "instantiate", "(", "FixtureInterface", "$", "fixture", ",", "ResolvedFixtureSet", "$", "fixtureSet", ",", "GenerationContext", "$", "context", ")", ":", "ResolvedFixtureSet", "{", "$", "this", "->", "checkContainer", "(", "__METHOD__", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Alice/Generator/Instantiator/Chainable/InstantiatedReferenceInstantiator.php#L59-L68
hautelook/AliceBundle
fixtures/HttpKernel/DummyKernel.php
DummyKernel.handle
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) { $this->__call(__METHOD__, \func_get_args()); }
php
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) { $this->__call(__METHOD__, \func_get_args()); }
[ "public", "function", "handle", "(", "Request", "$", "request", ",", "$", "type", "=", "self", "::", "MASTER_REQUEST", ",", "$", "catch", "=", "true", ")", "{", "$", "this", "->", "__call", "(", "__METHOD__", ",", "\\", "func_get_args", "(", ")", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/fixtures/HttpKernel/DummyKernel.php#L45-L48
hautelook/AliceBundle
fixtures/HttpKernel/DummyKernel.php
DummyKernel.registerContainerConfiguration
public function registerContainerConfiguration(\Symfony\Component\Config\Loader\LoaderInterface $loader) { $this->__call(__METHOD__, \func_get_args()); }
php
public function registerContainerConfiguration(\Symfony\Component\Config\Loader\LoaderInterface $loader) { $this->__call(__METHOD__, \func_get_args()); }
[ "public", "function", "registerContainerConfiguration", "(", "\\", "Symfony", "\\", "Component", "\\", "Config", "\\", "Loader", "\\", "LoaderInterface", "$", "loader", ")", "{", "$", "this", "->", "__call", "(", "__METHOD__", ",", "\\", "func_get_args", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/fixtures/HttpKernel/DummyKernel.php#L61-L64
hautelook/AliceBundle
fixtures/HttpKernel/DummyKernel.php
DummyKernel.locateResource
public function locateResource($name, $dir = null, $first = true) { $this->__call(__METHOD__, \func_get_args()); }
php
public function locateResource($name, $dir = null, $first = true) { $this->__call(__METHOD__, \func_get_args()); }
[ "public", "function", "locateResource", "(", "$", "name", ",", "$", "dir", "=", "null", ",", "$", "first", "=", "true", ")", "{", "$", "this", "->", "__call", "(", "__METHOD__", ",", "\\", "func_get_args", "(", ")", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/fixtures/HttpKernel/DummyKernel.php#L101-L104
hautelook/AliceBundle
src/Locator/EnvDirectoryLocator.php
EnvDirectoryLocator.locateFiles
public function locateFiles(array $bundles, string $environment): array { $fixtureFiles = array_merge( ...array_map( function (string $rootDir) use ($environment): array { return $this->doLocateFiles($rootDir, $environment); }, ...
php
public function locateFiles(array $bundles, string $environment): array { $fixtureFiles = array_merge( ...array_map( function (string $rootDir) use ($environment): array { return $this->doLocateFiles($rootDir, $environment); }, ...
[ "public", "function", "locateFiles", "(", "array", "$", "bundles", ",", "string", "$", "environment", ")", ":", "array", "{", "$", "fixtureFiles", "=", "array_merge", "(", "...", "array_map", "(", "function", "(", "string", "$", "rootDir", ")", "use", "(",...
Locates fixture files found inside a folder matching the environment name. For example, if the given fixture path is 'Resources/fixtures', it will try to locate the files in the 'Resources/fixtures/dev' for each bundle passed ('dev' being the environment). {@inheritdoc}
[ "Locates", "fixture", "files", "found", "inside", "a", "folder", "matching", "the", "environment", "name", "." ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Locator/EnvDirectoryLocator.php#L45-L63
hautelook/AliceBundle
src/Locator/EnvDirectoryLocator.php
EnvDirectoryLocator.doLocateFiles
private function doLocateFiles(string $path, string $environment): array { $fullPaths = array_filter(array_map(static function (string $fixturePath) use ($environment, $path): string { return '' !== $environment ? sprintf('%s/%s/%s', $path, $fixturePath, $environment) ...
php
private function doLocateFiles(string $path, string $environment): array { $fullPaths = array_filter(array_map(static function (string $fixturePath) use ($environment, $path): string { return '' !== $environment ? sprintf('%s/%s/%s', $path, $fixturePath, $environment) ...
[ "private", "function", "doLocateFiles", "(", "string", "$", "path", ",", "string", "$", "environment", ")", ":", "array", "{", "$", "fullPaths", "=", "array_filter", "(", "array_map", "(", "static", "function", "(", "string", "$", "fixturePath", ")", "use", ...
Gets the list of files that can be found in the given path. @return string[]
[ "Gets", "the", "list", "of", "files", "that", "can", "be", "found", "in", "the", "given", "path", "." ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Locator/EnvDirectoryLocator.php#L71-L100
hautelook/AliceBundle
src/Console/Command/Doctrine/DoctrineOrmLoadDataFixturesCommand.php
DoctrineOrmLoadDataFixturesCommand.setApplication
public function setApplication(ConsoleApplication $application = null) { if (null !== $application && false === $application instanceof FrameworkBundleConsoleApplication) { throw new \InvalidArgumentException( sprintf( 'Expected application to be an instance o...
php
public function setApplication(ConsoleApplication $application = null) { if (null !== $application && false === $application instanceof FrameworkBundleConsoleApplication) { throw new \InvalidArgumentException( sprintf( 'Expected application to be an instance o...
[ "public", "function", "setApplication", "(", "ConsoleApplication", "$", "application", "=", "null", ")", "{", "if", "(", "null", "!==", "$", "application", "&&", "false", "===", "$", "application", "instanceof", "FrameworkBundleConsoleApplication", ")", "{", "thro...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Console/Command/Doctrine/DoctrineOrmLoadDataFixturesCommand.php#L93-L105
hautelook/AliceBundle
src/Console/Command/Doctrine/DoctrineOrmLoadDataFixturesCommand.php
DoctrineOrmLoadDataFixturesCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { // Warn the user that the database will be purged // Ask him to confirm his choice if ($input->isInteractive() && !$input->getOption('append')) { if (false === $this->askConfirmation( ...
php
protected function execute(InputInterface $input, OutputInterface $output) { // Warn the user that the database will be purged // Ask him to confirm his choice if ($input->isInteractive() && !$input->getOption('append')) { if (false === $this->askConfirmation( ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "// Warn the user that the database will be purged", "// Ask him to confirm his choice", "if", "(", "$", "input", "->", "isInteractive", "(", ")", "...
{@inheritdoc} @throws RuntimeException Unsupported Application type
[ "{", "@inheritdoc", "}" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Console/Command/Doctrine/DoctrineOrmLoadDataFixturesCommand.php#L112-L140
hautelook/AliceBundle
src/Console/Command/Doctrine/DoctrineOrmLoadDataFixturesCommand.php
DoctrineOrmLoadDataFixturesCommand.askConfirmation
private function askConfirmation(InputInterface $input, OutputInterface $output, $question, $default) { /** @var QuestionHelper $questionHelper */ $questionHelper = $this->getHelperSet()->get('question'); $question = new ConfirmationQuestion($question, $default); return (bool) $ques...
php
private function askConfirmation(InputInterface $input, OutputInterface $output, $question, $default) { /** @var QuestionHelper $questionHelper */ $questionHelper = $this->getHelperSet()->get('question'); $question = new ConfirmationQuestion($question, $default); return (bool) $ques...
[ "private", "function", "askConfirmation", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "$", "question", ",", "$", "default", ")", "{", "/** @var QuestionHelper $questionHelper */", "$", "questionHelper", "=", "$", "this", "->", ...
Prompts to the user a message to ask him a confirmation. @param string $question @param bool $default @return bool User choice
[ "Prompts", "to", "the", "user", "a", "message", "to", "ask", "him", "a", "confirmation", "." ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Console/Command/Doctrine/DoctrineOrmLoadDataFixturesCommand.php#L150-L157
hautelook/AliceBundle
src/Resolver/Bundle/SimpleBundleResolver.php
SimpleBundleResolver.resolveBundles
public function resolveBundles(Application $application, array $names) { $bundles = $application->getKernel()->getBundles(); $result = []; foreach ($names as $name) { if (false === isset($bundles[$name])) { throw BundleNotFoundException::create($name, $bundles); ...
php
public function resolveBundles(Application $application, array $names) { $bundles = $application->getKernel()->getBundles(); $result = []; foreach ($names as $name) { if (false === isset($bundles[$name])) { throw BundleNotFoundException::create($name, $bundles); ...
[ "public", "function", "resolveBundles", "(", "Application", "$", "application", ",", "array", "$", "names", ")", "{", "$", "bundles", "=", "$", "application", "->", "getKernel", "(", ")", "->", "getBundles", "(", ")", ";", "$", "result", "=", "[", "]", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Resolver/Bundle/SimpleBundleResolver.php#L26-L40
hautelook/AliceBundle
src/Loader/DoctrineOrmLoader.php
DoctrineOrmLoader.withLogger
public function withLogger(LoggerInterface $logger): self { return new self( $this->bundleResolver, $this->fixtureLocator, $this->purgeLoader, $this->appendLoader, $logger ); }
php
public function withLogger(LoggerInterface $logger): self { return new self( $this->bundleResolver, $this->fixtureLocator, $this->purgeLoader, $this->appendLoader, $logger ); }
[ "public", "function", "withLogger", "(", "LoggerInterface", "$", "logger", ")", ":", "self", "{", "return", "new", "self", "(", "$", "this", "->", "bundleResolver", ",", "$", "this", "->", "fixtureLocator", ",", "$", "this", "->", "purgeLoader", ",", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Loader/DoctrineOrmLoader.php#L80-L89
hautelook/AliceBundle
src/Loader/DoctrineOrmLoader.php
DoctrineOrmLoader.load
public function load( Application $application, EntityManagerInterface $manager, array $bundles, string $environment, bool $append, bool $purgeWithTruncate, string $shard = null ) { if ($append && $purgeWithTruncate) { throw new LogicExcept...
php
public function load( Application $application, EntityManagerInterface $manager, array $bundles, string $environment, bool $append, bool $purgeWithTruncate, string $shard = null ) { if ($append && $purgeWithTruncate) { throw new LogicExcept...
[ "public", "function", "load", "(", "Application", "$", "application", ",", "EntityManagerInterface", "$", "manager", ",", "array", "$", "bundles", ",", "string", "$", "environment", ",", "bool", "$", "append", ",", "bool", "$", "purgeWithTruncate", ",", "strin...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Loader/DoctrineOrmLoader.php#L94-L131
hautelook/AliceBundle
src/Loader/DoctrineOrmLoader.php
DoctrineOrmLoader.loadFixtures
protected function loadFixtures( LoaderInterface $loader, EntityManagerInterface $manager, array $files, array $parameters, ?PurgeMode $purgeMode ) { $persister = $this->createPersister($manager); $loader = $loader->withPersister($persister); return ...
php
protected function loadFixtures( LoaderInterface $loader, EntityManagerInterface $manager, array $files, array $parameters, ?PurgeMode $purgeMode ) { $persister = $this->createPersister($manager); $loader = $loader->withPersister($persister); return ...
[ "protected", "function", "loadFixtures", "(", "LoaderInterface", "$", "loader", ",", "EntityManagerInterface", "$", "manager", ",", "array", "$", "files", ",", "array", "$", "parameters", ",", "?", "PurgeMode", "$", "purgeMode", ")", "{", "$", "persister", "="...
@param LoaderInterface|PersisterAwareInterface $loader @param string[] $files @return object[]
[ "@param", "LoaderInterface|PersisterAwareInterface", "$loader", "@param", "string", "[]", "$files" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/src/Loader/DoctrineOrmLoader.php#L144-L156
hautelook/AliceBundle
fixtures/Functional/SimpleKernel.php
SimpleKernel.locateResource
public function locateResource($name, $dir = null, $first = true) { if (null !== $this->overrideFirst) { $first = $this->overrideFirst; } return parent::locateResource($name, $dir, $first); }
php
public function locateResource($name, $dir = null, $first = true) { if (null !== $this->overrideFirst) { $first = $this->overrideFirst; } return parent::locateResource($name, $dir, $first); }
[ "public", "function", "locateResource", "(", "$", "name", ",", "$", "dir", "=", "null", ",", "$", "first", "=", "true", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "overrideFirst", ")", "{", "$", "first", "=", "$", "this", "->", "overrid...
{@inheritdoc}
[ "{" ]
train
https://github.com/hautelook/AliceBundle/blob/b9fa7985a522a7aed335976c168019cadb07396e/fixtures/Functional/SimpleKernel.php#L53-L60
wsdl2phpgenerator/wsdl2phpgenerator
src/Generator.php
Generator.generate
public function generate(ConfigInterface $config) { $this->config = $config; $this->log('Starting generation'); // Warn users who have disabled SOAP_SINGLE_ELEMENT_ARRAYS. // Note that this can be $options = $this->config->get('soapClientOptions'); if (empty($option...
php
public function generate(ConfigInterface $config) { $this->config = $config; $this->log('Starting generation'); // Warn users who have disabled SOAP_SINGLE_ELEMENT_ARRAYS. // Note that this can be $options = $this->config->get('soapClientOptions'); if (empty($option...
[ "public", "function", "generate", "(", "ConfigInterface", "$", "config", ")", "{", "$", "this", "->", "config", "=", "$", "config", ";", "$", "this", "->", "log", "(", "'Starting generation'", ")", ";", "// Warn users who have disabled SOAP_SINGLE_ELEMENT_ARRAYS.", ...
Generates php source code from a wsdl file @param ConfigInterface $config The config to use for generation
[ "Generates", "php", "source", "code", "from", "a", "wsdl", "file" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Generator.php#L66-L95
wsdl2phpgenerator/wsdl2phpgenerator
src/Generator.php
Generator.load
protected function load($wsdl) { $this->log('Loading the WSDL'); $this->wsdl = new WsdlDocument($this->config, $wsdl); $this->types = array(); $this->loadTypes(); $this->loadService(); }
php
protected function load($wsdl) { $this->log('Loading the WSDL'); $this->wsdl = new WsdlDocument($this->config, $wsdl); $this->types = array(); $this->loadTypes(); $this->loadService(); }
[ "protected", "function", "load", "(", "$", "wsdl", ")", "{", "$", "this", "->", "log", "(", "'Loading the WSDL'", ")", ";", "$", "this", "->", "wsdl", "=", "new", "WsdlDocument", "(", "$", "this", "->", "config", ",", "$", "wsdl", ")", ";", "$", "t...
Load the wsdl file into php
[ "Load", "the", "wsdl", "file", "into", "php" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Generator.php#L100-L110
wsdl2phpgenerator/wsdl2phpgenerator
src/Generator.php
Generator.loadService
protected function loadService() { $service = $this->wsdl->getService(); $this->log('Starting to load service ' . $service->getName()); $this->service = new Service($this->config, $service->getName(), $this->types, $service->getDocumentation()); foreach ($this->wsdl->getOperations(...
php
protected function loadService() { $service = $this->wsdl->getService(); $this->log('Starting to load service ' . $service->getName()); $this->service = new Service($this->config, $service->getName(), $this->types, $service->getDocumentation()); foreach ($this->wsdl->getOperations(...
[ "protected", "function", "loadService", "(", ")", "{", "$", "service", "=", "$", "this", "->", "wsdl", "->", "getService", "(", ")", ";", "$", "this", "->", "log", "(", "'Starting to load service '", ".", "$", "service", "->", "getName", "(", ")", ")", ...
Loads the service class
[ "Loads", "the", "service", "class" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Generator.php#L115-L129
wsdl2phpgenerator/wsdl2phpgenerator
src/Generator.php
Generator.loadTypes
protected function loadTypes() { $this->log('Loading types'); $types = $this->wsdl->getTypes(); foreach ($types as $typeNode) { $type = null; if ($typeNode->isComplex()) { if ($typeNode->isArray()) { $type = new ArrayType($this->...
php
protected function loadTypes() { $this->log('Loading types'); $types = $this->wsdl->getTypes(); foreach ($types as $typeNode) { $type = null; if ($typeNode->isComplex()) { if ($typeNode->isArray()) { $type = new ArrayType($this->...
[ "protected", "function", "loadTypes", "(", ")", "{", "$", "this", "->", "log", "(", "'Loading types'", ")", ";", "$", "types", "=", "$", "this", "->", "wsdl", "->", "getTypes", "(", ")", ";", "foreach", "(", "$", "types", "as", "$", "typeNode", ")", ...
Loads all type classes
[ "Loads", "all", "type", "classes" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Generator.php#L134-L197
wsdl2phpgenerator/wsdl2phpgenerator
src/Generator.php
Generator.savePhp
protected function savePhp() { $factory = new FilterFactory(); $filter = $factory->create($this->config); $filteredService = $filter->filter($this->service); $service = $filteredService->getClass(); $filteredTypes = $filteredService->getTypes(); if ($service == null) ...
php
protected function savePhp() { $factory = new FilterFactory(); $filter = $factory->create($this->config); $filteredService = $filter->filter($this->service); $service = $filteredService->getClass(); $filteredTypes = $filteredService->getTypes(); if ($service == null) ...
[ "protected", "function", "savePhp", "(", ")", "{", "$", "factory", "=", "new", "FilterFactory", "(", ")", ";", "$", "filter", "=", "$", "factory", "->", "create", "(", "$", "this", "->", "config", ")", ";", "$", "filteredService", "=", "$", "filter", ...
Save all the loaded classes to the configured output dir @throws Exception If no service is loaded
[ "Save", "all", "the", "loaded", "classes", "to", "the", "configured", "output", "dir" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Generator.php#L204-L227
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/XmlNode.php
XmlNode.setElement
public function setElement($document, $element = null) { if (empty($document)) { // Make sure we always have an element to query against which should not return any returns. $document = new DOMDocument(); $document->loadXML('<dummy/>'); } $this->document =...
php
public function setElement($document, $element = null) { if (empty($document)) { // Make sure we always have an element to query against which should not return any returns. $document = new DOMDocument(); $document->loadXML('<dummy/>'); } $this->document =...
[ "public", "function", "setElement", "(", "$", "document", ",", "$", "element", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "document", ")", ")", "{", "// Make sure we always have an element to query against which should not return any returns.", "$", "documen...
Sets the document and element for the node. @param DOMDocument $document @param DOMElement $element
[ "Sets", "the", "document", "and", "element", "for", "the", "node", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/XmlNode.php#L63-L76
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/XmlNode.php
XmlNode.xpath
protected function xpath($query, $args = null) { $xpath = new DOMXPath($this->document); // Preregister namespaces. $xpath->registerNamespace('wsdl', self::WSDL_NS); $xpath->registerNamespace('s', self::SCHEMA_NS); // Arguments containing ' and " needs escaping. // I...
php
protected function xpath($query, $args = null) { $xpath = new DOMXPath($this->document); // Preregister namespaces. $xpath->registerNamespace('wsdl', self::WSDL_NS); $xpath->registerNamespace('s', self::SCHEMA_NS); // Arguments containing ' and " needs escaping. // I...
[ "protected", "function", "xpath", "(", "$", "query", ",", "$", "args", "=", "null", ")", "{", "$", "xpath", "=", "new", "DOMXPath", "(", "$", "this", "->", "document", ")", ";", "// Preregister namespaces.", "$", "xpath", "->", "registerNamespace", "(", ...
Make an XPath query against the element with escaped variables if necessary. Two namespaces are preregistered with the following prefixes for ease of use: - http://schemas.xmlsoap.org/wsdl/: wsdl - http://www.w3.org/2001/XMLSchema: s @param string $query The XPath query. The query should contain placeholders for argu...
[ "Make", "an", "XPath", "query", "against", "the", "element", "with", "escaped", "variables", "if", "necessary", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/XmlNode.php#L89-L114
wsdl2phpgenerator/wsdl2phpgenerator
lib/PhpSource/PhpDocComment.php
PhpDocComment.getSource
public function getSource() { $description = ''; if (strlen($this->description) > 0) { $preDescription = trim($this->description); $lines = explode(PHP_EOL, $preDescription); foreach ($lines as $line) { $description .= ' ' . trim('* ' . $line) . PH...
php
public function getSource() { $description = ''; if (strlen($this->description) > 0) { $preDescription = trim($this->description); $lines = explode(PHP_EOL, $preDescription); foreach ($lines as $line) { $description .= ' ' . trim('* ' . $line) . PH...
[ "public", "function", "getSource", "(", ")", "{", "$", "description", "=", "''", ";", "if", "(", "strlen", "(", "$", "this", "->", "description", ")", ">", "0", ")", "{", "$", "preDescription", "=", "trim", "(", "$", "this", "->", "description", ")",...
Returns the generated source @return string The sourcecoude of the comment @access public
[ "Returns", "the", "generated", "source" ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/lib/PhpSource/PhpDocComment.php#L95-L143
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/TypeNode.php
TypeNode.isElementNillable
public function isElementNillable($name) { foreach ($this->element->getElementsByTagName('element') as $element) { if ($element->getAttribute('name') == $name && $element->getAttribute('nillable') == true) { return true; } } return false; }
php
public function isElementNillable($name) { foreach ($this->element->getElementsByTagName('element') as $element) { if ($element->getAttribute('name') == $name && $element->getAttribute('nillable') == true) { return true; } } return false; }
[ "public", "function", "isElementNillable", "(", "$", "name", ")", "{", "foreach", "(", "$", "this", "->", "element", "->", "getElementsByTagName", "(", "'element'", ")", "as", "$", "element", ")", "{", "if", "(", "$", "element", "->", "getAttribute", "(", ...
Returns whether a sub element of the type may be undefined for the type. @param string $name The name of the sub element. @return bool Whether the sub element may be undefined for the type.
[ "Returns", "whether", "a", "sub", "element", "of", "the", "type", "may", "be", "undefined", "for", "the", "type", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/TypeNode.php#L58-L66
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/TypeNode.php
TypeNode.getElementMinOccurs
public function getElementMinOccurs($name) { foreach ($this->element->getElementsByTagName('element') as $element) { if ($element->getAttribute('name') == $name) { $minOccurs = $element->getAttribute('minOccurs'); if ($minOccurs === '') { retur...
php
public function getElementMinOccurs($name) { foreach ($this->element->getElementsByTagName('element') as $element) { if ($element->getAttribute('name') == $name) { $minOccurs = $element->getAttribute('minOccurs'); if ($minOccurs === '') { retur...
[ "public", "function", "getElementMinOccurs", "(", "$", "name", ")", "{", "foreach", "(", "$", "this", "->", "element", "->", "getElementsByTagName", "(", "'element'", ")", "as", "$", "element", ")", "{", "if", "(", "$", "element", "->", "getAttribute", "("...
Returns the minOccurs value of the element. @param $name string The name of the sub element @return int the minOccurs value of the element
[ "Returns", "the", "minOccurs", "value", "of", "the", "element", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/TypeNode.php#L91-L103
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/TypeNode.php
TypeNode.getBase
public function getBase() { $base = null; $extensions = $this->element->getElementsByTagName('extension'); if ($extensions->length > 0) { $base = $this->cleanNamespace($extensions->item(0)->getAttribute('base')); } return $base; }
php
public function getBase() { $base = null; $extensions = $this->element->getElementsByTagName('extension'); if ($extensions->length > 0) { $base = $this->cleanNamespace($extensions->item(0)->getAttribute('base')); } return $base; }
[ "public", "function", "getBase", "(", ")", "{", "$", "base", "=", "null", ";", "$", "extensions", "=", "$", "this", "->", "element", "->", "getElementsByTagName", "(", "'extension'", ")", ";", "if", "(", "$", "extensions", "->", "length", ">", "0", ")"...
Returns the base type for the type. This is used to model inheritance between types. @return string The name of the base type for the type.
[ "Returns", "the", "base", "type", "for", "the", "type", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/TypeNode.php#L112-L122
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/TypeNode.php
TypeNode.getParts
public function getParts() { $wsdlLines = $this->getWsdlLines(); $parts = array(); // If array is defied as inherited from array type it have only one line and looks like "Type ArrayOfType[]" if (sizeof($wsdlLines) == 1 && substr($wsdlLines[0], -2, 2) == '[]') { list($t...
php
public function getParts() { $wsdlLines = $this->getWsdlLines(); $parts = array(); // If array is defied as inherited from array type it have only one line and looks like "Type ArrayOfType[]" if (sizeof($wsdlLines) == 1 && substr($wsdlLines[0], -2, 2) == '[]') { list($t...
[ "public", "function", "getParts", "(", ")", "{", "$", "wsdlLines", "=", "$", "this", "->", "getWsdlLines", "(", ")", ";", "$", "parts", "=", "array", "(", ")", ";", "// If array is defied as inherited from array type it have only one line and looks like \"Type ArrayOfTy...
Returns the sub elements of the type. The elements are returned as an array where keys are names of sub elements and values are their type. @return array An array of sub element names and types.
[ "Returns", "the", "sub", "elements", "of", "the", "type", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/TypeNode.php#L131-L158
wsdl2phpgenerator/wsdl2phpgenerator
src/Xml/TypeNode.php
TypeNode.getPattern
public function getPattern() { $pattern = null; if ($patternNodes = $this->element->getElementsByTagName('pattern')) { if ($patternNodes->length > 0) { $pattern = $patternNodes->item(0)->getAttribute('value'); } } return $pattern; }
php
public function getPattern() { $pattern = null; if ($patternNodes = $this->element->getElementsByTagName('pattern')) { if ($patternNodes->length > 0) { $pattern = $patternNodes->item(0)->getAttribute('value'); } } return $pattern; }
[ "public", "function", "getPattern", "(", ")", "{", "$", "pattern", "=", "null", ";", "if", "(", "$", "patternNodes", "=", "$", "this", "->", "element", "->", "getElementsByTagName", "(", "'pattern'", ")", ")", "{", "if", "(", "$", "patternNodes", "->", ...
Returns the pattern which the type represents if any. @return string The pattern.
[ "Returns", "the", "pattern", "which", "the", "type", "represents", "if", "any", "." ]
train
https://github.com/wsdl2phpgenerator/wsdl2phpgenerator/blob/86f3dbbd690973b651f199ee85c0a71c24a2790d/src/Xml/TypeNode.php#L165-L176