sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function setSubscriptionId($subscriptionId) { if (strlen($subscriptionId) > 50) { throw new InvalidArgumentException("Subscription id cannot be longer than 50 characters"); } if (preg_match('/[^a-zA-Z0-9_-]/', $subscriptionId)) { throw new InvalidArgumentExcept...
Unique identifier of the subscription. The subscription id must be assigned dynamically. @author René de Kat <renedekat@9lives-development.com> @param string $subscriptionId (maxlength 50)
entailment
public function setSubscriptionAmount($amount) { if (!is_int($amount)) { throw new InvalidArgumentException("Integer expected. Amount is always in cents"); } if ($amount <= 0) { throw new InvalidArgumentException("Amount must be a positive number"); } ...
Amount of the subscription (can be different from the amount of the original transaction) multiplied by 100, since the format of the amount must not contain any decimals or other separators. @author René de Kat <renedekat@9lives-development.com> @param integer $amount
entailment
public function setSubscriptionDescription($description) { if (strlen($description) > 100) { throw new InvalidArgumentException("Subscription description cannot be longer than 100 characters"); } if (preg_match('/[^a-zA-Z0-9_ -]/', $description)) { throw new InvalidAr...
Order description @author René de Kat <renedekat@9lives-development.com> @param string $description (maxlength 100)
entailment
public function setSubscriptionOrderId($orderId) { if (strlen($orderId) > 40) { throw new InvalidArgumentException("Subscription order id cannot be longer than 40 characters"); } if (preg_match('/[^a-zA-Z0-9_-]/', $orderId)) { throw new InvalidArgumentException("Subsc...
OrderID for subscription payments @author René de Kat <renedekat@9lives-development.com> @param string $orderId (maxlength 40)
entailment
public function setSubscriptionPeriod(SubscriptionPeriod $period) { $this->parameters['sub_period_unit'] = $period->getUnit(); $this->parameters['sub_period_number'] = $period->getInterval(); $this->parameters['sub_period_moment'] = $period->getMoment(); }
Set subscription payment interval @author René de Kat <renedekat@9lives-development.com>
entailment
public function setSubscriptionComment($comment) { if (strlen($comment) > 200) { throw new InvalidArgumentException("Subscription comment cannot be longer than 200 characters"); } if (preg_match('/[^a-zA-Z0-9_ -]/', $comment)) { throw new InvalidArgumentException("Sub...
Set comment for merchant @author René de Kat <renedekat@9lives-development.com> @param string $comment
entailment
public function decorate(IndexMetadataInterface $indexMetadata, $object, Document $document) { $indexName = $this->decorator->decorate($indexMetadata, $object, $document); return $this->prefix . '_' . $indexName; }
{@inheritdoc}
entailment
public function undecorate($decoratedIndexName) { $decoratedIndexName = $this->removePrefix($decoratedIndexName); return $this->decorator->undecorate($decoratedIndexName); }
{@inheritdoc}
entailment
public function isVariant($indexName, $decoratedIndexName, array $options = []) { if (($indexName === $decoratedIndexName && $this->prefix) || 0 !== strpos($decoratedIndexName, $this->prefix)) { // if both names are the same, and a prefix is set the name was not decorated by this decorator ...
{@inheritdoc}
entailment
private function removePrefix($decoratedIndexName) { if (0 === strpos($decoratedIndexName, $this->prefix . '_')) { $decoratedIndexName = substr($decoratedIndexName, strlen($this->prefix) + 1); return $decoratedIndexName; } return $decoratedIndexName; }
Removes the prefix added by this decorator from the index name. @param $decoratedIndexName @return string
entailment
public function getMetadataForObject($object) { foreach ($this->providers as $provider) { $metadata = $provider->getMetadataForObject($object); if (null !== $metadata) { return $metadata; } } return; }
{@inheritdoc}
entailment
public function getAllMetadata() { $metadatas = []; foreach ($this->providers as $provider) { foreach ($provider->getAllMetadata() as $metadata) { $metadatas[] = $metadata; } } return $metadatas; }
{@inheritdoc}
entailment
public function getMetadataForDocument(Document $document) { foreach ($this->providers as $provider) { $metadata = $provider->getMetadataForDocument($document); if (null !== $metadata) { return $metadata; } } return; }
{@inheritdoc}
entailment
public function index(Document $document, $indexName) { $index = $this->getLuceneIndex($indexName); // check to see if the subject already exists $this->removeExisting($index, $document); $luceneDocument = new Lucene\Document(); $aggregateValues = []; foreach ($doc...
{@inheritdoc}
entailment
public function deindex(Document $document, $indexName) { $index = $this->getLuceneIndex($indexName); $this->removeExisting($index, $document); $index->commit(); }
{@inheritdoc}
entailment
public function search(SearchQuery $searchQuery) { $indexNames = $searchQuery->getIndexes(); $queryString = $searchQuery->getQueryString(); $searcher = new Lucene\MultiSearcher(); foreach ($indexNames as $indexName) { $indexPath = $this->getIndexPath($indexName); ...
{@inheritdoc}
entailment
public function purge($indexName) { $indexPath = $this->getIndexPath($indexName); $fs = new Filesystem(); $fs->remove($indexPath); }
{@inheritdoc}
entailment
public function listIndexes() { if (!file_exists($this->basePath)) { return []; } $finder = new Finder(); $indexDirs = $finder->directories()->depth('== 0')->in($this->basePath); $names = []; foreach ($indexDirs as $file) { /* @var $file \Sy...
{@inheritdoc}
entailment
private function getLuceneIndex($indexName) { $indexPath = $this->getIndexPath($indexName); if (!file_exists($indexPath)) { $this->getIndex($indexPath, true); } return $this->getIndex($indexPath, false); }
Return (or create) a Lucene index for the given name. @param string $indexName @return Index
entailment
private function removeExisting(Index $index, Document $document) { $hits = $index->find(self::ID_FIELDNAME . ':' . $document->getId()); foreach ($hits as $hit) { $index->delete($hit->id); } }
Remove the existing entry for the given Document from the index, if it exists. @param Index $index The Zend Lucene Index @param Document $document The Massive Search Document
entailment
private function getIndex($indexPath, $create = false) { $index = new Index($indexPath, $create); $index->setHideException($this->hideIndexException); return $index; }
Return the index. Note that we override the default ZendSeach index to allow us to catch the exception thrown during __destruct when running functional tests. @param string $indexPath @param bool $create Create an index or open it @return Index
entailment
private function getFieldType(Field $field) { if ($field->isStored() && $field->isIndexed()) { return 'text'; } if (false === $field->isStored() && $field->isIndexed()) { return 'unStored'; } if ($field->isStored() && false === $field->isIndexed()) {...
Return the zend lucene field type to use for the given field. @param Field $field @return string
entailment
public function initialize() { if (!$this->filesystem->exists($this->basePath)) { $this->filesystem->mkdir($this->basePath); } }
{@inheritdoc}
entailment
public function preRemove(LifecycleEventArgs $event) { $event = new DeindexEvent($event->getEntity()); $this->eventDispatcher->dispatch(SearchEvents::DEINDEX, $event); }
Deindex entities after they have been removed. @param LifecycleEventArgs $event
entailment
public function getValue($object, FieldInterface $field) { try { switch (get_class($field)) { case 'Massive\Bundle\SearchBundle\Search\Metadata\Field\Property': return $this->getPropertyValue($object, $field); case 'Massive\Bundle\SearchBundle\...
Evaluate the value from the given object and field. @param mixed $object @param FieldInterface $field
entailment
private function getPropertyValue($object, Property $field) { return $this->accessor->getValue($object, $field->getProperty()); }
Evaluate a property (using PropertyAccess). @param mixed $object @param Property $field
entailment
private function getFieldValue($object, Field $field) { if (is_array($object)) { $path = '[' . $field->getName() . ']'; } else { $path = $field->getName(); } return $this->accessor->getValue($object, $path); }
Return a value determined from the name of the field rather than an explicit property. If the object is an array, then force the array syntax. @param mixed $object @param Field $field
entailment
private function getExpressionValue($object, Expression $field) { try { return $this->expressionLanguage->evaluate($field->getExpression(), [ 'object' => $object, ]); } catch (\Exception $e) { throw new \RuntimeException(sprintf( 'E...
Evaluate an expression (ExpressionLanguage). @param mixed $object @param Expression $field
entailment
public function purgeIndexes(IndexRebuildEvent $event) { if (!$event->getPurge()) { return; } foreach ($this->searchManager->getIndexNames() as $indexName) { $event->getOutput()->writeln('<info>Purging index</info>: ' . $indexName); $this->searchManager->...
Purges all indexes, if the purge option is set. @param IndexRebuildEvent $event
entailment
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $treeBuilder->root('massive_search') ->children() ->arrayNode('services') ->addDefaultsifNotSet() ->children() ->scalarNode('factory'...
Returns the config tree builder. @return TreeBuilder
entailment
public function createField($name, $value, $type = Field::TYPE_STRING, $stored = true, $indexed = true, $aggregated = false) { return new Field($name, $value, $type, $stored, $indexed, $aggregated); }
Make a new search field (fields are contained within documents). @return Field
entailment
public function onDeindex(DeindexEvent $event) { try { $this->searchManager->deindex($event->getSubject()); } catch (MetadataNotFoundException $ex) { // no metadata found => do nothing } }
Deindex subject from event. @param DeindexEvent $event
entailment
public function decorate(IndexMetadataInterface $indexMetadata, $object, Document $document) { $indexName = $this->decorator->decorate($indexMetadata, $object, $document); $locale = $document->getLocale(); if (!$locale) { return $indexName; } return $indexName ....
{@inheritdoc}
entailment
public function isVariant($indexName, $decoratedIndexName, array $options = []) { if (!$this->decorator->isVariant($indexName, $this->removeLocale($decoratedIndexName), $options)) { return false; } if ($indexName == $decoratedIndexName) { return true; } ...
{@inheritdoc}
entailment
public function setCheckpoint($providerName, $classFqn, $value) { if (!is_scalar($value)) { throw new \InvalidArgumentException(sprintf( 'Only scalar values may be passed as a checkpoint value, got "%s"', gettype($value) )); } $data = ...
{@inheritdoc}
entailment
public function getCheckpoint($providerName, $classFqn) { $data = $this->getCheckpoints(); if (isset($data[$providerName][$classFqn])) { return $data[$providerName][$classFqn]; } return; }
{@inheritdoc}
entailment
public function removeCheckpoints($providerName) { $data = $this->getCheckpoints(); if (isset($data[$providerName])) { unset($data[$providerName]); $this->saveCheckpoints($data); } }
{@inheritdoc}
entailment
public function rtmpPublishUrl() { switch ($this->publishSecurity) { case 'static': $url = $this->_rtmpPublishStaticUrl(); break; case 'dynamic': $url = $this->_rtmpPublishDynamicUrl(); break; default...
-------------------------------------------------------------------------------
entailment
public function rtmpLiveUrls() { $urls = array(); $url = sprintf("rtmp://%s/%s/%s", $this->hosts["live"]["rtmp"], $this->hub, $this->title); $urls['ORIGIN'] = $url; if (isset($this->profiles) && !empty($this->profiles)) { foreach ($this->profiles as $profile) { ...
--------------------------------------------------------------------------------
entailment
public function hlsLiveUrls() { $urls = array(); $urls['ORIGIN'] = sprintf("http://%s/%s/%s.m3u8", $this->hosts["live"]["hls"], $this->hub, $this->title); if (isset($this->profiles) && !empty($this->profiles)) { foreach ($this->profiles as $profile) { $urls[$profi...
--------------------------------------------------------------------------------
entailment
public function hlsPlaybackUrls($start = -1, $end = -1) { $name = sprintf("%d", time()); $resp = $this->saveAs($name, NULL, $start, $end); $urls = array(); $urls['ORIGIN'] = $resp["url"]; return $urls; }
--------------------------------------------------------------------------------
entailment
public function findDocumentById($id) { $response = $this->request('GET', '/' . $id); if ($response->getStatusCode() !== 200) { return null; } return $this->documentFactory->createFromResponse($this, $id, $response); }
Returns a document @param string $id @return Document
entailment
public function createCommand($indexName, $clientName = null) { if (!in_array($indexName, $this->indexInformer->getAllIndexNames())) { $this->outputFormatted("The index <b>%s</b> is not configured in the current application", [$indexName]); $this->quit(1); } $client ...
Create a new index in ElasticSearch @param string $indexName The name of the new index @param string $clientName The client name to use @return void
entailment
public function showConfiguredTypesCommand() { $classesAndAnnotations = $this->indexInformer->getClassesAndAnnotations(); $this->outputFormatted("<b>Available document type</b>"); /** @var $annotation Indexable */ foreach ($classesAndAnnotations as $className => $annotation) { ...
List available document type @return void
entailment
public function statusCommand($object = null, $conductUpdate = false, $clientName = null) { $result = new ErrorResult(); $client = $this->clientFactory->create($clientName); $classesAndAnnotations = $this->indexInformer->getClassesAndAnnotations(); if ($object !== null) { ...
Shows the status of the current mapping @param string $object Class name of a domain object. If given, will only work on this single object @param boolean $conductUpdate Set to TRUE to conduct the required corrections @param string $clientName The client name to use @return void
entailment
public function indexObject($object, $signalInformation = null, Client $client = null) { $type = $this->getIndexTypeForObject($object, $client); if ($type === null) { return null; } $data = $this->getIndexablePropertiesAndValuesFromObject($object); $id = $this->p...
(Re-) indexes an object to the ElasticSearch index, no matter if the change is actually required. @param object $object @param string $signalInformation Signal information, if called from a signal @param Client $client @return void
entailment
protected function getIndexTypeForObject($object, Client $client = null) { if ($client === null) { $client = $this->client; } $className = TypeHandling::getTypeForValue($object); $indexAnnotation = $this->indexInformer->getClassAnnotation($className); if ($indexAn...
Returns the ElasticSearch type for a specific object, by its annotation @param object $object @param Client $client @return GenericType
entailment
protected function getIndexablePropertiesAndValuesFromObject($object) { $className = TypeHandling::getTypeForValue($object); $data = []; foreach ($this->indexInformer->getClassProperties($className) as $propertyName) { if (ObjectAccess::isPropertyGettable($object, $propertyName) ...
Returns a multidimensional array with the indexable, probably transformed values of an object @param object $object @return array
entailment
public function objectIndexActionRequired($object, Client $client = null) { $type = $this->getIndexTypeForObject($object, $client); if ($type === null) { return null; } $id = $this->persistenceManager->getIdentifierByObject($object); $document = $type->findDocumen...
Returns if, and what, treatment an object requires regarding the index state, i.e. it checks the given object against the index and tells whether deletion, update or creation is required. @param object $object @param Client $client @return string one of this' ACTION_TYPE_* constants or NULL if no action is required
entailment
protected function registerFunctions() { parent::registerFunctions(); $this->addFunction($this->createJoinFunction()); $this->addFunction($this->createMapFunction()); }
{@inheritdoc}
entailment
private function createJoinFunction() { return new ExpressionFunction( 'join', function ($glue, $elements) { return sprintf('join(%s, %s)', $glue, $elements); }, function (array $values, $glue, $elements) { return implode($glue,...
Join is an alias for PHP implode:. join(',', ['one', 'two', 'three']) = "one,two,three" @return ExpressionFunction
entailment
private function createMapFunction() { return new ExpressionFunction( 'map', function ($elements, $expression) { throw new \Exception('Map function does not support compilation'); }, function (array $values, $elements, $expression) { ...
Map is an analogue for array_map. The callback in the form of an expression. The nested expression has one variable, "el". For example: map({'foo': 'one', 'foo': 'two'}, 'el["foo"]'}) = array('one', 'two'); @return ExpressionFunction
entailment
public static function resolve(array $controllers) { $callbacks = []; foreach ($controllers as $controller) { $qualifiedController = '\\' . trim($controller, '\\'); $callbacks[$controller] = function (ContainerInterface $container) use ($qualifiedController) { ...
Create service callbacks. @param array $controllers @return array
entailment
public function index(Document $document, $indexName) { $fields = []; foreach ($document->getFields() as $massiveField) { $type = $massiveField->getType(); $value = $massiveField->getValue(); switch ($type) { case Field::TYPE_STRING: ...
{@inheritdoc}
entailment
public function deindex(Document $document, $indexName) { $params = [ 'index' => $indexName, 'type' => $this->documentToType($document), 'id' => $document->getId(), 'refresh' => true, ]; try { $this->client->delete($params); ...
{@inheritdoc}
entailment
public function search(SearchQuery $searchQuery) { $indexNames = $searchQuery->getIndexes(); $queryString = $searchQuery->getQueryString(); $params['index'] = implode(',', $indexNames); $params['body'] = [ 'query' => [ 'query_string' => [ ...
{@inheritdoc}
entailment
public function getStatus() { $indices = $this->getIndexStatus(); $indexes = $indices['indices']; $status = []; foreach ($indexes as $indexName => $index) { foreach ($index as $field => $value) { $status['idx:' . $indexName . '.' . $field] = substr(trim(j...
{@inheritdoc}
entailment
public function purge($indexName) { try { $this->client->indices()->delete(['index' => $indexName]); $this->indexListLoaded = false; } catch (\Elasticsearch\Common\Exceptions\Missing404Exception $e) { } }
{@inheritdoc}
entailment
public function listIndexes() { if (!$this->indexListLoaded) { $indices = $this->getIndexStatus(); $indexes = $indices['indices']; $this->indexList = array_combine( array_keys($indexes), array_keys($indexes) ); $this...
{@inheritdoc}
entailment
private function getIndexStatus() { if (version_compare($this->version, '2.2', '>')) { return $this->client->indices()->stats(['index' => '_all']); } return $this->client->indices()->status(['index' => '_all']); }
Returns index-status. @return array
entailment
public function jsonSerialize() { return [ 'id' => $this->id, 'title' => $this->title, 'description' => $this->description, 'class' => $this->class, 'url' => $this->url, 'image_url' => $this->imageUrl, 'locale' => $this->loc...
{@inheritdoc}
entailment
public function loadMetadataFromFile(\ReflectionClass $class, $file) { $classMetadata = $this->factory->createClassMetadata($class->name); $xml = simplexml_load_file($file); if (count($xml->children()) > 1) { throw new \InvalidArgumentException(sprintf( 'Only on...
{@inheritdoc}
entailment
private function getMapping(\SimpleXmlElement $mapping, $field) { $field = $mapping->$field; if (!$field->getName()) { return; } return $this->getField($field); }
Return the value object for the mapping. @param \SimpleXmlElement $mapping @param mixed $field
entailment
private function extractContextMappings(\SimpleXmlElement $mapping, $indexMapping) { $contextMappings = []; foreach ($mapping->context as $context) { if (!isset($context['name'])) { throw new \InvalidArgumentException(sprintf( 'No name given to context...
Overwrite the default mapping if there exists a <context> section which matches the context given in the constructor of this class. @param \SimpleXmlElement $mapping
entailment
public function convert($value, $from) { if (!$this->hasConverter($from)) { throw new ConverterNotFoundException($from); } return $this->converter[$from]->convert($value); }
{@inheritdoc}
entailment
public function execute(InputInterface $input, OutputInterface $output) { $formatterHelper = new FormatterHelper(); $startTime = microtime(true); if ('prod' !== $this->env) { $output->writeln( $formatterHelper->formatBlock( sprintf( ...
{@inheritdoc}
entailment
public function addSorting($sort, $order = SearchQuery::SORT_ASC) { $this->searchQuery->addSorting($sort, $order); return $this; }
Set the sort Field. @param string $sort @param string $order @return SearchQueryBuilder
entailment
public function fix(SplFileInfo $file, Tokens $tokens): void { foreach ($tokens->findGivenKind(T_DOC_COMMENT) as $token) { /** @var \PhpCsFixer\Tokenizer\Token $token */ $doc = new DocBlock($token->getContent()); foreach ($doc->getAnnotations() as $annotation) { ...
{@inheritdoc}
entailment
public function register() { $this->mergeConfigFrom(__DIR__ . '/../../config/laravelpdf.php', 'laravelpdf'); $this->app->singleton('pdf', function ($app) { return new PDF(config('laravelpdf.executable'), storage_path()); }); }
Register the service provider. @return void
entailment
protected function _create($class, $alias, $config) { $instance = new $class($this->_collection, $config); $enable = isset($config['enabled']) ? $config['enabled'] : true; if ($enable) { $this->eventManager()->on($instance); } $methods = $this->_getMethods($instan...
Overridden _create() method that injects a BaseCollection object into a MongoBehavior rather than a Behavior object. @param string $class @param string $alias @param array $config @return mixed
entailment
public function getMimeType() { // return mime type ala mimetype extension $finfo = finfo_open(FILEINFO_MIME); $mime = finfo_file($finfo, $this->getFullPath()); return $mime; }
Get the mime type for the file. @param FileInterface $file @return string
entailment
public function select(callable $filter) { if (! $this->collection) { return new ReviewCollection(); } $filtered = array_filter($this->collection, $filter); return new ReviewCollection($filtered); }
Filters the collection with the given closure, returning a new collection. @return ReviewCollection
entailment
public function forFile(FileInterface $file) { $filter = function ($review) use ($file) { if ($review->canReview($file)) { return true; } return false; }; return $this->select($filter); }
Returns a filtered ReviewCollection that should be run against the given file. @param FileInterface $file @return ReviewCollection
entailment
public function forMessage(CommitMessageInterface $message) { $filter = function ($review) use ($message) { if ($review->canReview($message)) { return true; } return false; }; return $this->select($filter); }
Returns a filtered ReviewCollection that should be run against the given message. @param CommitMessage $message @return ReviewCollection
entailment
public function configure(array $configuration = null): void { if ($configuration !== null) { $this->analyzedNamespaces = $this->extractNamespaces($configuration); } }
{@inheritdoc}
entailment
public function isCandidate(Tokens $tokens): bool { return $tokens->isAllTokenKindsFound([T_PRIVATE]) && $this->checkNamespace($tokens); }
{@inheritdoc}
entailment
public function fix(SplFileInfo $file, Tokens $tokens): void { foreach ($tokens->findGivenKind(T_PRIVATE) as $index => $privateToken) { $tokens[$index] = new Token([T_PROTECTED, 'protected']); } }
{@inheritdoc}
entailment
public function getLevelName() { switch ($this->getLevel()) { case self::LEVEL_INFO: return 'Info'; case self::LEVEL_WARNING: return 'Warning'; case self::LEVEL_ERROR: return 'Error'; default: ...
Gets the Issues level as a string.
entailment
public function getColour() { switch ($this->level) { case self::LEVEL_INFO: return 'cyan'; case self::LEVEL_WARNING: return 'brown'; case self::LEVEL_ERROR: return 'red'; default: throw new \U...
Gets the colour to use when echoing to the console. @return string
entailment
public function select(callable $filter) { if (! $this->collection) { return new IssueCollection(); } $filtered = array_filter($this->collection, $filter); return new IssueCollection($filtered); }
Filters the collection with the given closure, returning a new collection. @return IssueCollection
entailment
public function forLevel($option) { // Only return issues matching the level. $filter = function ($issue) use ($option) { if ($issue->matches($option)) { return true; } return false; }; return $this->select($filter); }
Returns a new IssueCollection filtered by the given level option. @param int $level @return IssueCollection
entailment
public function getStagedFiles() { $base = $this->getProjectBase(); $files = new FileCollection(); foreach ($this->getFiles() as $file) { $fileData = explode("\t", $file); $status = reset($fileData); $relativePath = end($fileData); $fullPath...
Gets a list of the files currently staged under git. Returns either an empty array or a tab separated list of staged files and their git status. @link http://git-scm.com/docs/git-status @return FileCollection
entailment
public function getCommitMessage($file = null) { if ($file) { $hash = null; $message = file_get_contents($file); } else { list($hash, $message) = explode(PHP_EOL, $this->getLastCommitMessage(), 2); } return new CommitMessage($message, $hash); ...
Get a commit message by file or log. If no file name is provided, the last commit message will be used. @param string $file @return CommitMessage
entailment
private function getFiles() { $process = new Process('git diff --cached --name-status --diff-filter=ACMR'); $process->run(); if ($process->isSuccessful()) { return array_filter(explode("\n", $process->getOutput())); } return []; }
Gets the list of files from the index. @return array
entailment
private function saveFileToCache(FileInterface $file) { $cachedPath = sys_get_temp_dir() . self::CACHE_DIR . $file->getRelativePath(); if (! is_dir(dirname($cachedPath))) { mkdir(dirname($cachedPath), 0700, true); } $cmd = sprintf('git show :%s > %s', $file->getRelative...
Saves a copy of the cached version of the given file to a temp directory. @param FileInterface $file @return FileInterface
entailment
public function loadViews($viewNames = array(), $data = array(), $mergeData = array()) { $this->children = array(); foreach ($viewNames as $key => $viewName) { $className = get_class(); $item = new $className($this->cmd, $this->folder); $item->loadView($viewName, ...
Mass version of the loadView function. @param array $viewNames Array of Laravel view names to include in resulting page. Order matters. @param array $data Data array is shared across all views. @param array $mergeData @return $this @see: loadView()
entailment
public function loadHTMLs($htmls) { $this->children = array(); foreach ($htmls as $key => $html) { $className = get_class(); $item = new $className($this->cmd, $this->folder); /* @var \Inline\LaravelPDF\PDF $item */ $item->loadHTML($html); ...
Mass loads HTML Content. @param array string $htmls @return $this
entailment
protected function getInputSource() { if (empty($this->children)) { return parent::getInputSource(); } $childPaths = []; foreach ($this->children as $child) { $childPaths[] = $child->getInputSource(); } return implode(" ", $childPaths); }
Updated version which can handle multiple source files. @return string
entailment
public function review(ReporterInterface $reporter, ReviewableInterface $file) { $cmd = sprintf('file %s | grep --fixed-strings --quiet "CRLF"', $file->getFullPath()); $process = $this->getProcess($cmd); $process->run(); if ($process->isSuccessful()) { $message = 'File ...
Checks if the set file contains any CRLF line endings. @link http://stackoverflow.com/a/3570574
entailment
public function getContext() { $context = [ 'log_cmd_insert' => [$this, 'onInsert'], 'log_cmd_delete' => [$this, 'onDelete'], 'log_cmd_update' => [$this, 'onUpdate'], 'log_insert' => [$this, 'onInsert'], 'log_delete' => [$thi...
Returns the context array for being converted into a stream context by the MongoConnection class. @return array
entailment
public function addReviews(ReviewCollection $reviews) { foreach ($reviews as $review) { $this->reviews->append($review); } return $this; }
Appends a ReviewCollection to the current list of reviews. @param ReviewCollection $checks @return StaticReview
entailment
public function files(FileCollection $files) { foreach ($files as $key => $file) { $this->getReporter()->progress($key + 1, count($files)); foreach ($this->getReviews()->forFile($file) as $review) { $review->review($this->getReporter(), $file); } ...
Runs through each review on each file, collecting any errors. @return StaticReview
entailment
public function message(CommitMessageInterface $message) { foreach ($this->getReviews()->forMessage($message) as $review) { $review->review($this->getReporter(), $message); } return $this; }
Runs through each review on the commit, collecting any errors. @return StaticReview
entailment
public function isCandidate(Tokens $tokens): bool { return $tokens->isTokenKindFound(\T_DOC_COMMENT) && $tokens->isAnyTokenKindsFound(self::ACCESS_TOKENS); }
{@inheritdoc}
entailment
public function fix(\SplFileInfo $file, Tokens $tokens): void { $allDocBlocks = $this->findAllDocBlocks($tokens); foreach ($allDocBlocks as $position => $docBlock) { if (!$this->areThereAnyAccessAnnotation($docBlock)) { continue; } if ($this->fol...
{@inheritdoc}
entailment
public function getMongoCollectionName() { // Get full namespaced class name $class = get_class($this); $split_array = explode('\\', $class); // Split into namespaces and get the last namespace as the class name $final = $split_array[count($split_array) - 1]; // Cut t...
Infers the name of the Mongo collection inside of the database based on the namespace of the current class. @return string
entailment
public function setMongaCollection($collection_name) { $this->collection = $this->database->collection($collection_name); return $this->collection; }
Sets a new collection property based on the lowercase, tableized collection name passed in as the first arg. @param string $collection_name @return mixed
entailment
public function find($query = [], $fields = [], $findOne = false) { $before_find_event = $this->dispatchEvent('Model.beforeFind', compact('query', 'fields', 'findOne')); if (!empty($before_find_event->result['query']) && $before_find_event->result['query'] !== $query) { $query = $before...
Wraps Mongoa's native `find()` function on their Collection object. If the beforeFind() method is defined, calls that method with this methods arguments and allows direct modification of the $query and $fields arguments before the find query is called. @param array $query @param array $fields @param bool $findOne @re...
entailment
public function save($document, $options = []) { $before_save_event = $this->dispatchEvent('Model.beforeSave', compact('document', 'options')); if (!empty($before_save_event->result['document']) && $before_save_event->result['document'] !== $document) { $document = $before_save_event->r...
Wraps Monga's native `save()` method on their Collection object. If the beforeSave() method is defined, calls that method with this methods arguments and allows direct modification of the $document to be saved before the save is committed to the MongoDB instance. If the afterSave() method is defined, it is called aft...
entailment
public function update($values = [], $query = null, $options = []) { $before_update_event = $this->dispatchEvent('Model.beforeUpdate', compact('values', 'query')); if (!empty($before_update_event->result['values']) && $before_update_event->result['values'] !== $values) { $values = $befo...
Wraps Monga's native 'update()' method on their Collection object. If the beforeUpdate() method is defined, calls that method with this methods arguments and allows direct modification of the $values and $query arguments before the update query is called. If the afterUpdate() method is defined, it is called after the...
entailment