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
sonata-project/SonataNotificationBundle
src/Command/ListQueuesCommand.php
ListQueuesCommand.execute
public function execute(InputInterface $input, OutputInterface $output) { $backend = $this->getContainer()->get('sonata.notification.backend'); if (!$backend instanceof QueueDispatcherInterface) { $output->writeln( 'The backend class <info>'.\get_class($backend).'</info>...
php
public function execute(InputInterface $input, OutputInterface $output) { $backend = $this->getContainer()->get('sonata.notification.backend'); if (!$backend instanceof QueueDispatcherInterface) { $output->writeln( 'The backend class <info>'.\get_class($backend).'</info>...
[ "public", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "backend", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'sonata.notification.backend'", ")", ";", "if", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Command/ListQueuesCommand.php#L35-L55
sonata-project/SonataNotificationBundle
src/Backend/RuntimeBackend.php
RuntimeBackend.create
public function create($type, array $body) { $message = new Message(); $message->setType($type); $message->setBody($body); $message->setState(MessageInterface::STATE_OPEN); return $message; }
php
public function create($type, array $body) { $message = new Message(); $message->setType($type); $message->setBody($body); $message->setState(MessageInterface::STATE_OPEN); return $message; }
[ "public", "function", "create", "(", "$", "type", ",", "array", "$", "body", ")", "{", "$", "message", "=", "new", "Message", "(", ")", ";", "$", "message", "->", "setType", "(", "$", "type", ")", ";", "$", "message", "->", "setBody", "(", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/RuntimeBackend.php#L51-L59
sonata-project/SonataNotificationBundle
src/Backend/RuntimeBackend.php
RuntimeBackend.handle
public function handle(MessageInterface $message, EventDispatcherInterface $dispatcher) { $event = new ConsumerEvent($message); try { $dispatcher->dispatch($message->getType(), $event); $message->setCompletedAt(new \DateTime()); $message->setState(MessageInterfa...
php
public function handle(MessageInterface $message, EventDispatcherInterface $dispatcher) { $event = new ConsumerEvent($message); try { $dispatcher->dispatch($message->getType(), $event); $message->setCompletedAt(new \DateTime()); $message->setState(MessageInterfa...
[ "public", "function", "handle", "(", "MessageInterface", "$", "message", ",", "EventDispatcherInterface", "$", "dispatcher", ")", "{", "$", "event", "=", "new", "ConsumerEvent", "(", "$", "message", ")", ";", "try", "{", "$", "dispatcher", "->", "dispatch", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/RuntimeBackend.php#L94-L109
sonata-project/SonataNotificationBundle
src/Iterator/AMQPMessageIterator.php
AMQPMessageIterator.next
public function next() { $this->isValid = false; if ($amqpMessage = $this->consumer->receive($this->timeout)) { $this->AMQMessage = $this->convertToAmqpLibMessage($amqpMessage); $data = json_decode($amqpMessage->getBody(), true); $data['body']['interopMessage'] ...
php
public function next() { $this->isValid = false; if ($amqpMessage = $this->consumer->receive($this->timeout)) { $this->AMQMessage = $this->convertToAmqpLibMessage($amqpMessage); $data = json_decode($amqpMessage->getBody(), true); $data['body']['interopMessage'] ...
[ "public", "function", "next", "(", ")", "{", "$", "this", "->", "isValid", "=", "false", ";", "if", "(", "$", "amqpMessage", "=", "$", "this", "->", "consumer", "->", "receive", "(", "$", "this", "->", "timeout", ")", ")", "{", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Iterator/AMQPMessageIterator.php#L96-L118
sonata-project/SonataNotificationBundle
src/Iterator/AMQPMessageIterator.php
AMQPMessageIterator.convertToAmqpLibMessage
private function convertToAmqpLibMessage(\Interop\Amqp\AmqpMessage $amqpMessage) { $amqpLibProperties = $amqpMessage->getHeaders(); $amqpLibProperties['application_headers'] = $amqpMessage->getProperties(); $amqpLibMessage = new AMQPMessage($amqpMessage->getBody(), $amqpLibProperties); ...
php
private function convertToAmqpLibMessage(\Interop\Amqp\AmqpMessage $amqpMessage) { $amqpLibProperties = $amqpMessage->getHeaders(); $amqpLibProperties['application_headers'] = $amqpMessage->getProperties(); $amqpLibMessage = new AMQPMessage($amqpMessage->getBody(), $amqpLibProperties); ...
[ "private", "function", "convertToAmqpLibMessage", "(", "\\", "Interop", "\\", "Amqp", "\\", "AmqpMessage", "$", "amqpMessage", ")", "{", "$", "amqpLibProperties", "=", "$", "amqpMessage", "->", "getHeaders", "(", ")", ";", "$", "amqpLibProperties", "[", "'applic...
@deprecated since 3.2, will be removed in 4.x @param \Interop\Amqp\AmqpMessage $amqpMessage @return AMQPMessage
[ "@deprecated", "since", "3", ".", "2", "will", "be", "removed", "in", "4", ".", "x" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Iterator/AMQPMessageIterator.php#L152-L167
sonata-project/SonataNotificationBundle
src/Backend/MessageManagerBackend.php
MessageManagerBackend.create
public function create($type, array $body) { $message = $this->messageManager->create(); $message->setType($type); $message->setBody($body); $message->setState(MessageInterface::STATE_OPEN); return $message; }
php
public function create($type, array $body) { $message = $this->messageManager->create(); $message->setType($type); $message->setBody($body); $message->setState(MessageInterface::STATE_OPEN); return $message; }
[ "public", "function", "create", "(", "$", "type", ",", "array", "$", "body", ")", "{", "$", "message", "=", "$", "this", "->", "messageManager", "->", "create", "(", ")", ";", "$", "message", "->", "setType", "(", "$", "type", ")", ";", "$", "messa...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/MessageManagerBackend.php#L102-L110
sonata-project/SonataNotificationBundle
src/Backend/MessageManagerBackend.php
MessageManagerBackend.getIterator
public function getIterator() { return new MessageManagerMessageIterator($this->messageManager, $this->types, $this->pause, $this->batchSize); }
php
public function getIterator() { return new MessageManagerMessageIterator($this->messageManager, $this->types, $this->pause, $this->batchSize); }
[ "public", "function", "getIterator", "(", ")", "{", "return", "new", "MessageManagerMessageIterator", "(", "$", "this", "->", "messageManager", ",", "$", "this", "->", "types", ",", "$", "this", "->", "pause", ",", "$", "this", "->", "batchSize", ")", ";",...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/MessageManagerBackend.php#L123-L126
sonata-project/SonataNotificationBundle
src/Backend/MessageManagerBackend.php
MessageManagerBackend.handle
public function handle(MessageInterface $message, EventDispatcherInterface $dispatcher) { $event = new ConsumerEvent($message); try { $message->setStartedAt(new \DateTime()); $message->setState(MessageInterface::STATE_IN_PROGRESS); $this->messageManager->save($me...
php
public function handle(MessageInterface $message, EventDispatcherInterface $dispatcher) { $event = new ConsumerEvent($message); try { $message->setStartedAt(new \DateTime()); $message->setState(MessageInterface::STATE_IN_PROGRESS); $this->messageManager->save($me...
[ "public", "function", "handle", "(", "MessageInterface", "$", "message", ",", "EventDispatcherInterface", "$", "dispatcher", ")", "{", "$", "event", "=", "new", "ConsumerEvent", "(", "$", "message", ")", ";", "try", "{", "$", "message", "->", "setStartedAt", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/MessageManagerBackend.php#L146-L170
sonata-project/SonataNotificationBundle
src/Backend/MessageManagerBackend.php
MessageManagerBackend.getStatus
public function getStatus() { try { $states = $this->messageManager->countStates(); } catch (\Exception $e) { return new Failure(sprintf('Unable to retrieve message information - %s (Database)', $e->getMessage())); } if ($states[MessageInterface::STATE_IN_PRO...
php
public function getStatus() { try { $states = $this->messageManager->countStates(); } catch (\Exception $e) { return new Failure(sprintf('Unable to retrieve message information - %s (Database)', $e->getMessage())); } if ($states[MessageInterface::STATE_IN_PRO...
[ "public", "function", "getStatus", "(", ")", "{", "try", "{", "$", "states", "=", "$", "this", "->", "messageManager", "->", "countStates", "(", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "return", "new", "Failure", "(", "spr...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/MessageManagerBackend.php#L175-L200
sonata-project/SonataNotificationBundle
src/Backend/AMQPBackend.php
AMQPBackend.initialize
public function initialize() { $args = []; if (null !== $this->deadLetterExchange) { $args['x-dead-letter-exchange'] = $this->deadLetterExchange; if (null !== $this->deadLetterRoutingKey) { $args['x-dead-letter-routing-key'] = $this->deadLetterRoutingKey; ...
php
public function initialize() { $args = []; if (null !== $this->deadLetterExchange) { $args['x-dead-letter-exchange'] = $this->deadLetterExchange; if (null !== $this->deadLetterRoutingKey) { $args['x-dead-letter-routing-key'] = $this->deadLetterRoutingKey; ...
[ "public", "function", "initialize", "(", ")", "{", "$", "args", "=", "[", "]", ";", "if", "(", "null", "!==", "$", "this", "->", "deadLetterExchange", ")", "{", "$", "args", "[", "'x-dead-letter-exchange'", "]", "=", "$", "this", "->", "deadLetterExchang...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/AMQPBackend.php#L119-L154
sonata-project/SonataNotificationBundle
src/Backend/AMQPBackend.php
AMQPBackend.publish
public function publish(MessageInterface $message) { $body = json_encode([ 'type' => $message->getType(), 'body' => $message->getBody(), 'createdAt' => $message->getCreatedAt()->format('U'), 'state' => $message->getState(), ]); $amqpMessage = ...
php
public function publish(MessageInterface $message) { $body = json_encode([ 'type' => $message->getType(), 'body' => $message->getBody(), 'createdAt' => $message->getCreatedAt()->format('U'), 'state' => $message->getState(), ]); $amqpMessage = ...
[ "public", "function", "publish", "(", "MessageInterface", "$", "message", ")", "{", "$", "body", "=", "json_encode", "(", "[", "'type'", "=>", "$", "message", "->", "getType", "(", ")", ",", "'body'", "=>", "$", "message", "->", "getBody", "(", ")", ",...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/AMQPBackend.php#L159-L177
sonata-project/SonataNotificationBundle
src/Backend/AMQPBackend.php
AMQPBackend.getIterator
public function getIterator() { $context = $this->getContext(); if (null !== $this->prefetchCount) { $context->setQos(null, $this->prefetchCount, false); } $this->consumer = $this->getContext()->createConsumer($this->getContext()->createQueue($this->queue)); $th...
php
public function getIterator() { $context = $this->getContext(); if (null !== $this->prefetchCount) { $context->setQos(null, $this->prefetchCount, false); } $this->consumer = $this->getContext()->createConsumer($this->getContext()->createQueue($this->queue)); $th...
[ "public", "function", "getIterator", "(", ")", "{", "$", "context", "=", "$", "this", "->", "getContext", "(", ")", ";", "if", "(", "null", "!==", "$", "this", "->", "prefetchCount", ")", "{", "$", "context", "->", "setQos", "(", "null", ",", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/AMQPBackend.php#L203-L219
sonata-project/SonataNotificationBundle
src/Backend/AMQPBackend.php
AMQPBackend.handle
public function handle(MessageInterface $message, EventDispatcherInterface $dispatcher) { $event = new ConsumerEvent($message); /** @var AmqpMessage $amqpMessage */ $amqpMessage = $message->getValue('interopMessage'); try { $dispatcher->dispatch($message->getType(), $ev...
php
public function handle(MessageInterface $message, EventDispatcherInterface $dispatcher) { $event = new ConsumerEvent($message); /** @var AmqpMessage $amqpMessage */ $amqpMessage = $message->getValue('interopMessage'); try { $dispatcher->dispatch($message->getType(), $ev...
[ "public", "function", "handle", "(", "MessageInterface", "$", "message", ",", "EventDispatcherInterface", "$", "dispatcher", ")", "{", "$", "event", "=", "new", "ConsumerEvent", "(", "$", "message", ")", ";", "/** @var AmqpMessage $amqpMessage */", "$", "amqpMessage...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/AMQPBackend.php#L224-L253
sonata-project/SonataNotificationBundle
src/Selector/ErroneousMessagesSelector.php
ErroneousMessagesSelector.getMessages
public function getMessages(array $types, $maxAttempts = 5) { $query = $this->registry->getManagerForClass($this->class)->getRepository($this->class) ->createQueryBuilder('m') ->where('m.state = :erroneousState') ->andWhere('m.restartCount < :maxAttempts'); $para...
php
public function getMessages(array $types, $maxAttempts = 5) { $query = $this->registry->getManagerForClass($this->class)->getRepository($this->class) ->createQueryBuilder('m') ->where('m.state = :erroneousState') ->andWhere('m.restartCount < :maxAttempts'); $para...
[ "public", "function", "getMessages", "(", "array", "$", "types", ",", "$", "maxAttempts", "=", "5", ")", "{", "$", "query", "=", "$", "this", "->", "registry", "->", "getManagerForClass", "(", "$", "this", "->", "class", ")", "->", "getRepository", "(", ...
Retrieve messages with given type(s) and restrict to max attempts count. @param array $types @param int $maxAttempts @return array
[ "Retrieve", "messages", "with", "given", "type", "(", "s", ")", "and", "restrict", "to", "max", "attempts", "count", "." ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Selector/ErroneousMessagesSelector.php#L49-L69
sonata-project/SonataNotificationBundle
src/Consumer/LoggerConsumer.php
LoggerConsumer.process
public function process(ConsumerEvent $event) { $message = $event->getMessage(); if (!\array_key_exists($message->getValue('level'), $this->types)) { throw new InvalidParameterException(); } $level = $this->types[$message->getValue('level')]; $this->logger->{$l...
php
public function process(ConsumerEvent $event) { $message = $event->getMessage(); if (!\array_key_exists($message->getValue('level'), $this->types)) { throw new InvalidParameterException(); } $level = $this->types[$message->getValue('level')]; $this->logger->{$l...
[ "public", "function", "process", "(", "ConsumerEvent", "$", "event", ")", "{", "$", "message", "=", "$", "event", "->", "getMessage", "(", ")", ";", "if", "(", "!", "\\", "array_key_exists", "(", "$", "message", "->", "getValue", "(", "'level'", ")", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Consumer/LoggerConsumer.php#L61-L72
sonata-project/SonataNotificationBundle
src/DependencyInjection/Compiler/NotificationCompilerPass.php
NotificationCompilerPass.process
public function process(ContainerBuilder $container) { if (!$container->hasDefinition('sonata.notification.dispatcher')) { return; } $definition = $container->getDefinition('sonata.notification.dispatcher'); $informations = []; foreach ($container->findTaggedSe...
php
public function process(ContainerBuilder $container) { if (!$container->hasDefinition('sonata.notification.dispatcher')) { return; } $definition = $container->getDefinition('sonata.notification.dispatcher'); $informations = []; foreach ($container->findTaggedSe...
[ "public", "function", "process", "(", "ContainerBuilder", "$", "container", ")", "{", "if", "(", "!", "$", "container", "->", "hasDefinition", "(", "'sonata.notification.dispatcher'", ")", ")", "{", "return", ";", "}", "$", "definition", "=", "$", "container",...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/DependencyInjection/Compiler/NotificationCompilerPass.php#L29-L104
sonata-project/SonataNotificationBundle
src/Controller/Api/MessageController.php
MessageController.postMessageAction
public function postMessageAction(Request $request) { $message = null; $form = $this->formFactory->createNamed(null, 'sonata_notification_api_form_message', $message, [ 'csrf_protection' => false, ]); $form->handleRequest($request); if ($form->isValid()) { ...
php
public function postMessageAction(Request $request) { $message = null; $form = $this->formFactory->createNamed(null, 'sonata_notification_api_form_message', $message, [ 'csrf_protection' => false, ]); $form->handleRequest($request); if ($form->isValid()) { ...
[ "public", "function", "postMessageAction", "(", "Request", "$", "request", ")", "{", "$", "message", "=", "null", ";", "$", "form", "=", "$", "this", "->", "formFactory", "->", "createNamed", "(", "null", ",", "'sonata_notification_api_form_message'", ",", "$"...
Adds a message. @ApiDoc( input={"class"="sonata_notification_api_form_message", "name"="", "groups"={"sonata_api_write"}}, output={"class"="Sonata\NotificationBundle\Model\Message", "groups"={"sonata_api_read"}}, statusCodes={ 200="Returned when successful", 400="Returned when an error has occurred while message creat...
[ "Adds", "a", "message", "." ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Controller/Api/MessageController.php#L119-L137
sonata-project/SonataNotificationBundle
src/Command/ConsumerHandlerCommand.php
ConsumerHandlerCommand.execute
public function execute(InputInterface $input, OutputInterface $output) { $startDate = new \DateTime(); $output->writeln(sprintf('[%s] <info>Checking listeners</info>', $startDate->format('r'))); foreach ($this->getNotificationDispatcher()->getListeners() as $type => $listeners) { ...
php
public function execute(InputInterface $input, OutputInterface $output) { $startDate = new \DateTime(); $output->writeln(sprintf('[%s] <info>Checking listeners</info>', $startDate->format('r'))); foreach ($this->getNotificationDispatcher()->getListeners() as $type => $listeners) { ...
[ "public", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "startDate", "=", "new", "\\", "DateTime", "(", ")", ";", "$", "output", "->", "writeln", "(", "sprintf", "(", "'[%s] <info>Checking l...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Command/ConsumerHandlerCommand.php#L44-L148
sonata-project/SonataNotificationBundle
src/Command/ConsumerHandlerCommand.php
ConsumerHandlerCommand.getBackend
private function getBackend($type = null) { $backend = $this->getContainer()->get('sonata.notification.backend'); if ($type && !\array_key_exists($type, $this->getNotificationDispatcher()->getListeners())) { throw new \RuntimeException(sprintf('The type `%s` does not exist, available ty...
php
private function getBackend($type = null) { $backend = $this->getContainer()->get('sonata.notification.backend'); if ($type && !\array_key_exists($type, $this->getNotificationDispatcher()->getListeners())) { throw new \RuntimeException(sprintf('The type `%s` does not exist, available ty...
[ "private", "function", "getBackend", "(", "$", "type", "=", "null", ")", "{", "$", "backend", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'sonata.notification.backend'", ")", ";", "if", "(", "$", "type", "&&", "!", "\\", "array...
@param string $type @return BackendInterface
[ "@param", "string", "$type" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Command/ConsumerHandlerCommand.php#L185-L205
sonata-project/SonataNotificationBundle
src/Entity/MessageManager.php
MessageManager.save
public function save($message, $andFlush = true) { //Hack for ConsumerHandlerCommand->optimize() if ($message->getId() && !$this->em->getUnitOfWork()->isInIdentityMap($message)) { $message = $this->getEntityManager()->getUnitOfWork()->merge($message); } parent::save($mes...
php
public function save($message, $andFlush = true) { //Hack for ConsumerHandlerCommand->optimize() if ($message->getId() && !$this->em->getUnitOfWork()->isInIdentityMap($message)) { $message = $this->getEntityManager()->getUnitOfWork()->merge($message); } parent::save($mes...
[ "public", "function", "save", "(", "$", "message", ",", "$", "andFlush", "=", "true", ")", "{", "//Hack for ConsumerHandlerCommand->optimize()", "if", "(", "$", "message", "->", "getId", "(", ")", "&&", "!", "$", "this", "->", "em", "->", "getUnitOfWork", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Entity/MessageManager.php#L28-L36
sonata-project/SonataNotificationBundle
src/Entity/MessageManager.php
MessageManager.findByTypes
public function findByTypes(array $types, $state, $batchSize) { $params = []; $query = $this->prepareStateQuery($state, $types, $batchSize, $params); $query->setParameters($params); return $query->getQuery()->execute(); }
php
public function findByTypes(array $types, $state, $batchSize) { $params = []; $query = $this->prepareStateQuery($state, $types, $batchSize, $params); $query->setParameters($params); return $query->getQuery()->execute(); }
[ "public", "function", "findByTypes", "(", "array", "$", "types", ",", "$", "state", ",", "$", "batchSize", ")", "{", "$", "params", "=", "[", "]", ";", "$", "query", "=", "$", "this", "->", "prepareStateQuery", "(", "$", "state", ",", "$", "types", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Entity/MessageManager.php#L41-L49
sonata-project/SonataNotificationBundle
src/Entity/MessageManager.php
MessageManager.findByAttempts
public function findByAttempts(array $types, $state, $batchSize, $maxAttempts = null, $attemptDelay = 10) { $params = []; $query = $this->prepareStateQuery($state, $types, $batchSize, $params); if ($maxAttempts) { $query ->andWhere('m.restartCount < :maxAttempts'...
php
public function findByAttempts(array $types, $state, $batchSize, $maxAttempts = null, $attemptDelay = 10) { $params = []; $query = $this->prepareStateQuery($state, $types, $batchSize, $params); if ($maxAttempts) { $query ->andWhere('m.restartCount < :maxAttempts'...
[ "public", "function", "findByAttempts", "(", "array", "$", "types", ",", "$", "state", ",", "$", "batchSize", ",", "$", "maxAttempts", "=", "null", ",", "$", "attemptDelay", "=", "10", ")", "{", "$", "params", "=", "[", "]", ";", "$", "query", "=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Entity/MessageManager.php#L54-L72
sonata-project/SonataNotificationBundle
src/Entity/MessageManager.php
MessageManager.countStates
public function countStates() { $tableName = $this->getEntityManager()->getClassMetadata($this->class)->table['name']; $stm = $this->getConnection()->query( sprintf('SELECT state, count(state) as cnt FROM %s GROUP BY state', $tableName) ); $states = [ Messag...
php
public function countStates() { $tableName = $this->getEntityManager()->getClassMetadata($this->class)->table['name']; $stm = $this->getConnection()->query( sprintf('SELECT state, count(state) as cnt FROM %s GROUP BY state', $tableName) ); $states = [ Messag...
[ "public", "function", "countStates", "(", ")", "{", "$", "tableName", "=", "$", "this", "->", "getEntityManager", "(", ")", "->", "getClassMetadata", "(", "$", "this", "->", "class", ")", "->", "table", "[", "'name'", "]", ";", "$", "stm", "=", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Entity/MessageManager.php#L77-L97
sonata-project/SonataNotificationBundle
src/Entity/MessageManager.php
MessageManager.cleanup
public function cleanup($maxAge) { $tableName = $this->getEntityManager()->getClassMetadata($this->class)->table['name']; $date = new \DateTime('now'); $date->sub(new \DateInterval(sprintf('PT%sS', $maxAge))); $qb = $this->getRepository()->createQueryBuilder('message') ...
php
public function cleanup($maxAge) { $tableName = $this->getEntityManager()->getClassMetadata($this->class)->table['name']; $date = new \DateTime('now'); $date->sub(new \DateInterval(sprintf('PT%sS', $maxAge))); $qb = $this->getRepository()->createQueryBuilder('message') ...
[ "public", "function", "cleanup", "(", "$", "maxAge", ")", "{", "$", "tableName", "=", "$", "this", "->", "getEntityManager", "(", ")", "->", "getClassMetadata", "(", "$", "this", "->", "class", ")", "->", "table", "[", "'name'", "]", ";", "$", "date", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Entity/MessageManager.php#L102-L117
sonata-project/SonataNotificationBundle
src/Entity/MessageManager.php
MessageManager.cancel
public function cancel(MessageInterface $message, $force = false) { if (($message->isRunning() || $message->isError()) && !$force) { return; } $message->setState(MessageInterface::STATE_CANCELLED); $this->save($message); }
php
public function cancel(MessageInterface $message, $force = false) { if (($message->isRunning() || $message->isError()) && !$force) { return; } $message->setState(MessageInterface::STATE_CANCELLED); $this->save($message); }
[ "public", "function", "cancel", "(", "MessageInterface", "$", "message", ",", "$", "force", "=", "false", ")", "{", "if", "(", "(", "$", "message", "->", "isRunning", "(", ")", "||", "$", "message", "->", "isError", "(", ")", ")", "&&", "!", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Entity/MessageManager.php#L122-L131
sonata-project/SonataNotificationBundle
src/Entity/MessageManager.php
MessageManager.restart
public function restart(MessageInterface $message) { if ($message->isOpen() || $message->isRunning() || $message->isCancelled()) { return; } $this->cancel($message, true); $newMessage = clone $message; $newMessage->setRestartCount($message->getRestartCount() + 1...
php
public function restart(MessageInterface $message) { if ($message->isOpen() || $message->isRunning() || $message->isCancelled()) { return; } $this->cancel($message, true); $newMessage = clone $message; $newMessage->setRestartCount($message->getRestartCount() + 1...
[ "public", "function", "restart", "(", "MessageInterface", "$", "message", ")", "{", "if", "(", "$", "message", "->", "isOpen", "(", ")", "||", "$", "message", "->", "isRunning", "(", ")", "||", "$", "message", "->", "isCancelled", "(", ")", ")", "{", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Entity/MessageManager.php#L136-L149
sonata-project/SonataNotificationBundle
src/Entity/MessageManager.php
MessageManager.prepareStateQuery
protected function prepareStateQuery($state, $types, $batchSize, &$parameters) { $query = $this->getRepository() ->createQueryBuilder('m') ->where('m.state = :state') ->orderBy('m.createdAt'); $parameters['state'] = $state; if (\count($types) > 0) { ...
php
protected function prepareStateQuery($state, $types, $batchSize, &$parameters) { $query = $this->getRepository() ->createQueryBuilder('m') ->where('m.state = :state') ->orderBy('m.createdAt'); $parameters['state'] = $state; if (\count($types) > 0) { ...
[ "protected", "function", "prepareStateQuery", "(", "$", "state", ",", "$", "types", ",", "$", "batchSize", ",", "&", "$", "parameters", ")", "{", "$", "query", "=", "$", "this", "->", "getRepository", "(", ")", "->", "createQueryBuilder", "(", "'m'", ")"...
@param int $state @param array $types @param int $batchSize @param array $parameters @return QueryBuilder
[ "@param", "int", "$state", "@param", "array", "$types", "@param", "int", "$batchSize", "@param", "array", "$parameters" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Entity/MessageManager.php#L204-L233
sonata-project/SonataNotificationBundle
src/Model/Message.php
Message.getValue
public function getValue($names, $default = null) { if (!\is_array($names)) { $names = [$names]; } $body = $this->getBody(); foreach ($names as $name) { if (!isset($body[$name])) { return $default; } $body = $body[$nam...
php
public function getValue($names, $default = null) { if (!\is_array($names)) { $names = [$names]; } $body = $this->getBody(); foreach ($names as $name) { if (!isset($body[$name])) { return $default; } $body = $body[$nam...
[ "public", "function", "getValue", "(", "$", "names", ",", "$", "default", "=", "null", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "names", ")", ")", "{", "$", "names", "=", "[", "$", "names", "]", ";", "}", "$", "body", "=", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Model/Message.php#L102-L118
sonata-project/SonataNotificationBundle
src/Model/Message.php
Message.getStateName
public function getStateName() { $list = self::getStateList(); return isset($list[$this->getState()]) ? $list[$this->getState()] : ''; }
php
public function getStateName() { $list = self::getStateList(); return isset($list[$this->getState()]) ? $list[$this->getState()] : ''; }
[ "public", "function", "getStateName", "(", ")", "{", "$", "list", "=", "self", "::", "getStateList", "(", ")", ";", "return", "isset", "(", "$", "list", "[", "$", "this", "->", "getState", "(", ")", "]", ")", "?", "$", "list", "[", "$", "this", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Model/Message.php#L265-L270
sonata-project/SonataNotificationBundle
src/Command/RestartCommand.php
RestartCommand.execute
public function execute(InputInterface $input, OutputInterface $output) { $output->writeln('<info>Starting... </info>'); if (!is_numeric($input->getOption('max-attempts'))) { throw new \Exception('Option "max-attempts" is invalid (integer value needed).'); } $pullMode =...
php
public function execute(InputInterface $input, OutputInterface $output) { $output->writeln('<info>Starting... </info>'); if (!is_numeric($input->getOption('max-attempts'))) { throw new \Exception('Option "max-attempts" is invalid (integer value needed).'); } $pullMode =...
[ "public", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "output", "->", "writeln", "(", "'<info>Starting... </info>'", ")", ";", "if", "(", "!", "is_numeric", "(", "$", "input", "->", "getOp...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Command/RestartCommand.php#L46-L106
sonata-project/SonataNotificationBundle
src/Event/DoctrineBackendOptimizeListener.php
DoctrineBackendOptimizeListener.iterate
public function iterate(IterateEvent $event) { if (!method_exists($event->getIterator(), 'isBufferEmpty')) { throw new \LogicException('You can\'t use DoctrineOptimizeListener with this iterator'); } if ($event->getIterator()->isBufferEmpty()) { $this->doctrine->getM...
php
public function iterate(IterateEvent $event) { if (!method_exists($event->getIterator(), 'isBufferEmpty')) { throw new \LogicException('You can\'t use DoctrineOptimizeListener with this iterator'); } if ($event->getIterator()->isBufferEmpty()) { $this->doctrine->getM...
[ "public", "function", "iterate", "(", "IterateEvent", "$", "event", ")", "{", "if", "(", "!", "method_exists", "(", "$", "event", "->", "getIterator", "(", ")", ",", "'isBufferEmpty'", ")", ")", "{", "throw", "new", "\\", "LogicException", "(", "'You can\\...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Event/DoctrineBackendOptimizeListener.php#L43-L52
sonata-project/SonataNotificationBundle
src/Backend/PostponeRuntimeBackend.php
PostponeRuntimeBackend.publish
public function publish(MessageInterface $message) { // if the message is generated from the cli the message is handled // directly as there is no kernel.terminate in cli if (!$this->postponeOnCli && $this->isCommandLineInterface()) { $this->handle($message, $this->dispatcher); ...
php
public function publish(MessageInterface $message) { // if the message is generated from the cli the message is handled // directly as there is no kernel.terminate in cli if (!$this->postponeOnCli && $this->isCommandLineInterface()) { $this->handle($message, $this->dispatcher); ...
[ "public", "function", "publish", "(", "MessageInterface", "$", "message", ")", "{", "// if the message is generated from the cli the message is handled", "// directly as there is no kernel.terminate in cli", "if", "(", "!", "$", "this", "->", "postponeOnCli", "&&", "$", "this...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/PostponeRuntimeBackend.php#L59-L70
sonata-project/SonataNotificationBundle
src/Backend/PostponeRuntimeBackend.php
PostponeRuntimeBackend.onEvent
public function onEvent(Event $event = null) { while (!empty($this->messages)) { $message = array_shift($this->messages); $this->handle($message, $this->dispatcher); } }
php
public function onEvent(Event $event = null) { while (!empty($this->messages)) { $message = array_shift($this->messages); $this->handle($message, $this->dispatcher); } }
[ "public", "function", "onEvent", "(", "Event", "$", "event", "=", "null", ")", "{", "while", "(", "!", "empty", "(", "$", "this", "->", "messages", ")", ")", "{", "$", "message", "=", "array_shift", "(", "$", "this", "->", "messages", ")", ";", "$"...
Listen on any event and handle the messages. Actually, an event is not necessary, you can call this method manually, to. The event is not processed in any way. @param Event|null $event
[ "Listen", "on", "any", "event", "and", "handle", "the", "messages", "." ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/PostponeRuntimeBackend.php#L80-L87
sonata-project/SonataNotificationBundle
src/Backend/MessageManagerBackendDispatcher.php
MessageManagerBackendDispatcher.getBackend
public function getBackend($type) { $default = null; if (!$type) { return $this->getDefaultBackend(); } foreach ($this->backends as $backend) { if (\in_array($type, $backend['types'], true)) { return $backend['backend']; } ...
php
public function getBackend($type) { $default = null; if (!$type) { return $this->getDefaultBackend(); } foreach ($this->backends as $backend) { if (\in_array($type, $backend['types'], true)) { return $backend['backend']; } ...
[ "public", "function", "getBackend", "(", "$", "type", ")", "{", "$", "default", "=", "null", ";", "if", "(", "!", "$", "type", ")", "{", "return", "$", "this", "->", "getDefaultBackend", "(", ")", ";", "}", "foreach", "(", "$", "this", "->", "backe...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Backend/MessageManagerBackendDispatcher.php#L64-L79
sonata-project/SonataNotificationBundle
src/Iterator/MessageManagerMessageIterator.php
MessageManagerMessageIterator.setCurrent
protected function setCurrent() { if (0 === \count($this->buffer)) { $this->bufferize($this->types); } $this->current = array_pop($this->buffer); }
php
protected function setCurrent() { if (0 === \count($this->buffer)) { $this->bufferize($this->types); } $this->current = array_pop($this->buffer); }
[ "protected", "function", "setCurrent", "(", ")", "{", "if", "(", "0", "===", "\\", "count", "(", "$", "this", "->", "buffer", ")", ")", "{", "$", "this", "->", "bufferize", "(", "$", "this", "->", "types", ")", ";", "}", "$", "this", "->", "curre...
Assign current pointer a message.
[ "Assign", "current", "pointer", "a", "message", "." ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Iterator/MessageManagerMessageIterator.php#L120-L127
sonata-project/SonataNotificationBundle
src/Iterator/MessageManagerMessageIterator.php
MessageManagerMessageIterator.bufferize
protected function bufferize($types = []) { while (true) { $this->buffer = $this->findNextMessages($types); if (\count($this->buffer) > 0) { break; } usleep($this->pause); } }
php
protected function bufferize($types = []) { while (true) { $this->buffer = $this->findNextMessages($types); if (\count($this->buffer) > 0) { break; } usleep($this->pause); } }
[ "protected", "function", "bufferize", "(", "$", "types", "=", "[", "]", ")", "{", "while", "(", "true", ")", "{", "$", "this", "->", "buffer", "=", "$", "this", "->", "findNextMessages", "(", "$", "types", ")", ";", "if", "(", "\\", "count", "(", ...
Fill the inner messages buffer. @param array $types
[ "Fill", "the", "inner", "messages", "buffer", "." ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Iterator/MessageManagerMessageIterator.php#L134-L145
sonata-project/SonataNotificationBundle
src/Iterator/MessageManagerMessageIterator.php
MessageManagerMessageIterator.findNextMessages
protected function findNextMessages($types) { return $this->messageManager->findByTypes($types, MessageInterface::STATE_OPEN, $this->batchSize); }
php
protected function findNextMessages($types) { return $this->messageManager->findByTypes($types, MessageInterface::STATE_OPEN, $this->batchSize); }
[ "protected", "function", "findNextMessages", "(", "$", "types", ")", "{", "return", "$", "this", "->", "messageManager", "->", "findByTypes", "(", "$", "types", ",", "MessageInterface", "::", "STATE_OPEN", ",", "$", "this", "->", "batchSize", ")", ";", "}" ]
Find open messages. @param array $types @return mixed
[ "Find", "open", "messages", "." ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Iterator/MessageManagerMessageIterator.php#L154-L157
sonata-project/SonataNotificationBundle
src/Consumer/SwiftMailerConsumer.php
SwiftMailerConsumer.process
public function process(ConsumerEvent $event) { if (!$this->mailer->getTransport()->isStarted()) { $this->mailer->getTransport()->start(); } $exception = false; try { $this->sendEmail($event->getMessage()); } catch (\Exception $e) { $exce...
php
public function process(ConsumerEvent $event) { if (!$this->mailer->getTransport()->isStarted()) { $this->mailer->getTransport()->start(); } $exception = false; try { $this->sendEmail($event->getMessage()); } catch (\Exception $e) { $exce...
[ "public", "function", "process", "(", "ConsumerEvent", "$", "event", ")", "{", "if", "(", "!", "$", "this", "->", "mailer", "->", "getTransport", "(", ")", "->", "isStarted", "(", ")", ")", "{", "$", "this", "->", "mailer", "->", "getTransport", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Consumer/SwiftMailerConsumer.php#L36-L55
sonata-project/SonataNotificationBundle
src/DependencyInjection/Configuration.php
Configuration.getConfigTreeBuilder
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('sonata_notification'); // Keep compatibility with symfony/config < 4.2 if (!method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->root('sonata_notification')->children(); } else { ...
php
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('sonata_notification'); // Keep compatibility with symfony/config < 4.2 if (!method_exists($treeBuilder, 'getRootNode')) { $rootNode = $treeBuilder->root('sonata_notification')->children(); } else { ...
[ "public", "function", "getConfigTreeBuilder", "(", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", "'sonata_notification'", ")", ";", "// Keep compatibility with symfony/config < 4.2", "if", "(", "!", "method_exists", "(", "$", "treeBuilder", ",", "'getR...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/DependencyInjection/Configuration.php#L27-L186
sonata-project/SonataNotificationBundle
src/Admin/MessageAdmin.php
MessageAdmin.configureListFields
protected function configureListFields(ListMapper $listMapper) { $listMapper ->addIdentifier('id', null, ['route' => ['name' => 'show']]) ->add('type') ->add('createdAt') ->add('startedAt') ->add('completedAt') ->add('getStateName') ...
php
protected function configureListFields(ListMapper $listMapper) { $listMapper ->addIdentifier('id', null, ['route' => ['name' => 'show']]) ->add('type') ->add('createdAt') ->add('startedAt') ->add('completedAt') ->add('getStateName') ...
[ "protected", "function", "configureListFields", "(", "ListMapper", "$", "listMapper", ")", "{", "$", "listMapper", "->", "addIdentifier", "(", "'id'", ",", "null", ",", "[", "'route'", "=>", "[", "'name'", "=>", "'show'", "]", "]", ")", "->", "add", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Admin/MessageAdmin.php#L80-L91
sonata-project/SonataNotificationBundle
src/Admin/MessageAdmin.php
MessageAdmin.configureDatagridFilters
protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $class = $this->getClass(); $datagridMapper ->add('type') ->add('state', null, [], ChoiceType::class, ['choices' => $class::getStateList()]) ; }
php
protected function configureDatagridFilters(DatagridMapper $datagridMapper) { $class = $this->getClass(); $datagridMapper ->add('type') ->add('state', null, [], ChoiceType::class, ['choices' => $class::getStateList()]) ; }
[ "protected", "function", "configureDatagridFilters", "(", "DatagridMapper", "$", "datagridMapper", ")", "{", "$", "class", "=", "$", "this", "->", "getClass", "(", ")", ";", "$", "datagridMapper", "->", "add", "(", "'type'", ")", "->", "add", "(", "'state'",...
{@inheritdoc}
[ "{" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Admin/MessageAdmin.php#L96-L104
sonata-project/SonataNotificationBundle
src/Iterator/ErroneousMessageIterator.php
ErroneousMessageIterator.findNextMessages
protected function findNextMessages($types) { return $this->messageManager->findByAttempts( $this->types, MessageInterface::STATE_ERROR, $this->batchSize, $this->maxAttempts, $this->attemptDelay ); }
php
protected function findNextMessages($types) { return $this->messageManager->findByAttempts( $this->types, MessageInterface::STATE_ERROR, $this->batchSize, $this->maxAttempts, $this->attemptDelay ); }
[ "protected", "function", "findNextMessages", "(", "$", "types", ")", "{", "return", "$", "this", "->", "messageManager", "->", "findByAttempts", "(", "$", "this", "->", "types", ",", "MessageInterface", "::", "STATE_ERROR", ",", "$", "this", "->", "batchSize",...
Find messages in error. @param $types @return mixed
[ "Find", "messages", "in", "error", "." ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Iterator/ErroneousMessageIterator.php#L54-L63
sonata-project/SonataNotificationBundle
src/Command/CreateAndPublishCommand.php
CreateAndPublishCommand.execute
public function execute(InputInterface $input, OutputInterface $output) { $type = $input->getArgument('type'); $body = json_decode($input->getArgument('body'), true); if (null === $body) { throw new \InvalidArgumentException('Body does not contain valid json.'); } ...
php
public function execute(InputInterface $input, OutputInterface $output) { $type = $input->getArgument('type'); $body = json_decode($input->getArgument('body'), true); if (null === $body) { throw new \InvalidArgumentException('Body does not contain valid json.'); } ...
[ "public", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "type", "=", "$", "input", "->", "getArgument", "(", "'type'", ")", ";", "$", "body", "=", "json_decode", "(", "$", "input", "->",...
{@inheritdoc} @param InputInterface $input @param OutputInterface $output
[ "{", "@inheritdoc", "}" ]
train
https://github.com/sonata-project/SonataNotificationBundle/blob/cee2d046ba355129c3d77751fd6c7dbeb2c80ec7/src/Command/CreateAndPublishCommand.php#L40-L55
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateInt
public static function validateInt($value, $reason = null, $alias = 'Parameter') { $type = gettype($value); if ($type === 'string') { if (is_numeric($value) && strpos($value, '.') === false) return $value; } elseif ($type === 'integer') { return $value...
php
public static function validateInt($value, $reason = null, $alias = 'Parameter') { $type = gettype($value); if ($type === 'string') { if (is_numeric($value) && strpos($value, '.') === false) return $value; } elseif ($type === 'integer') { return $value...
[ "public", "static", "function", "validateInt", "(", "$", "value", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "$", "type", "=", "gettype", "(", "$", "value", ")", ";", "if", "(", "$", "type", "===", "'string'", ...
region integer
[ "region", "integer" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L29-L45
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateIntNotIn
public static function validateIntNotIn($value, $valueList, $reason = null, $alias = 'Parameter') { if (is_array($valueList) === false || count($valueList) === 0) throw new ValidationException("“${alias}”参数的验证模版(IntNotIn:)格式错误, 必须提供可取值的列表"); $type = gettype($value); if ($type ==...
php
public static function validateIntNotIn($value, $valueList, $reason = null, $alias = 'Parameter') { if (is_array($valueList) === false || count($valueList) === 0) throw new ValidationException("“${alias}”参数的验证模版(IntNotIn:)格式错误, 必须提供可取值的列表"); $type = gettype($value); if ($type ==...
[ "public", "static", "function", "validateIntNotIn", "(", "$", "value", ",", "$", "valueList", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "if", "(", "is_array", "(", "$", "valueList", ")", "===", "false", "||", "co...
验证IntNotIn: “{{param}}”不能取这些值: {{valueList}} @param $value mixed 参数值 @param $valueList array 不可取的值的列表 @param $reason string|null 验证失败的错误提示字符串. 如果为null, 则自动生成 @param $alias string 参数别名, 用于错误提示 @return mixed @throws ValidationException
[ "验证IntNotIn", ":", "“", "{{", "param", "}}", "”不能取这些值", ":", "{{", "valueList", "}}" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L394-L427
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateFloat
public static function validateFloat($value, $reason = null, $alias = 'Parameter') { $type = gettype($value); if ($type === 'string') { if (is_numeric($value)) return $value; } elseif ($type === 'double' || $type === 'integer') return $value; ...
php
public static function validateFloat($value, $reason = null, $alias = 'Parameter') { $type = gettype($value); if ($type === 'string') { if (is_numeric($value)) return $value; } elseif ($type === 'double' || $type === 'integer') return $value; ...
[ "public", "static", "function", "validateFloat", "(", "$", "value", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "$", "type", "=", "gettype", "(", "$", "value", ")", ";", "if", "(", "$", "type", "===", "'string'",...
region float
[ "region", "float" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L433-L448
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateBool
public static function validateBool($value, $reason = null, $alias = 'Parameter') { if (is_bool($value)) { return $value; } else if (is_string($value)) { $valuelc = mb_strtolower($value); if ($valuelc === 'true' || $valuelc === 'false') return $val...
php
public static function validateBool($value, $reason = null, $alias = 'Parameter') { if (is_bool($value)) { return $value; } else if (is_string($value)) { $valuelc = mb_strtolower($value); if ($valuelc === 'true' || $valuelc === 'false') return $val...
[ "public", "static", "function", "validateBool", "(", "$", "value", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "if", "(", "is_bool", "(", "$", "value", ")", ")", "{", "return", "$", "value", ";", "}", "else", "...
region bool
[ "region", "bool" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L714-L730
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateStr
public static function validateStr($value, $reason = null, $alias = 'Parameter') { if (is_string($value)) { return $value; } if ($reason !== null) throw new ValidationException($reason); $error = self::getErrorTemplate('Str'); $error = str_replace('{...
php
public static function validateStr($value, $reason = null, $alias = 'Parameter') { if (is_string($value)) { return $value; } if ($reason !== null) throw new ValidationException($reason); $error = self::getErrorTemplate('Str'); $error = str_replace('{...
[ "public", "static", "function", "validateStr", "(", "$", "value", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "return", "$", "value", ";", "}", "if", "(...
region string
[ "region", "string" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L757-L769
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateStrNotIn
public static function validateStrNotIn($value, $valueList, $reason = null, $alias = 'Parameter') { if (is_array($valueList) === false || count($valueList) === 0) throw new ValidationException("“${alias}”参数的验证模版(StrNotIn:)格式错误, 必须提供不可取的值的列表"); if (is_string($value)) { if (!i...
php
public static function validateStrNotIn($value, $valueList, $reason = null, $alias = 'Parameter') { if (is_array($valueList) === false || count($valueList) === 0) throw new ValidationException("“${alias}”参数的验证模版(StrNotIn:)格式错误, 必须提供不可取的值的列表"); if (is_string($value)) { if (!i...
[ "public", "static", "function", "validateStrNotIn", "(", "$", "value", ",", "$", "valueList", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "if", "(", "is_array", "(", "$", "valueList", ")", "===", "false", "||", "co...
验证: “{{param}}”不能取这些值: {{valueList}} @param $value mixed 参数值 @param $valueList array 不可取的值的列表 @param $reason string|null 验证失败的错误提示字符串. 如果为null, 则自动生成 @param $alias string 参数别名, 用于错误提示 @return mixed @throws ValidationException
[ "验证", ":", "“", "{{", "param", "}}", "”不能取这些值", ":", "{{", "valueList", "}}" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L884-L912
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateStrEqI
public static function validateStrEqI($value, $equalsValue, $reason = null, $alias = 'Parameter') { if (is_string($value)) { if (strcasecmp($value, $equalsValue) === 0) return $value; $isTypeError = false; } else $isTypeError = true; if ($...
php
public static function validateStrEqI($value, $equalsValue, $reason = null, $alias = 'Parameter') { if (is_string($value)) { if (strcasecmp($value, $equalsValue) === 0) return $value; $isTypeError = false; } else $isTypeError = true; if ($...
[ "public", "static", "function", "validateStrEqI", "(", "$", "value", ",", "$", "equalsValue", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "if", "(", "strc...
验证: “{{param}}”必须等于 {{equalsValue}}(忽略大小写) @param $value string 参数值 @param $equalsValue string 比较值 @param $reason string|null 验证失败的错误提示字符串. 如果为null, 则自动生成 @param $alias string 参数别名, 用于错误提示 @return mixed @throws ValidationException
[ "验证", ":", "“", "{{", "param", "}}", "”必须等于", "{{", "equalsValue", "}}", "(忽略大小写)" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L923-L944
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateStrInI
public static function validateStrInI($value, $valueList, $reason = null, $alias = 'Parameter') { if (is_array($valueList) === false || count($valueList) === 0) throw new ValidationException("“${alias}”参数的验证模版(StrInI:)格式错误, 必须提供可取值的列表"); if (is_string($value)) { $lowerValue ...
php
public static function validateStrInI($value, $valueList, $reason = null, $alias = 'Parameter') { if (is_array($valueList) === false || count($valueList) === 0) throw new ValidationException("“${alias}”参数的验证模版(StrInI:)格式错误, 必须提供可取值的列表"); if (is_string($value)) { $lowerValue ...
[ "public", "static", "function", "validateStrInI", "(", "$", "value", ",", "$", "valueList", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "if", "(", "is_array", "(", "$", "valueList", ")", "===", "false", "||", "coun...
验证: “{{param}}”只能取这些值: {{valueList}}(忽略大小写) @param $value mixed 参数值 @param $valueList array 可取值的列表 @param $reason string|null 验证失败的错误提示字符串. 如果为null, 则自动生成 @param $alias string 参数别名, 用于错误提示 @return mixed @throws ValidationException
[ "验证", ":", "“", "{{", "param", "}}", "”只能取这些值", ":", "{{", "valueList", "}}", "(忽略大小写)" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L987-L1018
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateLetters
public static function validateLetters($value, $reason = null, $alias = 'Parameter') { if (is_string($value)) { if (preg_match('/^[a-zA-Z]+$/', $value) === 1) return $value; $isTypeError = false; } else $isTypeError = true; if ($reason !==...
php
public static function validateLetters($value, $reason = null, $alias = 'Parameter') { if (is_string($value)) { if (preg_match('/^[a-zA-Z]+$/', $value) === 1) return $value; $isTypeError = false; } else $isTypeError = true; if ($reason !==...
[ "public", "static", "function", "validateLetters", "(", "$", "value", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "if", "(", "preg_match", "(", "'/^[a-zA-Z]...
验证: “{{param}}”只能包含字母 @param $value mixed 参数值 @param $reason string|null 验证失败的错误提示字符串. 如果为null, 则自动生成 @param $alias string 参数别名, 用于错误提示 @return mixed @throws ValidationException
[ "验证", ":", "“", "{{", "param", "}}", "”只能包含字母" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L1268-L1288
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateNumeric
public static function validateNumeric($value, $reason = null, $alias = 'Parameter') { if (is_string($value)) { if (preg_match('/^\-?[0-9.]+$/', $value) === 1) { $count = 0; //小数点的个数 $i = 0; while (($i = strpos($value, '.', $i)) !== false) { ...
php
public static function validateNumeric($value, $reason = null, $alias = 'Parameter') { if (is_string($value)) { if (preg_match('/^\-?[0-9.]+$/', $value) === 1) { $count = 0; //小数点的个数 $i = 0; while (($i = strpos($value, '.', $i)) !== false) { ...
[ "public", "static", "function", "validateNumeric", "(", "$", "value", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "if", "(", "preg_match", "(", "'/^\\-?[0-9...
验证: “{{param}}”必须是数值 一般用于大数处理(超过double表示范围的数,一般会用字符串来表示) 如果是正常范围内的数, 可以使用'Int'或'Float'来检测 @param $value mixed 参数值 @param $reason string|null 验证失败的错误提示字符串. 如果为null, 则自动生成 @param $alias string 参数别名, 用于错误提示 @return mixed @throws ValidationException
[ "验证", ":", "“", "{{", "param", "}}", "”必须是数值", "一般用于大数处理(超过double表示范围的数", "一般会用字符串来表示)", "如果是正常范围内的数", "可以使用", "Int", "或", "Float", "来检测" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L1422-L1454
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateRegexp
public static function validateRegexp($value, $regexp, $reason = null, $alias = 'Parameter') { if (is_string($regexp) === false || $regexp === '') throw new ValidationException("“${alias}”参数的验证模版(Regexp:)格式错误, 没有提供正则表达式"); if (is_string($value)) { $result = @preg_match($rege...
php
public static function validateRegexp($value, $regexp, $reason = null, $alias = 'Parameter') { if (is_string($regexp) === false || $regexp === '') throw new ValidationException("“${alias}”参数的验证模版(Regexp:)格式错误, 没有提供正则表达式"); if (is_string($value)) { $result = @preg_match($rege...
[ "public", "static", "function", "validateRegexp", "(", "$", "value", ",", "$", "regexp", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "if", "(", "is_string", "(", "$", "regexp", ")", "===", "false", "||", "$", "re...
Perl正则表达式验证 @param $value string 参数值 @param $regexp string Perl正则表达式. 正则表达式内的特殊字符需要转义(包括/). 首尾无需加/ @param $reason null|string 原因(当不匹配时用于错误提示). 如果为null, 当不匹配时会提示 “${alias}”不匹配正则表达式$regexp @param $alias string 参数别名, 用于错误提示 @return mixed @throws ValidationException
[ "Perl正则表达式验证" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L1583-L1610
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateArr
public static function validateArr($value, $reason = null, $alias = 'Parameter') { if (is_array($value)) { $is = true; foreach ($value as $key => $val) { if (!is_integer($key)) { $is = false; break; } ...
php
public static function validateArr($value, $reason = null, $alias = 'Parameter') { if (is_array($value)) { $is = true; foreach ($value as $key => $val) { if (!is_integer($key)) { $is = false; break; } ...
[ "public", "static", "function", "validateArr", "(", "$", "value", ",", "$", "reason", "=", "null", ",", "$", "alias", "=", "'Parameter'", ")", "{", "if", "(", "is_array", "(", "$", "value", ")", ")", "{", "$", "is", "=", "true", ";", "foreach", "("...
region array
[ "region", "array" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L1616-L1636
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateIf
protected static function validateIf($value) { if (is_string($value)) $value = mb_strtolower($value); return in_array($value, [1, true, '1', 'true', 'yes', 'y'], true); }
php
protected static function validateIf($value) { if (is_string($value)) $value = mb_strtolower($value); return in_array($value, [1, true, '1', 'true', 'yes', 'y'], true); }
[ "protected", "static", "function", "validateIf", "(", "$", "value", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "$", "value", "=", "mb_strtolower", "(", "$", "value", ")", ";", "return", "in_array", "(", "$", "value", ",", "[", "1"...
region ifs
[ "region", "ifs" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L2401-L2406
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._compileValidator
private static function _compileValidator($validator, $alias) { if (is_string($validator) === false) throw new ValidationException("编译Validator失败: Validator必须是字符串");; if (strlen($validator) === 0) { return [ 'countOfIfs' => 0, 'required' => fal...
php
private static function _compileValidator($validator, $alias) { if (is_string($validator) === false) throw new ValidationException("编译Validator失败: Validator必须是字符串");; if (strlen($validator) === 0) { return [ 'countOfIfs' => 0, 'required' => fal...
[ "private", "static", "function", "_compileValidator", "(", "$", "validator", ",", "$", "alias", ")", "{", "if", "(", "is_string", "(", "$", "validator", ")", "===", "false", ")", "throw", "new", "ValidationException", "(", "\"编译Validator失败: Validator必须是字符串\");;", ...
将验证器(Validator)编译为验证子(Validator Unit)的数组 示例1: 输入: $validator = 'StrLen:6,16|regex:/^[a-zA-Z0-9]+$/' 输出: [ ['StrLen', 6, 16, null, $alias], ['regex', '/^[a-zA-Z0-9]+$/', null, $alias], ] 示例2(自定义验证失败的提示): 输入: $validator = 'StrLen:6,16|regex:/^[a-zA-Z0-9]+$/|>>>:参数验证失败了' 输出: [ 'countOfIfs' => 0, 'required' => false, 'un...
[ "将验证器", "(", "Validator", ")", "编译为验证子", "(", "Validator", "Unit", ")", "的数组" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L2940-L3255
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._parseIntArray
private static function _parseIntArray($value) { $vals = explode(',', $value); $ints = []; foreach ($vals as $val) { if (is_numeric($val) === false || strpos($val, '.') !== false) return false; // 检测到了非int $ints[] = intval($val); } if (...
php
private static function _parseIntArray($value) { $vals = explode(',', $value); $ints = []; foreach ($vals as $val) { if (is_numeric($val) === false || strpos($val, '.') !== false) return false; // 检测到了非int $ints[] = intval($val); } if (...
[ "private", "static", "function", "_parseIntArray", "(", "$", "value", ")", "{", "$", "vals", "=", "explode", "(", "','", ",", "$", "value", ")", ";", "$", "ints", "=", "[", "]", ";", "foreach", "(", "$", "vals", "as", "$", "val", ")", "{", "if", ...
将包含int数组的字符串转为int数组 @param $value @return int[]|bool 如果是合法的int数组, 并且至少有1个int, 返回int数组; 否则返回false
[ "将包含int数组的字符串转为int数组" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3275-L3287
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._parseStringArray
private static function _parseStringArray($value) { if (strlen($value)) { $vals = explode(',', $value); if ($vals === false) return false; // $vals = array_unique($vals); // 不需要去重, 不影响结果. 程序员不应该写出重复的字符串 } else $vals = ['']; if (c...
php
private static function _parseStringArray($value) { if (strlen($value)) { $vals = explode(',', $value); if ($vals === false) return false; // $vals = array_unique($vals); // 不需要去重, 不影响结果. 程序员不应该写出重复的字符串 } else $vals = ['']; if (c...
[ "private", "static", "function", "_parseStringArray", "(", "$", "value", ")", "{", "if", "(", "strlen", "(", "$", "value", ")", ")", "{", "$", "vals", "=", "explode", "(", "','", ",", "$", "value", ")", ";", "if", "(", "$", "vals", "===", "false", ...
将字符串转为字符串数组(逗号分隔) @param $value @return string[]|bool 如果至少有1个有效字符串, 返回字符串数组; 否则返回false
[ "将字符串转为字符串数组(逗号分隔)" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3294-L3306
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._parseDateString
private static function _parseDateString($value) { $result = @preg_match('/^\d\d\d\d-\d?\d-\d?\d$/', $value); if ($result !== 1) return null; $timestamp = strtotime($value); if ($timestamp === false) return null; return $timestamp; }
php
private static function _parseDateString($value) { $result = @preg_match('/^\d\d\d\d-\d?\d-\d?\d$/', $value); if ($result !== 1) return null; $timestamp = strtotime($value); if ($timestamp === false) return null; return $timestamp; }
[ "private", "static", "function", "_parseDateString", "(", "$", "value", ")", "{", "$", "result", "=", "@", "preg_match", "(", "'/^\\d\\d\\d\\d-\\d?\\d-\\d?\\d$/'", ",", "$", "value", ")", ";", "if", "(", "$", "result", "!==", "1", ")", "return", "null", ";...
解析日期字符串 @param $value string 日期字符串, 格式为YYYY-MM-DD @return int|null 时间戳. 日期格式错误返回null
[ "解析日期字符串" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3333-L3343
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._parseDateTimeString
private static function _parseDateTimeString($value) { $result = @preg_match('/^\d\d\d\d-\d?\d-\d?\d \d\d:\d\d:\d\d$/', $value); if ($result !== 1) return null; $timestamp = strtotime($value); if ($timestamp === false) return null; return $timestamp; ...
php
private static function _parseDateTimeString($value) { $result = @preg_match('/^\d\d\d\d-\d?\d-\d?\d \d\d:\d\d:\d\d$/', $value); if ($result !== 1) return null; $timestamp = strtotime($value); if ($timestamp === false) return null; return $timestamp; ...
[ "private", "static", "function", "_parseDateTimeString", "(", "$", "value", ")", "{", "$", "result", "=", "@", "preg_match", "(", "'/^\\d\\d\\d\\d-\\d?\\d-\\d?\\d \\d\\d:\\d\\d:\\d\\d$/'", ",", "$", "value", ")", ";", "if", "(", "$", "result", "!==", "1", ")", ...
解析日期时间字符串 @param $value string 日期字符串, 格式为YYYY-MM-DD HH:mm:ss @return int|null 时间戳. 日期时间格式错误返回null
[ "解析日期时间字符串" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3376-L3386
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._parseTwoDateTimeStrings
private static function _parseTwoDateTimeStrings($value) { $dateStrings = explode(',', $value); if (count($dateStrings) !== 2) return null; $timestamps = []; foreach ($dateStrings as $dateString) { $result = @preg_match('/^\d\d\d\d-\d?\d-\d?\d \d\d:\d\d:\d\d...
php
private static function _parseTwoDateTimeStrings($value) { $dateStrings = explode(',', $value); if (count($dateStrings) !== 2) return null; $timestamps = []; foreach ($dateStrings as $dateString) { $result = @preg_match('/^\d\d\d\d-\d?\d-\d?\d \d\d:\d\d:\d\d...
[ "private", "static", "function", "_parseTwoDateTimeStrings", "(", "$", "value", ")", "{", "$", "dateStrings", "=", "explode", "(", "','", ",", "$", "value", ")", ";", "if", "(", "count", "(", "$", "dateStrings", ")", "!==", "2", ")", "return", "null", ...
解析两个日期时间字符串 @param $value string 两个日期字符串, 以逗号‘,’分隔, 格式为YYYY-MM-DD HH:mm:ss,YYYY-MM-DD HH:mm:ss @return int[]|null 时间戳的数组. 日期时间格式错误返回null
[ "解析两个日期时间字符串" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3393-L3412
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._parseMimesArray
private static function _parseMimesArray($value) { $mimes = explode(',', $value); $strings = []; foreach ($mimes as $mime) { $mime = trim($mime); if (strlen($mime) === 0) continue; if (($pos = strpos($mime, '/')) === false) // 没有斜杠'/'. 例: ...
php
private static function _parseMimesArray($value) { $mimes = explode(',', $value); $strings = []; foreach ($mimes as $mime) { $mime = trim($mime); if (strlen($mime) === 0) continue; if (($pos = strpos($mime, '/')) === false) // 没有斜杠'/'. 例: ...
[ "private", "static", "function", "_parseMimesArray", "(", "$", "value", ")", "{", "$", "mimes", "=", "explode", "(", "','", ",", "$", "value", ")", ";", "$", "strings", "=", "[", "]", ";", "foreach", "(", "$", "mimes", "as", "$", "mime", ")", "{", ...
将Mimes字符串转为Mimes数组(逗号分隔) @param $value @return string[]|bool 如果至少有1个有效字符串, 返回字符串数组; 否则返回false @throws ValidationException
[ "将Mimes字符串转为Mimes数组(逗号分隔)" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3420-L3454
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._parseIfXxxWith1Param1Int
private static function _parseIfXxxWith1Param1Int($paramstr, $validatorName) { $params = explode(',', $paramstr); if (count($params) != 2) return false; $varName = $params[0]; $value = $params[1]; self::validateInt($value, "“$validatorName:${paramstr}”中“${varName...
php
private static function _parseIfXxxWith1Param1Int($paramstr, $validatorName) { $params = explode(',', $paramstr); if (count($params) != 2) return false; $varName = $params[0]; $value = $params[1]; self::validateInt($value, "“$validatorName:${paramstr}”中“${varName...
[ "private", "static", "function", "_parseIfXxxWith1Param1Int", "(", "$", "paramstr", ",", "$", "validatorName", ")", "{", "$", "params", "=", "explode", "(", "','", ",", "$", "paramstr", ")", ";", "if", "(", "count", "(", "$", "params", ")", "!=", "2", ...
解析 IfIntXx:varname,123 中的冒号后面的部分(1个条件参数后面带1个Int值) @param $paramstr string @param $validatorName string 条件验证子'IfIntXx' @return array|false 出错返回false, 否则返回 ['varname', 123] @throws ValidationException
[ "解析", "IfIntXx", ":", "varname", "123", "中的冒号后面的部分(1个条件参数后面带1个Int值)" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3463-L3473
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._parseIfXxxWith1Param1Str
private static function _parseIfXxxWith1Param1Str($paramstr, $validatorName) { $params = explode(',', $paramstr); if (count($params) != 2) return false; $varName = $params[0]; // $value = $params[1]; if (strlen($varName) == 0) // 简单检测 throw new Validat...
php
private static function _parseIfXxxWith1Param1Str($paramstr, $validatorName) { $params = explode(',', $paramstr); if (count($params) != 2) return false; $varName = $params[0]; // $value = $params[1]; if (strlen($varName) == 0) // 简单检测 throw new Validat...
[ "private", "static", "function", "_parseIfXxxWith1Param1Str", "(", "$", "paramstr", ",", "$", "validatorName", ")", "{", "$", "params", "=", "explode", "(", "','", ",", "$", "paramstr", ")", ";", "if", "(", "count", "(", "$", "params", ")", "!=", "2", ...
解析 IfStrXx:varname,abc 中的冒号后面的部分(1个条件参数后面带1个String值) @param $paramstr string @param $validatorName string 条件验证子'IfStrXx' @return array|false 出错返回false, 否则返回 ['varname', 'abc'] @throws ValidationException
[ "解析", "IfStrXx", ":", "varname", "abc", "中的冒号后面的部分(1个条件参数后面带1个String值)" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3482-L3493
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._parseIfXxxWith1ParamMultiStrings
private static function _parseIfXxxWith1ParamMultiStrings($paramstr, $validatorName) { $params = explode(',', $paramstr); $c = count($params); if ($c < 2) return false; $varName = $params[0]; $vals = []; for ($i = 1; $i < $c; $i++) { $vals[] =...
php
private static function _parseIfXxxWith1ParamMultiStrings($paramstr, $validatorName) { $params = explode(',', $paramstr); $c = count($params); if ($c < 2) return false; $varName = $params[0]; $vals = []; for ($i = 1; $i < $c; $i++) { $vals[] =...
[ "private", "static", "function", "_parseIfXxxWith1ParamMultiStrings", "(", "$", "paramstr", ",", "$", "validatorName", ")", "{", "$", "params", "=", "explode", "(", "','", ",", "$", "paramstr", ")", ";", "$", "c", "=", "count", "(", "$", "params", ")", "...
解析 IfStrXxx:varname,a,b,abc 中的冒号后面的部分(1个条件参数后面带多个字符串) @param $paramstr string @param $validatorName string 条件验证子'IfStrXxx' @return array|false 出错返回false, 否则返回 ['varname', ['a','b','abc']] @throws ValidationException
[ "解析", "IfStrXxx", ":", "varname", "a", "b", "abc", "中的冒号后面的部分(1个条件参数后面带多个字符串)" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3518-L3531
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._parseIfXxxWith1ParamMultiInts
private static function _parseIfXxxWith1ParamMultiInts($paramstr, $validatorName) { $params = explode(',', $paramstr); $c = count($params); if ($c < 2) return false; $varName = $params[0]; $vals = []; for ($i = 1; $i < $c; $i++) { $intVal = $p...
php
private static function _parseIfXxxWith1ParamMultiInts($paramstr, $validatorName) { $params = explode(',', $paramstr); $c = count($params); if ($c < 2) return false; $varName = $params[0]; $vals = []; for ($i = 1; $i < $c; $i++) { $intVal = $p...
[ "private", "static", "function", "_parseIfXxxWith1ParamMultiInts", "(", "$", "paramstr", ",", "$", "validatorName", ")", "{", "$", "params", "=", "explode", "(", "','", ",", "$", "paramstr", ")", ";", "$", "c", "=", "count", "(", "$", "params", ")", ";",...
解析 IfIntXxx:varname,1,2,3 中的冒号后面的部分(1个条件参数后面带多个整数) @param $paramstr string @param $validatorName string 条件验证子'IfIntXxx' @return array|false 出错返回false, 否则返回 ['varname', [1,2,3]] @throws ValidationException
[ "解析", "IfIntXxx", ":", "varname", "1", "2", "3", "中的冒号后面的部分(1个条件参数后面带多个整数)" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3540-L3555
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validateValue
public static function validateValue($value, $validator, $alias = 'Parameter', $ignoreRequired = false, $originParams = [], $siblings = []) { if (is_array($validator)) { $validators = $validator; } else if (is_string($validator)) { $validators = [$validator]; } else ...
php
public static function validateValue($value, $validator, $alias = 'Parameter', $ignoreRequired = false, $originParams = [], $siblings = []) { if (is_array($validator)) { $validators = $validator; } else if (is_string($validator)) { $validators = [$validator]; } else ...
[ "public", "static", "function", "validateValue", "(", "$", "value", ",", "$", "validator", ",", "$", "alias", "=", "'Parameter'", ",", "$", "ignoreRequired", "=", "false", ",", "$", "originParams", "=", "[", "]", ",", "$", "siblings", "=", "[", "]", ")...
验证一个值 @param $value mixed 要验证的值 @param $validator string|string[] 一条验证器, 例: 'StrLen:6,16|regex:/^[a-zA-Z0-9]+$/'; 或多条验证器的数组, 多条验证器之间是或的关系 @param string $alias 要验证的值的别名, 用于在验证不通过时生成提示字符串. @param $ignoreRequired bool 是否忽略所有的Required检测子 @param array $originParams 原始参数的数组 @param array $siblings 与当前要检测的参数同级的全部参数的数组 @return ...
[ "验证一个值" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3568-L3708
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation.validate
public static function validate($params, $validations, $ignoreRequired = false) { if (is_array($params) === false) throw new ValidationException(self::class . '::' . __FUNCTION__ . "(): \$params必须是数组"); $cachedKeyValues = []; foreach ($validations as $keypath => $validator) { ...
php
public static function validate($params, $validations, $ignoreRequired = false) { if (is_array($params) === false) throw new ValidationException(self::class . '::' . __FUNCTION__ . "(): \$params必须是数组"); $cachedKeyValues = []; foreach ($validations as $keypath => $validator) { ...
[ "public", "static", "function", "validate", "(", "$", "params", ",", "$", "validations", ",", "$", "ignoreRequired", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "params", ")", "===", "false", ")", "throw", "new", "ValidationException", "(", ...
验证输入参数 如果客户端通过HTTP协议要传递的参数的值是一个空Array或空Object, 实际上客户 端HTTP协议是会忽略这种参数的, 服务器接收到的参数数组中也就没有相应的参数. 举例, 如果客户端传了这样的参数: { "bookname": "hello,world!", "authors": [], "extra": {}, } 服务器接收到的实际上会是: { "bookname": "hello", } 没有authors和extra参数 @param $params array 包含输入参数的数组. 如['page'=>1,'pageSize'=>10] @param $validations array 包含验...
[ "验证输入参数" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3832-L3853
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._getValue
private static function _getValue($params, $keys, $keysCount, &$ancestorExist, $keyPrefix = '', &$cachedKeyValues = null) { $keyPath = $keyPrefix; $siblings = $params; $value = $params; if ($keysCount > 1) { // 查询缓存 if ($cachedKeyValues !== null) { ...
php
private static function _getValue($params, $keys, $keysCount, &$ancestorExist, $keyPrefix = '', &$cachedKeyValues = null) { $keyPath = $keyPrefix; $siblings = $params; $value = $params; if ($keysCount > 1) { // 查询缓存 if ($cachedKeyValues !== null) { ...
[ "private", "static", "function", "_getValue", "(", "$", "params", ",", "$", "keys", ",", "$", "keysCount", ",", "&", "$", "ancestorExist", ",", "$", "keyPrefix", "=", "''", ",", "&", "$", "cachedKeyValues", "=", "null", ")", "{", "$", "keyPath", "=", ...
根据路径从参数数组中取值. 可以用于Ifxxx中参数的取值 @param $params array @param $keys array @param $keysCount int @param $ancestorExist bool& @param string $keyPrefix @param $cachedKeyValues array&|null @return null|mixed @throws ValidationException
[ "根据路径从参数数组中取值", ".", "可以用于Ifxxx中参数的取值" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3866-L3981
photondragon/webgeeker-validation
src/Validation/Validation.php
Validation._validate
private static function _validate($params, $keys, $keysCount, $validator, $keyPrefix = '', $ignoreRequired = false, &$cachedKeyValues = null) { $keyPath = $keyPrefix; $siblings = $params; $value = $params; if ($keysCount > 1) { if ($cachedKeyValues !== null) { ...
php
private static function _validate($params, $keys, $keysCount, $validator, $keyPrefix = '', $ignoreRequired = false, &$cachedKeyValues = null) { $keyPath = $keyPrefix; $siblings = $params; $value = $params; if ($keysCount > 1) { if ($cachedKeyValues !== null) { ...
[ "private", "static", "function", "_validate", "(", "$", "params", ",", "$", "keys", ",", "$", "keysCount", ",", "$", "validator", ",", "$", "keyPrefix", "=", "''", ",", "$", "ignoreRequired", "=", "false", ",", "&", "$", "cachedKeyValues", "=", "null", ...
验证一条Validation @param $params array @param $keys array @param $keysCount int @param $validator string @param string $keyPrefix @param $cachedKeyValues array|null 缓存已取过的值. 存储格式为: ['key1' => val1, 'key2' => val2] @param $ignoreRequired bool 是否忽略所有的Required检测子 @throws ValidationException
[ "验证一条Validation" ]
train
https://github.com/photondragon/webgeeker-validation/blob/3bfc2b697ff526897c525af38c9e4ed4c889976d/src/Validation/Validation.php#L3994-L4092
nullivex/lib-array2xml
LSS/Array2XML.php
Array2XML.&
public static function &createXML($node_name, $arr = array()) { $xml = self::getXMLRoot(); $xml->appendChild(self::convert($node_name, $arr)); self::$xml = null; // clear the xml node in the class for 2nd time use. return $xml; }
php
public static function &createXML($node_name, $arr = array()) { $xml = self::getXMLRoot(); $xml->appendChild(self::convert($node_name, $arr)); self::$xml = null; // clear the xml node in the class for 2nd time use. return $xml; }
[ "public", "static", "function", "&", "createXML", "(", "$", "node_name", ",", "$", "arr", "=", "array", "(", ")", ")", "{", "$", "xml", "=", "self", "::", "getXMLRoot", "(", ")", ";", "$", "xml", "->", "appendChild", "(", "self", "::", "convert", "...
Convert an Array to XML @param string $node_name - name of the root node to be converted @param array $arr - aray to be converterd @return DomDocument
[ "Convert", "an", "Array", "to", "XML" ]
train
https://github.com/nullivex/lib-array2xml/blob/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90/LSS/Array2XML.php#L85-L91
nullivex/lib-array2xml
LSS/Array2XML.php
Array2XML.bool2str
private static function bool2str($v) { //convert boolean to text value. $v = $v === true ? 'true' : $v; $v = $v === false ? 'false' : $v; return $v; }
php
private static function bool2str($v) { //convert boolean to text value. $v = $v === true ? 'true' : $v; $v = $v === false ? 'false' : $v; return $v; }
[ "private", "static", "function", "bool2str", "(", "$", "v", ")", "{", "//convert boolean to text value.", "$", "v", "=", "$", "v", "===", "true", "?", "'true'", ":", "$", "v", ";", "$", "v", "=", "$", "v", "===", "false", "?", "'false'", ":", "$", ...
/* Get string representation of boolean value
[ "/", "*", "Get", "string", "representation", "of", "boolean", "value" ]
train
https://github.com/nullivex/lib-array2xml/blob/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90/LSS/Array2XML.php#L193-L198
yiisoft/yii-console
src/ErrorHandler.php
ErrorHandler.renderException
protected function renderException($exception) { if ($exception instanceof UnknownCommandException) { // display message and suggest alternatives in case of unknown command $message = $this->formatMessage($exception->getName() . ': ') . $exception->command; $alternatives ...
php
protected function renderException($exception) { if ($exception instanceof UnknownCommandException) { // display message and suggest alternatives in case of unknown command $message = $this->formatMessage($exception->getName() . ': ') . $exception->command; $alternatives ...
[ "protected", "function", "renderException", "(", "$", "exception", ")", "{", "if", "(", "$", "exception", "instanceof", "UnknownCommandException", ")", "{", "// display message and suggest alternatives in case of unknown command", "$", "message", "=", "$", "this", "->", ...
Renders an exception using ansi format for console output. @param \Exception $exception the exception to be rendered.
[ "Renders", "an", "exception", "using", "ansi", "format", "for", "console", "output", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/ErrorHandler.php#L30-L68
yiisoft/yii-console
src/ErrorHandler.php
ErrorHandler.formatMessage
protected function formatMessage($message, $format = [Console::FG_RED, Console::BOLD]) { $stream = (PHP_SAPI === 'cli') ? \STDERR : \STDOUT; // try controller first to allow check for --color switch if ($this->app->controller instanceof Controller && $this->app->controller->isColorEnabled($s...
php
protected function formatMessage($message, $format = [Console::FG_RED, Console::BOLD]) { $stream = (PHP_SAPI === 'cli') ? \STDERR : \STDOUT; // try controller first to allow check for --color switch if ($this->app->controller instanceof Controller && $this->app->controller->isColorEnabled($s...
[ "protected", "function", "formatMessage", "(", "$", "message", ",", "$", "format", "=", "[", "Console", "::", "FG_RED", ",", "Console", "::", "BOLD", "]", ")", "{", "$", "stream", "=", "(", "PHP_SAPI", "===", "'cli'", ")", "?", "\\", "STDERR", ":", "...
Colorizes a message for console output. @param string $message the message to colorize. @param array $format the message format. @return string the colorized message. @see Console::ansiFormat() for details on how to specify the message format.
[ "Colorizes", "a", "message", "for", "console", "output", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/ErrorHandler.php#L77-L87
yiisoft/yii-jquery
src/Validators/Client/RegularExpressionValidator.php
RegularExpressionValidator.getClientOptions
public function getClientOptions($validator, $model, $attribute) { $pattern = Html::escapeJsRegularExpression($validator->pattern); $options = [ 'pattern' => new JsExpression($pattern), 'not' => $validator->not, 'message' => $validator->formatMessage($validator->...
php
public function getClientOptions($validator, $model, $attribute) { $pattern = Html::escapeJsRegularExpression($validator->pattern); $options = [ 'pattern' => new JsExpression($pattern), 'not' => $validator->not, 'message' => $validator->formatMessage($validator->...
[ "public", "function", "getClientOptions", "(", "$", "validator", ",", "$", "model", ",", "$", "attribute", ")", "{", "$", "pattern", "=", "Html", "::", "escapeJsRegularExpression", "(", "$", "validator", "->", "pattern", ")", ";", "$", "options", "=", "[",...
Returns the client-side validation options. @param \yii\validators\RegularExpressionValidator $validator the server-side validator. @param \yii\base\Model $model the model being validated @param string $attribute the attribute name being validated @return array the client-side validation options
[ "Returns", "the", "client", "-", "side", "validation", "options", "." ]
train
https://github.com/yiisoft/yii-jquery/blob/1c257928cba2b46d267e90771652abe2b0e2cfcb/src/Validators/Client/RegularExpressionValidator.php#L44-L60
yiisoft/yii-console
src/Controllers/FixtureController.php
FixtureController.actionLoad
public function actionLoad(array $fixturesInput = []) { if ($fixturesInput === []) { $this->stdout($this->getHelpSummary() . "\n"); $helpCommand = Console::ansiFormat('yii help fixture', [Console::FG_CYAN]); $this->stdout("Use $helpCommand to get usage info.\n"); ...
php
public function actionLoad(array $fixturesInput = []) { if ($fixturesInput === []) { $this->stdout($this->getHelpSummary() . "\n"); $helpCommand = Console::ansiFormat('yii help fixture', [Console::FG_CYAN]); $this->stdout("Use $helpCommand to get usage info.\n"); ...
[ "public", "function", "actionLoad", "(", "array", "$", "fixturesInput", "=", "[", "]", ")", "{", "if", "(", "$", "fixturesInput", "===", "[", "]", ")", "{", "$", "this", "->", "stdout", "(", "$", "this", "->", "getHelpSummary", "(", ")", ".", "\"\\n\...
Loads the specified fixture data. For example, ``` # load the fixture data specified by User and UserProfile. # any existing fixture data will be removed first yii fixture/load "User, UserProfile" # load all available fixtures found under 'tests\unit\fixtures' yii fixture/load "*" # load all fixtures except User an...
[ "Loads", "the", "specified", "fixture", "data", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/FixtureController.php#L109-L167
yiisoft/yii-console
src/Controllers/FixtureController.php
FixtureController.actionUnload
public function actionUnload(array $fixturesInput = []) { $filtered = $this->filterFixtures($fixturesInput); $except = $filtered['except']; if (!$this->needToApplyAll($fixturesInput[0])) { $fixtures = $filtered['apply']; $foundFixtures = $this->findFixtures($fixture...
php
public function actionUnload(array $fixturesInput = []) { $filtered = $this->filterFixtures($fixturesInput); $except = $filtered['except']; if (!$this->needToApplyAll($fixturesInput[0])) { $fixtures = $filtered['apply']; $foundFixtures = $this->findFixtures($fixture...
[ "public", "function", "actionUnload", "(", "array", "$", "fixturesInput", "=", "[", "]", ")", "{", "$", "filtered", "=", "$", "this", "->", "filterFixtures", "(", "$", "fixturesInput", ")", ";", "$", "except", "=", "$", "filtered", "[", "'except'", "]", ...
Unloads the specified fixtures. For example, ``` # unload the fixture data specified by User and UserProfile. yii fixture/unload "User, UserProfile" # unload all fixtures found under 'tests\unit\fixtures' yii fixture/unload "*" # unload all fixtures except User and UserProfile yii fixture/unload "*, -User, -UserPro...
[ "Unloads", "the", "specified", "fixtures", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/FixtureController.php#L189-L233
yiisoft/yii-console
src/Controllers/FixtureController.php
FixtureController.getFixturePath
private function getFixturePath() { try { return $this->app->getAlias('@' . str_replace('\\', '/', $this->namespace)); } catch (InvalidArgumentException $e) { throw new InvalidConfigException('Invalid fixture namespace: "' . $this->namespace . '". Please, check your FixtureCo...
php
private function getFixturePath() { try { return $this->app->getAlias('@' . str_replace('\\', '/', $this->namespace)); } catch (InvalidArgumentException $e) { throw new InvalidConfigException('Invalid fixture namespace: "' . $this->namespace . '". Please, check your FixtureCo...
[ "private", "function", "getFixturePath", "(", ")", "{", "try", "{", "return", "$", "this", "->", "app", "->", "getAlias", "(", "'@'", ".", "str_replace", "(", "'\\\\'", ",", "'/'", ",", "$", "this", "->", "namespace", ")", ")", ";", "}", "catch", "("...
Returns fixture path that determined on fixtures namespace. @throws InvalidConfigException if fixture namespace is invalid @return string fixture path
[ "Returns", "fixture", "path", "that", "determined", "on", "fixtures", "namespace", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/FixtureController.php#L514-L521
yiisoft/yii-console
src/Controllers/CacheController.php
CacheController.actionIndex
public function actionIndex() { $caches = $this->findCaches(); if (!empty($caches)) { $this->notifyCachesCanBeCleared($caches); } else { $this->notifyNoCachesFound(); } }
php
public function actionIndex() { $caches = $this->findCaches(); if (!empty($caches)) { $this->notifyCachesCanBeCleared($caches); } else { $this->notifyNoCachesFound(); } }
[ "public", "function", "actionIndex", "(", ")", "{", "$", "caches", "=", "$", "this", "->", "findCaches", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "caches", ")", ")", "{", "$", "this", "->", "notifyCachesCanBeCleared", "(", "$", "caches", ")"...
Lists the caches that can be cleared.
[ "Lists", "the", "caches", "that", "can", "be", "cleared", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/CacheController.php#L53-L62
yiisoft/yii-console
src/Controllers/CacheController.php
CacheController.actionClear
public function actionClear() { $cachesInput = func_get_args(); if (empty($cachesInput)) { throw new Exception('You should specify cache components names'); } $caches = $this->findCaches($cachesInput); $cachesInfo = []; $foundCaches = array_keys($caches...
php
public function actionClear() { $cachesInput = func_get_args(); if (empty($cachesInput)) { throw new Exception('You should specify cache components names'); } $caches = $this->findCaches($cachesInput); $cachesInfo = []; $foundCaches = array_keys($caches...
[ "public", "function", "actionClear", "(", ")", "{", "$", "cachesInput", "=", "func_get_args", "(", ")", ";", "if", "(", "empty", "(", "$", "cachesInput", ")", ")", "{", "throw", "new", "Exception", "(", "'You should specify cache components names'", ")", ";", ...
Clears given cache components. For example, ``` # clears caches specified by their id: "first", "second", "third" yii cache/clear first second third ```
[ "Clears", "given", "cache", "components", ".", "For", "example" ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/CacheController.php#L73-L109
yiisoft/yii-console
src/Controllers/CacheController.php
CacheController.actionClearAll
public function actionClearAll() { $caches = $this->findCaches(); $cachesInfo = []; if (empty($caches)) { $this->notifyNoCachesFound(); return ExitCode::OK; } foreach ($caches as $name => $class) { $cachesInfo[] = [ 'name'...
php
public function actionClearAll() { $caches = $this->findCaches(); $cachesInfo = []; if (empty($caches)) { $this->notifyNoCachesFound(); return ExitCode::OK; } foreach ($caches as $name => $class) { $cachesInfo[] = [ 'name'...
[ "public", "function", "actionClearAll", "(", ")", "{", "$", "caches", "=", "$", "this", "->", "findCaches", "(", ")", ";", "$", "cachesInfo", "=", "[", "]", ";", "if", "(", "empty", "(", "$", "caches", ")", ")", "{", "$", "this", "->", "notifyNoCac...
Flushes all caches registered in the system.
[ "Flushes", "all", "caches", "registered", "in", "the", "system", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/CacheController.php#L114-L133
yiisoft/yii-console
src/Controllers/CacheController.php
CacheController.actionClearSchema
public function actionClearSchema($db = 'db') { $connection = $this->app->get($db, false); if ($connection === null) { $this->stdout("Unknown component \"$db\".\n", Console::FG_RED); return ExitCode::UNSPECIFIED_ERROR; } if (!$connection instanceof \Yiisoft\D...
php
public function actionClearSchema($db = 'db') { $connection = $this->app->get($db, false); if ($connection === null) { $this->stdout("Unknown component \"$db\".\n", Console::FG_RED); return ExitCode::UNSPECIFIED_ERROR; } if (!$connection instanceof \Yiisoft\D...
[ "public", "function", "actionClearSchema", "(", "$", "db", "=", "'db'", ")", "{", "$", "connection", "=", "$", "this", "->", "app", "->", "get", "(", "$", "db", ",", "false", ")", ";", "if", "(", "$", "connection", "===", "null", ")", "{", "$", "...
Clears DB schema cache for a given connection component. ``` # clears cache schema specified by component id: "db" yii cache/clear-schema db ``` @param string $db id connection component @return int exit code @throws Exception @throws \yii\exceptions\InvalidConfigException @since 2.0.1
[ "Clears", "DB", "schema", "cache", "for", "a", "given", "connection", "component", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/CacheController.php#L150-L172
yiisoft/yii-console
src/Controllers/CacheController.php
CacheController.notifyCachesCanBeCleared
private function notifyCachesCanBeCleared($caches) { $this->stdout("The following caches were found in the system:\n\n", Console::FG_YELLOW); foreach ($caches as $name => $class) { if ($this->canBeCleared($class)) { $this->stdout("\t* $name ($class)\n", Console::FG_GREEN...
php
private function notifyCachesCanBeCleared($caches) { $this->stdout("The following caches were found in the system:\n\n", Console::FG_YELLOW); foreach ($caches as $name => $class) { if ($this->canBeCleared($class)) { $this->stdout("\t* $name ($class)\n", Console::FG_GREEN...
[ "private", "function", "notifyCachesCanBeCleared", "(", "$", "caches", ")", "{", "$", "this", "->", "stdout", "(", "\"The following caches were found in the system:\\n\\n\"", ",", "Console", "::", "FG_YELLOW", ")", ";", "foreach", "(", "$", "caches", "as", "$", "n...
Notifies user that given caches are found and can be flushed. @param array $caches array of cache component classes
[ "Notifies", "user", "that", "given", "caches", "are", "found", "and", "can", "be", "flushed", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/CacheController.php#L178-L191
yiisoft/yii-console
src/Controllers/CacheController.php
CacheController.confirmClear
private function confirmClear($cachesNames) { $this->stdout("The following cache components will be flushed:\n\n", Console::FG_YELLOW); foreach ($cachesNames as $name) { $this->stdout("\t* $name \n", Console::FG_GREEN); } return $this->confirm("\nFlush above cache compo...
php
private function confirmClear($cachesNames) { $this->stdout("The following cache components will be flushed:\n\n", Console::FG_YELLOW); foreach ($cachesNames as $name) { $this->stdout("\t* $name \n", Console::FG_GREEN); } return $this->confirm("\nFlush above cache compo...
[ "private", "function", "confirmClear", "(", "$", "cachesNames", ")", "{", "$", "this", "->", "stdout", "(", "\"The following cache components will be flushed:\\n\\n\"", ",", "Console", "::", "FG_YELLOW", ")", ";", "foreach", "(", "$", "cachesNames", "as", "$", "na...
Prompts user with confirmation if caches should be cleared. @param array $cachesNames @return bool
[ "Prompts", "user", "with", "confirmation", "if", "caches", "should", "be", "cleared", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/CacheController.php#L241-L250
yiisoft/yii-jquery
src/Validators/Client/CaptchaClientValidator.php
CaptchaClientValidator.getClientOptions
public function getClientOptions($validator, $model, $attribute) { $captcha = $validator->createCaptchaAction(); $code = $captcha->getVerifyCode(false); $hash = $captcha->generateValidationHash($validator->caseSensitive ? $code : strtolower($code)); $options = [ 'hash' =>...
php
public function getClientOptions($validator, $model, $attribute) { $captcha = $validator->createCaptchaAction(); $code = $captcha->getVerifyCode(false); $hash = $captcha->generateValidationHash($validator->caseSensitive ? $code : strtolower($code)); $options = [ 'hash' =>...
[ "public", "function", "getClientOptions", "(", "$", "validator", ",", "$", "model", ",", "$", "attribute", ")", "{", "$", "captcha", "=", "$", "validator", "->", "createCaptchaAction", "(", ")", ";", "$", "code", "=", "$", "captcha", "->", "getVerifyCode",...
Returns the client-side validation options. @param \Yiisoft\Yii\Captcha\CaptchaValidator $validator the server-side validator. @param \yii\base\Model $model the model being validated @param string $attribute the attribute name being validated @return array the client-side validation options
[ "Returns", "the", "client", "-", "side", "validation", "options", "." ]
train
https://github.com/yiisoft/yii-jquery/blob/1c257928cba2b46d267e90771652abe2b0e2cfcb/src/Validators/Client/CaptchaClientValidator.php#L41-L59
yiisoft/yii-jquery
src/ActiveFormClientScript.php
ActiveFormClientScript.defaultClientValidatorMap
protected function defaultClientValidatorMap() { return [ \yii\validators\BooleanValidator::class => \Yiisoft\Yii\JQuery\Validators\Client\BooleanValidator::class, \yii\validators\CompareValidator::class => \Yiisoft\Yii\JQuery\Validators\Client\CompareValidator::class, \y...
php
protected function defaultClientValidatorMap() { return [ \yii\validators\BooleanValidator::class => \Yiisoft\Yii\JQuery\Validators\Client\BooleanValidator::class, \yii\validators\CompareValidator::class => \Yiisoft\Yii\JQuery\Validators\Client\CompareValidator::class, \y...
[ "protected", "function", "defaultClientValidatorMap", "(", ")", "{", "return", "[", "\\", "yii", "\\", "validators", "\\", "BooleanValidator", "::", "class", "=>", "\\", "Yiisoft", "\\", "Yii", "\\", "JQuery", "\\", "Validators", "\\", "Client", "\\", "Boolean...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii-jquery/blob/1c257928cba2b46d267e90771652abe2b0e2cfcb/src/ActiveFormClientScript.php#L41-L59
yiisoft/yii-jquery
src/ActiveFormClientScript.php
ActiveFormClientScript.getFieldClientOptions
protected function getFieldClientOptions($field) { $options = parent::getFieldClientOptions($field); // only get the options that are different from the default ones (set in yii.activeForm.js) return array_diff_assoc($options, [ 'validateOnChange' => true, 'validateO...
php
protected function getFieldClientOptions($field) { $options = parent::getFieldClientOptions($field); // only get the options that are different from the default ones (set in yii.activeForm.js) return array_diff_assoc($options, [ 'validateOnChange' => true, 'validateO...
[ "protected", "function", "getFieldClientOptions", "(", "$", "field", ")", "{", "$", "options", "=", "parent", "::", "getFieldClientOptions", "(", "$", "field", ")", ";", "// only get the options that are different from the default ones (set in yii.activeForm.js)", "return", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii-jquery/blob/1c257928cba2b46d267e90771652abe2b0e2cfcb/src/ActiveFormClientScript.php#L77-L91
yiisoft/yii-jquery
src/ActiveFormClientScript.php
ActiveFormClientScript.getClientOptions
protected function getClientOptions() { $options = parent::getClientOptions(); // only get the options that are different from the default ones (set in yii.activeForm.js) return array_diff_assoc($options, [ 'encodeErrorSummary' => true, 'errorSummary' => '.error-summ...
php
protected function getClientOptions() { $options = parent::getClientOptions(); // only get the options that are different from the default ones (set in yii.activeForm.js) return array_diff_assoc($options, [ 'encodeErrorSummary' => true, 'errorSummary' => '.error-summ...
[ "protected", "function", "getClientOptions", "(", ")", "{", "$", "options", "=", "parent", "::", "getClientOptions", "(", ")", ";", "// only get the options that are different from the default ones (set in yii.activeForm.js)", "return", "array_diff_assoc", "(", "$", "options"...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii-jquery/blob/1c257928cba2b46d267e90771652abe2b0e2cfcb/src/ActiveFormClientScript.php#L96-L114
yiisoft/yii-jquery
src/Validators/Client/NumberValidator.php
NumberValidator.getClientOptions
public function getClientOptions($validator, $model, $attribute) { $label = $model->getAttributeLabel($attribute); $options = [ 'pattern' => new JsExpression($validator->integerOnly ? $validator->integerPattern : $validator->numberPattern), 'message' => $validator->formatMes...
php
public function getClientOptions($validator, $model, $attribute) { $label = $model->getAttributeLabel($attribute); $options = [ 'pattern' => new JsExpression($validator->integerOnly ? $validator->integerPattern : $validator->numberPattern), 'message' => $validator->formatMes...
[ "public", "function", "getClientOptions", "(", "$", "validator", ",", "$", "model", ",", "$", "attribute", ")", "{", "$", "label", "=", "$", "model", "->", "getAttributeLabel", "(", "$", "attribute", ")", ";", "$", "options", "=", "[", "'pattern'", "=>",...
Returns the client-side validation options. @param \yii\validators\NumberValidator $validator the server-side validator. @param \yii\base\Model $model the model being validated @param string $attribute the attribute name being validated @return array the client-side validation options
[ "Returns", "the", "client", "-", "side", "validation", "options", "." ]
train
https://github.com/yiisoft/yii-jquery/blob/1c257928cba2b46d267e90771652abe2b0e2cfcb/src/Validators/Client/NumberValidator.php#L43-L77
yiisoft/yii-console
src/Controllers/ServeController.php
ServeController.actionIndex
public function actionIndex($address = 'localhost') { $documentRoot = $this->app->getAlias($this->docroot); if (strpos($address, ':') === false) { $address = $address . ':' . $this->port; } if (!is_dir($documentRoot)) { $this->stdout("Document root \"$docume...
php
public function actionIndex($address = 'localhost') { $documentRoot = $this->app->getAlias($this->docroot); if (strpos($address, ':') === false) { $address = $address . ':' . $this->port; } if (!is_dir($documentRoot)) { $this->stdout("Document root \"$docume...
[ "public", "function", "actionIndex", "(", "$", "address", "=", "'localhost'", ")", "{", "$", "documentRoot", "=", "$", "this", "->", "app", "->", "getAlias", "(", "$", "this", "->", "docroot", ")", ";", "if", "(", "strpos", "(", "$", "address", ",", ...
Runs PHP built-in web server. @param string $address address to serve on. Either "host" or "host:port". @return int
[ "Runs", "PHP", "built", "-", "in", "web", "server", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/ServeController.php#L51-L82
yiisoft/yii-jquery
src/Validators/Client/IpValidator.php
IpValidator.build
public function build($validator, $model, $attribute, $view) { ValidationAsset::register($view); $options = $this->getClientOptions($validator, $model, $attribute); return 'yii.validation.ip(value, messages, ' . Json::htmlEncode($options) . ');'; }
php
public function build($validator, $model, $attribute, $view) { ValidationAsset::register($view); $options = $this->getClientOptions($validator, $model, $attribute); return 'yii.validation.ip(value, messages, ' . Json::htmlEncode($options) . ');'; }
[ "public", "function", "build", "(", "$", "validator", ",", "$", "model", ",", "$", "attribute", ",", "$", "view", ")", "{", "ValidationAsset", "::", "register", "(", "$", "view", ")", ";", "$", "options", "=", "$", "this", "->", "getClientOptions", "("...
{@inheritdoc}
[ "{" ]
train
https://github.com/yiisoft/yii-jquery/blob/1c257928cba2b46d267e90771652abe2b0e2cfcb/src/Validators/Client/IpValidator.php#L31-L36
yiisoft/yii-jquery
src/Validators/Client/IpValidator.php
IpValidator.getClientOptions
public function getClientOptions($validator, $model, $attribute) { $messages = [ 'ipv6NotAllowed' => $validator->ipv6NotAllowed, 'ipv4NotAllowed' => $validator->ipv4NotAllowed, 'message' => $validator->message, 'noSubnet' => $validator->noSubnet, '...
php
public function getClientOptions($validator, $model, $attribute) { $messages = [ 'ipv6NotAllowed' => $validator->ipv6NotAllowed, 'ipv4NotAllowed' => $validator->ipv4NotAllowed, 'message' => $validator->message, 'noSubnet' => $validator->noSubnet, '...
[ "public", "function", "getClientOptions", "(", "$", "validator", ",", "$", "model", ",", "$", "attribute", ")", "{", "$", "messages", "=", "[", "'ipv6NotAllowed'", "=>", "$", "validator", "->", "ipv6NotAllowed", ",", "'ipv4NotAllowed'", "=>", "$", "validator",...
Returns the client-side validation options. @param \yii\validators\IpValidator $validator the server-side validator. @param \yii\base\Model $model the model being validated @param string $attribute the attribute name being validated @return array the client-side validation options
[ "Returns", "the", "client", "-", "side", "validation", "options", "." ]
train
https://github.com/yiisoft/yii-jquery/blob/1c257928cba2b46d267e90771652abe2b0e2cfcb/src/Validators/Client/IpValidator.php#L45-L75
yiisoft/yii-jquery
src/Validators/Client/RequiredValidator.php
RequiredValidator.getClientOptions
public function getClientOptions($validator, $model, $attribute) { $options = []; if ($validator->requiredValue !== null) { $options['message'] = $validator->formatMessage($validator->message, [ 'requiredValue' => $validator->requiredValue, ]); $op...
php
public function getClientOptions($validator, $model, $attribute) { $options = []; if ($validator->requiredValue !== null) { $options['message'] = $validator->formatMessage($validator->message, [ 'requiredValue' => $validator->requiredValue, ]); $op...
[ "public", "function", "getClientOptions", "(", "$", "validator", ",", "$", "model", ",", "$", "attribute", ")", "{", "$", "options", "=", "[", "]", ";", "if", "(", "$", "validator", "->", "requiredValue", "!==", "null", ")", "{", "$", "options", "[", ...
Returns the client-side validation options. @param \yii\validators\RequiredValidator $validator the server-side validator. @param \yii\base\Model $model the model being validated @param string $attribute the attribute name being validated @return array the client-side validation options
[ "Returns", "the", "client", "-", "side", "validation", "options", "." ]
train
https://github.com/yiisoft/yii-jquery/blob/1c257928cba2b46d267e90771652abe2b0e2cfcb/src/Validators/Client/RequiredValidator.php#L41-L61
yiisoft/yii-console
src/Controllers/AssetController.php
AssetController.getAssetManager
public function getAssetManager() { if (!is_object($this->_assetManager)) { $options = $this->_assetManager; if (empty($options['__class'])) { $options['__class'] = AssetManager::class; } if (!isset($options['basePath'])) { thro...
php
public function getAssetManager() { if (!is_object($this->_assetManager)) { $options = $this->_assetManager; if (empty($options['__class'])) { $options['__class'] = AssetManager::class; } if (!isset($options['basePath'])) { thro...
[ "public", "function", "getAssetManager", "(", ")", "{", "if", "(", "!", "is_object", "(", "$", "this", "->", "_assetManager", ")", ")", "{", "$", "options", "=", "$", "this", "->", "_assetManager", ";", "if", "(", "empty", "(", "$", "options", "[", "...
Returns the asset manager instance. @throws Exception on invalid configuration. @return AssetManager asset manager instance.
[ "Returns", "the", "asset", "manager", "instance", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/AssetController.php#L145-L167
yiisoft/yii-console
src/Controllers/AssetController.php
AssetController.loadTargets
protected function loadTargets($targets, $bundles) { // build the dependency order of bundles $registered = []; foreach ($bundles as $name => $bundle) { $this->registerBundle($bundles, $name, $registered); } $bundleOrders = array_combine(array_keys($registered), r...
php
protected function loadTargets($targets, $bundles) { // build the dependency order of bundles $registered = []; foreach ($bundles as $name => $bundle) { $this->registerBundle($bundles, $name, $registered); } $bundleOrders = array_combine(array_keys($registered), r...
[ "protected", "function", "loadTargets", "(", "$", "targets", ",", "$", "bundles", ")", "{", "// build the dependency order of bundles", "$", "registered", "=", "[", "]", ";", "foreach", "(", "$", "bundles", "as", "$", "name", "=>", "$", "bundle", ")", "{", ...
Creates full list of output asset bundles. @param array $targets output asset bundles configuration. @param \yii\web\AssetBundle[] $bundles list of source asset bundles. @return \yii\web\AssetBundle[] list of output asset bundles. @throws Exception on failure.
[ "Creates", "full", "list", "of", "output", "asset", "bundles", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/AssetController.php#L282-L337
yiisoft/yii-console
src/Controllers/AssetController.php
AssetController.saveTargets
protected function saveTargets($targets, $bundleFile) { $array = []; foreach ($targets as $name => $target) { if (isset($this->targets[$name])) { $array[$name] = array_merge($this->targets[$name], [ '__class' => get_class($target), ...
php
protected function saveTargets($targets, $bundleFile) { $array = []; foreach ($targets as $name => $target) { if (isset($this->targets[$name])) { $array[$name] = array_merge($this->targets[$name], [ '__class' => get_class($target), ...
[ "protected", "function", "saveTargets", "(", "$", "targets", ",", "$", "bundleFile", ")", "{", "$", "array", "=", "[", "]", ";", "foreach", "(", "$", "targets", "as", "$", "name", "=>", "$", "target", ")", "{", "if", "(", "isset", "(", "$", "this",...
Saves new asset bundles configuration. @param \yii\web\AssetBundle[] $targets list of asset bundles to be saved. @param string $bundleFile output file name. @throws Exception on failure.
[ "Saves", "new", "asset", "bundles", "configuration", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/AssetController.php#L460-L502
yiisoft/yii-console
src/Controllers/AssetController.php
AssetController.actionTemplate
public function actionTemplate($configFile) { $jsCompressor = VarDumper::export($this->jsCompressor); $cssCompressor = VarDumper::export($this->cssCompressor); $template = <<<EOD <?php /** * Configuration file for the "yii asset" console command. */ // In the console environment, some pa...
php
public function actionTemplate($configFile) { $jsCompressor = VarDumper::export($this->jsCompressor); $cssCompressor = VarDumper::export($this->cssCompressor); $template = <<<EOD <?php /** * Configuration file for the "yii asset" console command. */ // In the console environment, some pa...
[ "public", "function", "actionTemplate", "(", "$", "configFile", ")", "{", "$", "jsCompressor", "=", "VarDumper", "::", "export", "(", "$", "this", "->", "jsCompressor", ")", ";", "$", "cssCompressor", "=", "VarDumper", "::", "export", "(", "$", "this", "->...
Creates template of configuration file for [[actionCompress]]. @param string $configFile output file name. @return int CLI exit code @throws Exception on failure.
[ "Creates", "template", "of", "configuration", "file", "for", "[[", "actionCompress", "]]", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controllers/AssetController.php#L692-L748
yiisoft/yii-console
src/Controller.php
Controller.getActionOptionsHelp
public function getActionOptionsHelp($action) { $optionNames = $this->options($action->id); if (empty($optionNames)) { return []; } $class = new \ReflectionClass($this); $options = []; foreach ($class->getProperties() as $property) { $name = $...
php
public function getActionOptionsHelp($action) { $optionNames = $this->options($action->id); if (empty($optionNames)) { return []; } $class = new \ReflectionClass($this); $options = []; foreach ($class->getProperties() as $property) { $name = $...
[ "public", "function", "getActionOptionsHelp", "(", "$", "action", ")", "{", "$", "optionNames", "=", "$", "this", "->", "options", "(", "$", "action", "->", "id", ")", ";", "if", "(", "empty", "(", "$", "optionNames", ")", ")", "{", "return", "[", "]...
Returns the help information for the options for the action. The returned value should be an array. The keys are the option names, and the values are the corresponding help information. Each value must be an array of the following structure: - type: string, the PHP type of this argument. - default: string, the defaul...
[ "Returns", "the", "help", "information", "for", "the", "options", "for", "the", "action", "." ]
train
https://github.com/yiisoft/yii-console/blob/b9fb24f8897b4389935738f63b28d82b7e25cc41/src/Controller.php#L535-L582
yiisoft/yii-jquery
src/Validators/Client/CompareValidator.php
CompareValidator.getClientOptions
public function getClientOptions($validator, $model, $attribute) { $options = [ 'operator' => $validator->operator, 'type' => $validator->type, ]; if ($validator->compareValue !== null) { $options['compareValue'] = $validator->compareValue; $c...
php
public function getClientOptions($validator, $model, $attribute) { $options = [ 'operator' => $validator->operator, 'type' => $validator->type, ]; if ($validator->compareValue !== null) { $options['compareValue'] = $validator->compareValue; $c...
[ "public", "function", "getClientOptions", "(", "$", "validator", ",", "$", "model", ",", "$", "attribute", ")", "{", "$", "options", "=", "[", "'operator'", "=>", "$", "validator", "->", "operator", ",", "'type'", "=>", "$", "validator", "->", "type", ",...
Returns the client-side validation options. @param \yii\validators\CompareValidator $validator the server-side validator. @param \yii\base\Model $model the model being validated @param string $attribute the attribute name being validated @return array the client-side validation options
[ "Returns", "the", "client", "-", "side", "validation", "options", "." ]
train
https://github.com/yiisoft/yii-jquery/blob/1c257928cba2b46d267e90771652abe2b0e2cfcb/src/Validators/Client/CompareValidator.php#L42-L71