_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q26300 | OriginationUrlList.create | train | public function create($weight, $priority, $enabled, $friendlyName, $sipUrl) {
$data = Values::of(array(
'Weight' => $weight,
'Priority' => $priority,
'Enabled' => Serialize::booleanToString($enabled),
'FriendlyName' => $friendlyName,
'SipUrl' => $sipU... | php | {
"resource": ""
} |
q26301 | VariableList.create | train | public function create($key, $value) {
$data = Values::of(array('Key' => $key, 'Value' => $value, ));
$payload = $this->version->create(
'POST',
$this->uri,
array(),
$data
);
return new VariableInstance(
$this->version,
... | php | {
"resource": ""
} |
q26302 | VariableList.getContext | train | public function getContext($sid) {
return new VariableContext(
$this->version,
$this->solution['serviceSid'],
$this->solution['environmentSid'],
$sid
);
} | php | {
"resource": ""
} |
q26303 | AssistantContext.getAssistantFallbackActions | train | protected function getAssistantFallbackActions() {
if (!$this->_assistantFallbackActions) {
$this->_assistantFallbackActions = new AssistantFallbackActionsList(
$this->version,
$this->solution['sid']
);
}
return $this->_assistantFallbackAc... | php | {
"resource": ""
} |
q26304 | AssistantContext.getAssistantInitiationActions | train | protected function getAssistantInitiationActions() {
if (!$this->_assistantInitiationActions) {
$this->_assistantInitiationActions = new AssistantInitiationActionsList(
$this->version,
$this->solution['sid']
);
}
return $this->_assistantIn... | php | {
"resource": ""
} |
q26305 | PhoneNumberList.create | train | public function create($phoneNumberSid) {
$data = Values::of(array('PhoneNumberSid' => $phoneNumberSid, ));
$payload = $this->version->create(
'POST',
$this->uri,
array(),
$data
);
return new PhoneNumberInstance($this->version, $payload, ... | php | {
"resource": ""
} |
q26306 | SettingsContext.fetch | train | public function fetch() {
$params = Values::of(array());
$payload = $this->version->fetch(
'GET',
$this->uri,
$params
);
return new SettingsInstance($this->version, $payload);
} | php | {
"resource": ""
} |
q26307 | SettingsContext.update | train | public function update($options = array()) {
$options = new Values($options);
$data = Values::of(array(
'DialingPermissionsInheritance' => Serialize::booleanToString($options['dialingPermissionsInheritance']),
));
$payload = $this->version->update(
'POST',
... | php | {
"resource": ""
} |
q26308 | ExecutionContext.getExecutionContext | train | protected function getExecutionContext() {
if (!$this->_executionContext) {
$this->_executionContext = new ExecutionContextList(
$this->version,
$this->solution['flowSid'],
$this->solution['sid']
);
}
return $this->_executi... | php | {
"resource": ""
} |
q26309 | HostedNumberOrderList.create | train | public function create($phoneNumber, $smsCapability, $options = array()) {
$options = new Values($options);
$data = Values::of(array(
'PhoneNumber' => $phoneNumber,
'SmsCapability' => Serialize::booleanToString($smsCapability),
'AccountSid' => $options['accountSid'],... | php | {
"resource": ""
} |
q26310 | FactorContext.getChallenges | train | protected function getChallenges() {
if (!$this->_challenges) {
$this->_challenges = new ChallengeList(
$this->version,
$this->solution['serviceSid'],
$this->solution['identity'],
$this->solution['sid']
);
}
... | php | {
"resource": ""
} |
q26311 | ExecutionStepContextList.getContext | train | public function getContext() {
return new ExecutionStepContextContext(
$this->version,
$this->solution['flowSid'],
$this->solution['executionSid'],
$this->solution['stepSid']
);
} | php | {
"resource": ""
} |
q26312 | TaskContext.getFields | train | protected function getFields() {
if (!$this->_fields) {
$this->_fields = new FieldList(
$this->version,
$this->solution['assistantSid'],
$this->solution['sid']
);
}
return $this->_fields;
} | php | {
"resource": ""
} |
q26313 | TaskContext.getSamples | train | protected function getSamples() {
if (!$this->_samples) {
$this->_samples = new SampleList(
$this->version,
$this->solution['assistantSid'],
$this->solution['sid']
);
}
return $this->_samples;
} | php | {
"resource": ""
} |
q26314 | TaskContext.getTaskActions | train | protected function getTaskActions() {
if (!$this->_taskActions) {
$this->_taskActions = new TaskActionsList(
$this->version,
$this->solution['assistantSid'],
$this->solution['sid']
);
}
return $this->_taskActions;
} | php | {
"resource": ""
} |
q26315 | Domain.request | train | public function request($method, $uri, $params = array(), $data = array(),
$headers = array(), $user = null, $password=null,
$timeout=null) {
$url = $this->absoluteUrl($uri);
return $this->client->request(
$method,
$url,
... | php | {
"resource": ""
} |
q26316 | TwiML.buildElement | train | private function buildElement($twiml, $document) {
$element = $document->createElement($twiml->name);
foreach ($twiml->attributes as $name => $value) {
if (is_bool($value)) {
$value = ($value === true) ? 'true' : 'false';
}
$element->setAttribute($name, ... | php | {
"resource": ""
} |
q26317 | TwiML.xml | train | private function xml() {
$document = new DOMDocument('1.0', 'UTF-8');
$document->appendChild($this->buildElement($this, $document));
return $document;
} | php | {
"resource": ""
} |
q26318 | AddressList.create | train | public function create($customerName, $street, $city, $region, $postalCode, $isoCountry, $options = array()) {
$options = new Values($options);
$data = Values::of(array(
'CustomerName' => $customerName,
'Street' => $street,
'City' => $city,
'Region' => $r... | php | {
"resource": ""
} |
q26319 | SessionContext.getInteractions | train | protected function getInteractions() {
if (!$this->_interactions) {
$this->_interactions = new InteractionList(
$this->version,
$this->solution['serviceSid'],
$this->solution['sid']
);
}
return $this->_interactions;
} | php | {
"resource": ""
} |
q26320 | SessionContext.getParticipants | train | protected function getParticipants() {
if (!$this->_participants) {
$this->_participants = new ParticipantList(
$this->version,
$this->solution['serviceSid'],
$this->solution['sid']
);
}
return $this->_participants;
} | php | {
"resource": ""
} |
q26321 | EngagementContext.getEngagementContext | train | protected function getEngagementContext() {
if (!$this->_engagementContext) {
$this->_engagementContext = new EngagementContextList(
$this->version,
$this->solution['flowSid'],
$this->solution['sid']
);
}
return $this->_eng... | php | {
"resource": ""
} |
q26322 | AuthTypesList.getRegistrations | train | protected function getRegistrations() {
if (!$this->_registrations) {
$this->_registrations = new AuthTypeRegistrationsList(
$this->version,
$this->solution['accountSid'],
$this->solution['domainSid']
);
}
return $this->_re... | php | {
"resource": ""
} |
q26323 | ParticipantContext.getPublishedTracks | train | protected function getPublishedTracks() {
if (!$this->_publishedTracks) {
$this->_publishedTracks = new PublishedTrackList(
$this->version,
$this->solution['roomSid'],
$this->solution['sid']
);
}
return $this->_publishedTra... | php | {
"resource": ""
} |
q26324 | ParticipantContext.getSubscribedTracks | train | protected function getSubscribedTracks() {
if (!$this->_subscribedTracks) {
$this->_subscribedTracks = new SubscribedTrackList(
$this->version,
$this->solution['roomSid'],
$this->solution['sid']
);
}
return $this->_subscrib... | php | {
"resource": ""
} |
q26325 | IpAddressList.create | train | public function create($friendlyName, $ipAddress, $options = array()) {
$options = new Values($options);
$data = Values::of(array(
'FriendlyName' => $friendlyName,
'IpAddress' => $ipAddress,
'CidrPrefixLength' => $options['cidrPrefixLength'],
));
$pa... | php | {
"resource": ""
} |
q26326 | IpAddressList.getContext | train | public function getContext($sid) {
return new IpAddressContext(
$this->version,
$this->solution['accountSid'],
$this->solution['ipAccessControlListSid'],
$sid
);
} | php | {
"resource": ""
} |
q26327 | UserChannelList.getContext | train | public function getContext($channelSid) {
return new UserChannelContext(
$this->version,
$this->solution['serviceSid'],
$this->solution['userSid'],
$channelSid
);
} | php | {
"resource": ""
} |
q26328 | CredentialListContext.getCredentials | train | protected function getCredentials() {
if (!$this->_credentials) {
$this->_credentials = new CredentialList(
$this->version,
$this->solution['accountSid'],
$this->solution['sid']
);
}
return $this->_credentials;
} | php | {
"resource": ""
} |
q26329 | UserContext.getUserBindings | train | protected function getUserBindings() {
if (!$this->_userBindings) {
$this->_userBindings = new UserBindingList(
$this->version,
$this->solution['serviceSid'],
$this->solution['sid']
);
}
return $this->_userBindings;
} | php | {
"resource": ""
} |
q26330 | NotificationList.getContext | train | public function getContext($sid) {
return new NotificationContext(
$this->version,
$this->solution['accountSid'],
$this->solution['callSid'],
$sid
);
} | php | {
"resource": ""
} |
q26331 | Recount.reactableModelFromType | train | private function reactableModelFromType(
string $modelType
): ReactableContract {
if (!class_exists($modelType)) {
$modelType = $this->findModelTypeInMorphMap($modelType);
}
$model = new $modelType;
if (!$model instanceof ReactableContract) {
throw R... | php | {
"resource": ""
} |
q26332 | Recount.findModelTypeInMorphMap | train | private function findModelTypeInMorphMap(
string $modelType
): string {
$morphMap = Relation::morphMap();
if (!isset($morphMap[$modelType])) {
throw ReactableInvalid::classNotExists($modelType);
}
return $morphMap[$modelType];
} | php | {
"resource": ""
} |
q26333 | LoveServiceProvider.registerListeners | train | private function registerListeners(): void
{
Event::listen(ReactionHasBeenAdded::class, IncrementAggregates::class);
Event::listen(ReactionHasBeenRemoved::class, DecrementAggregates::class);
} | php | {
"resource": ""
} |
q26334 | Transient.getStdin | train | private function getStdin()
{
if (!isset($this->stdin)) {
$this->stdin = \fopen('php://stdin', 'r');
}
if (\feof($this->stdin)) {
throw new BreakException('Ctrl+D');
}
return $this->stdin;
} | php | {
"resource": ""
} |
q26335 | ConstantEnumerator.getConstants | train | protected function getConstants($category = null)
{
if (!$category) {
return \get_defined_constants();
}
$consts = \get_defined_constants(true);
if ($category === 'internal') {
unset($consts['user']);
return \call_user_func_array('array_merge', ... | php | {
"resource": ""
} |
q26336 | RunkitReloader.reload | train | private function reload(Shell $shell)
{
\clearstatcache();
$modified = [];
foreach (\get_included_files() as $file) {
$timestamp = \filemtime($file);
if (!isset($this->timestamps[$file])) {
$this->timestamps[$file] = $timestamp;
conti... | php | {
"resource": ""
} |
q26337 | RunkitReloader.lintFile | train | private function lintFile($file)
{
// first try to parse it
try {
$this->parser->parse(\file_get_contents($file));
} catch (\Exception $e) {
return false;
}
return true;
} | php | {
"resource": ""
} |
q26338 | SignatureFormatter.format | train | public static function format(\Reflector $reflector)
{
switch (true) {
case $reflector instanceof \ReflectionFunction:
case $reflector instanceof ReflectionLanguageConstruct:
return self::formatFunction($reflector);
// this case also covers \ReflectionObj... | php | {
"resource": ""
} |
q26339 | SignatureFormatter.formatModifiers | train | private static function formatModifiers(\Reflector $reflector)
{
if ($reflector instanceof \ReflectionClass && $reflector->isTrait()) {
// For some reason, PHP 5.x returns `abstract public` modifiers for
// traits. Let's just ignore that business entirely.
if (\version_co... | php | {
"resource": ""
} |
q26340 | SignatureFormatter.formatClass | train | private static function formatClass(\ReflectionClass $reflector)
{
$chunks = [];
if ($modifiers = self::formatModifiers($reflector)) {
$chunks[] = $modifiers;
}
if ($reflector->isTrait()) {
$chunks[] = 'trait';
} else {
$chunks[] = $refle... | php | {
"resource": ""
} |
q26341 | SignatureFormatter.getTypeStyle | train | private static function getTypeStyle($value)
{
if (\is_int($value) || \is_float($value)) {
return 'number';
} elseif (\is_string($value)) {
return 'string';
} elseif (\is_bool($value) || \is_null($value)) {
return 'bool';
} else {
retur... | php | {
"resource": ""
} |
q26342 | SignatureFormatter.formatFunction | train | private static function formatFunction(\ReflectionFunctionAbstract $reflector)
{
return \sprintf(
'<keyword>function</keyword> %s<function>%s</function>(%s)',
$reflector->returnsReference() ? '&' : '',
self::formatName($reflector),
\implode(', ', self::formatF... | php | {
"resource": ""
} |
q26343 | SignatureFormatter.formatMethod | train | private static function formatMethod(\ReflectionMethod $reflector)
{
return \sprintf(
'%s %s',
self::formatModifiers($reflector),
self::formatFunction($reflector)
);
} | php | {
"resource": ""
} |
q26344 | SignatureFormatter.formatFunctionParams | train | private static function formatFunctionParams(\ReflectionFunctionAbstract $reflector)
{
$params = [];
foreach ($reflector->getParameters() as $param) {
$hint = '';
try {
if ($param->isArray()) {
$hint = '<keyword>array</keyword> ';
... | php | {
"resource": ""
} |
q26345 | Docblock.prefixLength | train | protected static function prefixLength(array $lines)
{
// find only lines with interesting things
$lines = \array_filter($lines, function ($line) {
return \substr($line, \strspn($line, "* \t\n\r\0\x0B"));
});
// if we sort the lines, we only have to compare two items
... | php | {
"resource": ""
} |
q26346 | FunctionReturnInWriteContextPass.enterNode | train | public function enterNode(Node $node)
{
if ($node instanceof Array_ || $this->isCallNode($node)) {
$items = $node instanceof Array_ ? $node->items : $node->args;
foreach ($items as $item) {
if ($item && $item->byRef && $this->isCallNode($item->value)) {
... | php | {
"resource": ""
} |
q26347 | ValidClassNamePass.enterNode | train | public function enterNode(Node $node)
{
parent::enterNode($node);
if (self::isConditional($node)) {
$this->conditionalScopes++;
} else {
// @todo add an "else" here which adds a runtime check for instances where we can't tell
// whether a class is being r... | php | {
"resource": ""
} |
q26348 | ValidClassNamePass.leaveNode | train | public function leaveNode(Node $node)
{
if (self::isConditional($node)) {
$this->conditionalScopes--;
} elseif ($node instanceof New_) {
$this->validateNewExpression($node);
} elseif ($node instanceof ClassConstFetch) {
$this->validateClassConstFetchExpres... | php | {
"resource": ""
} |
q26349 | ValidClassNamePass.validateClassStatement | train | protected function validateClassStatement(Class_ $stmt)
{
$this->ensureCanDefine($stmt, self::CLASS_TYPE);
if (isset($stmt->extends)) {
$this->ensureClassExists($this->getFullyQualifiedName($stmt->extends), $stmt);
}
$this->ensureInterfacesExist($stmt->implements, $stmt);... | php | {
"resource": ""
} |
q26350 | ValidClassNamePass.validateInterfaceStatement | train | protected function validateInterfaceStatement(Interface_ $stmt)
{
$this->ensureCanDefine($stmt, self::INTERFACE_TYPE);
$this->ensureInterfacesExist($stmt->extends, $stmt);
} | php | {
"resource": ""
} |
q26351 | ValidClassNamePass.validateNewExpression | train | protected function validateNewExpression(New_ $stmt)
{
// if class name is an expression or an anonymous class, give it a pass for now
if (!$stmt->class instanceof Expr && !$stmt->class instanceof Class_) {
$this->ensureClassExists($this->getFullyQualifiedName($stmt->class), $stmt);
... | php | {
"resource": ""
} |
q26352 | ValidClassNamePass.ensureCanDefine | train | protected function ensureCanDefine(Stmt $stmt, $scopeType = self::CLASS_TYPE)
{
$name = $this->getFullyQualifiedName($stmt->name);
// check for name collisions
$errorType = null;
if ($this->classExists($name)) {
$errorType = self::CLASS_TYPE;
} elseif ($this->int... | php | {
"resource": ""
} |
q26353 | ValidClassNamePass.ensureClassExists | train | protected function ensureClassExists($name, $stmt)
{
if (!$this->classExists($name)) {
throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt);
}
} | php | {
"resource": ""
} |
q26354 | ValidClassNamePass.ensureClassOrInterfaceExists | train | protected function ensureClassOrInterfaceExists($name, $stmt)
{
if (!$this->classExists($name) && !$this->interfaceExists($name)) {
throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt);
}
} | php | {
"resource": ""
} |
q26355 | ValidClassNamePass.ensureClassOrTraitExists | train | protected function ensureClassOrTraitExists($name, $stmt)
{
if (!$this->classExists($name) && !$this->traitExists($name)) {
throw $this->createError(\sprintf('Class \'%s\' not found', $name), $stmt);
}
} | php | {
"resource": ""
} |
q26356 | ValidClassNamePass.ensureMethodExists | train | protected function ensureMethodExists($class, $name, $stmt)
{
$this->ensureClassOrTraitExists($class, $stmt);
// let's pretend all calls to self, parent and static are valid
if (\in_array(\strtolower($class), ['self', 'parent', 'static'])) {
return;
}
// ... and... | php | {
"resource": ""
} |
q26357 | ValidClassNamePass.ensureInterfacesExist | train | protected function ensureInterfacesExist($interfaces, $stmt)
{
foreach ($interfaces as $interface) {
/** @var string $name */
$name = $this->getFullyQualifiedName($interface);
if (!$this->interfaceExists($name)) {
throw $this->createError(\sprintf('Interfa... | php | {
"resource": ""
} |
q26358 | ValidClassNamePass.getScopeType | train | protected function getScopeType(Stmt $stmt)
{
if ($stmt instanceof Class_) {
return self::CLASS_TYPE;
} elseif ($stmt instanceof Interface_) {
return self::INTERFACE_TYPE;
} elseif ($stmt instanceof Trait_) {
return self::TRAIT_TYPE;
}
} | php | {
"resource": ""
} |
q26359 | ValidClassNamePass.classExists | train | protected function classExists($name)
{
// Give `self`, `static` and `parent` a pass. This will actually let
// some errors through, since we're not checking whether the keyword is
// being used in a class scope.
if (\in_array(\strtolower($name), ['self', 'static', 'parent'])) {
... | php | {
"resource": ""
} |
q26360 | ValidClassNamePass.findInScope | train | protected function findInScope($name)
{
$name = \strtolower($name);
if (isset($this->currentScope[$name])) {
return $this->currentScope[$name];
}
} | php | {
"resource": ""
} |
q26361 | Sudo.fetchProperty | train | public static function fetchProperty($object, $property)
{
$refl = new \ReflectionObject($object);
$prop = $refl->getProperty($property);
$prop->setAccessible(true);
return $prop->getValue($object);
} | php | {
"resource": ""
} |
q26362 | Sudo.assignProperty | train | public static function assignProperty($object, $property, $value)
{
$refl = new \ReflectionObject($object);
$prop = $refl->getProperty($property);
$prop->setAccessible(true);
$prop->setValue($object, $value);
return $value;
} | php | {
"resource": ""
} |
q26363 | Sudo.callMethod | train | public static function callMethod($object, $method, $args = null)
{
$args = \func_get_args();
$object = \array_shift($args);
$method = \array_shift($args);
$refl = new \ReflectionObject($object);
$reflMethod = $refl->getMethod($method);
$reflMethod->setAccessible(t... | php | {
"resource": ""
} |
q26364 | Sudo.fetchStaticProperty | train | public static function fetchStaticProperty($class, $property)
{
$refl = new \ReflectionClass($class);
$prop = $refl->getProperty($property);
$prop->setAccessible(true);
return $prop->getValue();
} | php | {
"resource": ""
} |
q26365 | Sudo.assignStaticProperty | train | public static function assignStaticProperty($class, $property, $value)
{
$refl = new \ReflectionClass($class);
$prop = $refl->getProperty($property);
$prop->setAccessible(true);
$prop->setValue($value);
return $value;
} | php | {
"resource": ""
} |
q26366 | Sudo.callStatic | train | public static function callStatic($class, $method, $args = null)
{
$args = \func_get_args();
$class = \array_shift($args);
$method = \array_shift($args);
$refl = new \ReflectionClass($class);
$reflMethod = $refl->getMethod($method);
$reflMethod->setAccessible(true... | php | {
"resource": ""
} |
q26367 | CommandsMatcher.setCommands | train | public function setCommands(array $commands)
{
$names = [];
foreach ($commands as $command) {
$names = \array_merge([$command->getName()], $names);
$names = \array_merge($command->getAliases(), $names);
}
$this->commands = $names;
} | php | {
"resource": ""
} |
q26368 | CommandsMatcher.matchCommand | train | protected function matchCommand($name)
{
foreach ($this->commands as $cmd) {
if ($this->startsWith($name, $cmd)) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q26369 | ReflectionClassConstant.export | train | public static function export($class, $name, $return = false)
{
$refl = new self($class, $name);
$value = $refl->getValue();
$str = \sprintf('Constant [ public %s %s ] { %s }', \gettype($value), $refl->getName(), $value);
if ($return) {
return $str;
}
e... | php | {
"resource": ""
} |
q26370 | ReflectionClassConstant.getDeclaringClass | train | public function getDeclaringClass()
{
$parent = $this->class;
// Since we don't have real reflection constants, we can't see where
// it's actually defined. Let's check for a constant that is also
// available on the parent class which has exactly the same value.
//
... | php | {
"resource": ""
} |
q26371 | ReflectingCommand.getTarget | train | protected function getTarget($valueName)
{
$valueName = \trim($valueName);
$matches = [];
switch (true) {
case \preg_match(self::CLASS_OR_FUNC, $valueName, $matches):
return [$this->resolveName($matches[0], true), null, 0];
case \preg_match(self::CL... | php | {
"resource": ""
} |
q26372 | ReflectingCommand.getTargetAndReflector | train | protected function getTargetAndReflector($valueName)
{
list($value, $member, $kind) = $this->getTarget($valueName);
return [$value, Mirror::get($value, $member, $kind)];
} | php | {
"resource": ""
} |
q26373 | ReflectingCommand.resolveCode | train | protected function resolveCode($code)
{
try {
$value = $this->getApplication()->execute($code, true);
} catch (\Exception $e) {
// Swallow all exceptions?
}
if (!isset($value) || $value instanceof NoReturnValue) {
throw new RuntimeException('Unkno... | php | {
"resource": ""
} |
q26374 | ReflectingCommand.resolveObject | train | private function resolveObject($code)
{
$value = $this->resolveCode($code);
if (!\is_object($value)) {
throw new RuntimeException('Unable to inspect a non-object');
}
return $value;
} | php | {
"resource": ""
} |
q26375 | GlobalVariableEnumerator.getGlobals | train | protected function getGlobals()
{
global $GLOBALS;
$names = \array_keys($GLOBALS);
\natcasesort($names);
$ret = [];
foreach ($names as $name) {
$ret[$name] = $GLOBALS[$name];
}
return $ret;
} | php | {
"resource": ""
} |
q26376 | GlobalVariableEnumerator.prepareGlobals | train | protected function prepareGlobals($globals)
{
// My kingdom for a generator.
$ret = [];
foreach ($globals as $name => $value) {
if ($this->showItem($name)) {
$fname = '$' . $name;
$ret[$fname] = [
'name' => $fname,
... | php | {
"resource": ""
} |
q26377 | ValidConstructorPass.enterNode | train | public function enterNode(Node $node)
{
if ($node instanceof Namespace_) {
$this->namespace = isset($node->name) ? $node->name->parts : [];
} elseif ($node instanceof Class_) {
$constructor = null;
foreach ($node->stmts as $stmt) {
if ($stmt instan... | php | {
"resource": ""
} |
q26378 | DocblockFormatter.format | train | public static function format(\Reflector $reflector)
{
$docblock = new Docblock($reflector);
$chunks = [];
if (!empty($docblock->desc)) {
$chunks[] = '<comment>Description:</comment>';
$chunks[] = self::indent(OutputFormatter::escape($docblock->desc), ' ');
... | php | {
"resource": ""
} |
q26379 | DocblockFormatter.formatTags | train | private static function formatTags(array $skip, array $tags)
{
$chunks = [];
foreach ($tags as $name => $values) {
if (\in_array($name, $skip)) {
continue;
}
foreach ($values as $value) {
$chunks[] = \sprintf('<comment>%s%s</comme... | php | {
"resource": ""
} |
q26380 | DocblockFormatter.getVectorParamTemplate | train | private static function getVectorParamTemplate($type, $max)
{
if (!isset(self::$vectorParamTemplates[$type])) {
return \sprintf('%%-%ds', $max);
}
return \sprintf('<%s>%%-%ds</%s>', self::$vectorParamTemplates[$type], $max, self::$vectorParamTemplates[$type]);
} | php | {
"resource": ""
} |
q26381 | DocblockFormatter.inflect | train | private static function inflect($text)
{
$words = \trim(\preg_replace('/[\s_-]+/', ' ', \preg_replace('/([a-z])([A-Z])/', '$1 $2', $text)));
return \implode(' ', \array_map('ucfirst', \explode(' ', $words)));
} | php | {
"resource": ""
} |
q26382 | Shell.getDefaultLoopListeners | train | protected function getDefaultLoopListeners()
{
$listeners = [];
if (ProcessForker::isSupported() && $this->config->usePcntl()) {
$listeners[] = new ProcessForker();
}
if (RunkitReloader::isSupported()) {
$listeners[] = new RunkitReloader();
}
... | php | {
"resource": ""
} |
q26383 | Shell.addMatchers | train | public function addMatchers(array $matchers)
{
$this->matchers = \array_merge($this->matchers, $matchers);
if (isset($this->autoCompleter)) {
$this->addMatchersToAutoCompleter($matchers);
}
} | php | {
"resource": ""
} |
q26384 | Shell.getInput | train | public function getInput()
{
$this->codeBufferOpen = false;
do {
// reset output verbosity (in case it was altered by a subcommand)
$this->output->setVerbosity(ShellOutput::VERBOSITY_VERBOSE);
$input = $this->readline();
/*
* Handle Ctr... | php | {
"resource": ""
} |
q26385 | Shell.onInput | train | public function onInput($input)
{
foreach ($this->loopListeners as $listeners) {
if (($return = $listeners->onInput($this, $input)) !== null) {
$input = $return;
}
}
return $input;
} | php | {
"resource": ""
} |
q26386 | Shell.onExecute | train | public function onExecute($code)
{
foreach ($this->loopListeners as $listener) {
if (($return = $listener->onExecute($this, $code)) !== null) {
$code = $return;
}
}
return $code;
} | php | {
"resource": ""
} |
q26387 | Shell.getScopeVariables | train | public function getScopeVariables($includeBoundObject = true)
{
$vars = $this->context->getAll();
if (!$includeBoundObject) {
unset($vars['this']);
}
return $vars;
} | php | {
"resource": ""
} |
q26388 | Shell.getSpecialScopeVariables | train | public function getSpecialScopeVariables($includeBoundObject = true)
{
$vars = $this->context->getSpecialVariables();
if (!$includeBoundObject) {
unset($vars['this']);
}
return $vars;
} | php | {
"resource": ""
} |
q26389 | Shell.addCode | train | public function addCode($code, $silent = false)
{
try {
// Code lines ending in \ keep the buffer open
if (\substr(\rtrim($code), -1) === '\\') {
$this->codeBufferOpen = true;
$code = \substr(\rtrim($code), 0, -1);
} else {
... | php | {
"resource": ""
} |
q26390 | Shell.setCode | train | private function setCode($code, $silent = false)
{
if ($this->hasCode()) {
$this->codeStack[] = [$this->codeBuffer, $this->codeBufferOpen, $this->code];
}
$this->resetCodeBuffer();
try {
$this->addCode($code, $silent);
} catch (\Throwable $e) {
... | php | {
"resource": ""
} |
q26391 | Shell.runCommand | train | protected function runCommand($input)
{
$command = $this->getCommand($input);
if (empty($command)) {
throw new \InvalidArgumentException('Command not found: ' . $input);
}
$input = new ShellInput(\str_replace('\\', '\\\\', \rtrim($input, " \t\n\r\0\x0B;")));
if... | php | {
"resource": ""
} |
q26392 | Shell.addInput | train | public function addInput($input, $silent = false)
{
foreach ((array) $input as $line) {
$this->inputBuffer[] = $silent ? new SilentInput($line) : $line;
}
} | php | {
"resource": ""
} |
q26393 | Shell.popCodeStack | train | private function popCodeStack()
{
$this->resetCodeBuffer();
if (empty($this->codeStack)) {
return;
}
list($codeBuffer, $codeBufferOpen, $code) = \array_pop($this->codeStack);
$this->codeBuffer = $codeBuffer;
$this->codeBufferOpen = $codeBufferOpen;
... | php | {
"resource": ""
} |
q26394 | Shell.addCodeBufferToHistory | train | private function addCodeBufferToHistory()
{
$codeBuffer = \array_filter($this->codeBuffer, function ($line) {
return !$line instanceof SilentInput;
});
$this->addHistory(\implode("\n", $codeBuffer));
} | php | {
"resource": ""
} |
q26395 | Shell.writeReturnValue | train | public function writeReturnValue($ret)
{
$this->lastExecSuccess = true;
if ($ret instanceof NoReturnValue) {
return;
}
$this->context->setReturnValue($ret);
$ret = $this->presentValue($ret);
$indent = \str_repeat(' ', \strlen(static::RETVAL));
... | php | {
"resource": ""
} |
q26396 | Shell.writeException | train | public function writeException(\Exception $e)
{
$this->lastExecSuccess = false;
$this->context->setLastException($e);
$this->output->writeln($this->formatException($e));
$this->resetCodeBuffer();
} | php | {
"resource": ""
} |
q26397 | Shell.getSeverity | train | protected function getSeverity(\ErrorException $e)
{
$severity = $e->getSeverity();
if ($severity & \error_reporting()) {
switch ($severity) {
case E_WARNING:
case E_NOTICE:
case E_CORE_WARNING:
case E_COMPILE_WARNING:
... | php | {
"resource": ""
} |
q26398 | Shell.execute | train | public function execute($code, $throwExceptions = false)
{
$this->setCode($code, true);
$closure = new ExecutionClosure($this);
if ($throwExceptions) {
return $closure->execute();
}
try {
return $closure->execute();
} catch (\TypeError $_e) {... | php | {
"resource": ""
} |
q26399 | Shell.hasCommand | train | protected function hasCommand($input)
{
if (\preg_match('/([^\s]+?)(?:\s|$)/A', \ltrim($input), $match)) {
return $this->has($match[1]);
}
return false;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.