sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function validateObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute ) { $contentObjectAttributeID = $contentObjectAttribute->attribute( 'id' ); $keywordString = trim( $http->postVariable( $base . '_eztags_data_text_' . $contentObjectAttributeID, '' ) ); $parentString = t...
Validates the input and returns true if the input was valid for this datatype @param eZHTTPTool $http @param string $base @param eZContentObjectAttribute $contentObjectAttribute @return bool
entailment
public function fetchObjectAttributeHTTPInput( $http, $base, $contentObjectAttribute ) { $contentObjectAttributeID = $contentObjectAttribute->attribute( 'id' ); if ( !$http->hasPostVariable( $base . '_eztags_data_text_' . $contentObjectAttributeID ) ) return false; if ( !$http-...
Fetches the HTTP POST input and stores it in the data instance @param eZHTTPTool $http @param string $base @param eZContentObjectAttribute $contentObjectAttribute @return bool
entailment
public function storeObjectAttribute( $attribute ) { /** @var $eZTags eZTags */ $eZTags = $attribute->content(); if ( $eZTags instanceof eZTags ) $eZTags->store( $attribute ); }
Stores the object attribute @param eZContentObjectAttribute $attribute
entailment
public function validateClassAttributeHTTPInput( $http, $base, $attribute ) { $classAttributeID = $attribute->attribute( 'id' ); $maxTags = trim( $http->postVariable( $base . self::MAX_TAGS_VARIABLE . $classAttributeID, '' ) ); if ( ( !is_numeric( $maxTags ) && !empty( $maxTags ) ) || (int)...
Validates class attribute HTTP input @param eZHTTPTool $http @param string $base @param eZContentClassAttribute $attribute @return bool
entailment
public function fetchClassAttributeHTTPInput( $http, $base, $attribute ) { $classAttributeID = $attribute->attribute( 'id' ); $subTreeLimit = (int) $http->postVariable( $base . self::SUBTREE_LIMIT_VARIABLE . $classAttributeID, -1 ); $maxTags = (int) trim( $http->postVariable( $base . self::...
Fetches class attribute HTTP input and stores it @param eZHTTPTool $http @param string $base @param eZContentClassAttribute $attribute @return bool
entailment
public function unserializeContentClassAttribute( $classAttribute, $attributeNode, $attributeParametersNode ) { /** @var $domNodes DOMNodeList */ $subTreeLimit = 0; $domNodes = $attributeParametersNode->getElementsByTagName( 'subtree-limit' ); if ( $domNodes->length > 0 ) ...
Extracts values from the attribute parameters and sets it in the class attribute. @param eZContentClassAttribute $classAttribute @param DOMElement $attributeNode @param DOMElement $attributeParametersNode
entailment
public function serializeContentClassAttribute( $classAttribute, $attributeNode, $attributeParametersNode ) { $dom = $attributeParametersNode->ownerDocument; $subTreeLimit = (string) $classAttribute->attribute( self::SUBTREE_LIMIT_FIELD ); $domNode = $dom->createElement( 'subtree-limit' ); ...
Adds the necessary DOM structure to the attribute parameters @param eZContentClassAttribute $classAttribute @param DOMNode $attributeNode @param DOMNode $attributeParametersNode
entailment
public function metaData( $attribute ) { /** @var $eZTags eZTags */ $eZTags = $attribute->content(); if ( !$eZTags instanceof eZTags ) return ''; $indexSynonyms = eZINI::instance( 'eztags.ini' )->variable( 'SearchSettings', 'IndexSynonyms' ) === 'enabled'; $keyw...
Returns the meta data used for storing search indices @param eZContentObjectAttribute $attribute @return string
entailment
public function deleteStoredObjectAttribute( $contentObjectAttribute, $version = null ) { $contentObjectAttributeID = $contentObjectAttribute->attribute( 'id' ); eZTagsAttributeLinkObject::removeByAttribute( $contentObjectAttributeID, $version ); }
Delete stored object attribute @param eZContentObjectAttribute $contentObjectAttribute @param eZContentObjectVersion $version
entailment
public function hasObjectAttributeContent( $contentObjectAttribute ) { /** @var $eZTags eZTags */ $eZTags = $contentObjectAttribute->content(); if ( !$eZTags instanceof eZTags ) return false; $tagsCount = $eZTags->attribute( 'tags_count' ); return $tagsCount > 0;...
Returns true if content object attribute has content @param eZContentObjectAttribute $contentObjectAttribute @return bool
entailment
public function toString( $contentObjectAttribute ) { /** @var $eZTags eZTags */ $eZTags = $contentObjectAttribute->content(); if ( !$eZTags instanceof eZTags ) return ''; $returnArray = array(); $returnArray[] = $eZTags->attribute( 'id_string' ); $return...
Returns string representation of a content object attribute @param eZContentObjectAttribute $contentObjectAttribute @return string
entailment
public function fromString( $contentObjectAttribute, $string ) { $idString = ''; $keywordString = ''; $parentString = ''; $localeString = ''; $string = trim( $string ); if ( !empty( $string ) ) { $itemsArray = explode( '|#', $string ); ...
Creates the content object attribute content from the input string Valid string value is list of ids, followed by list of keywords, followed by list of parent ids, followed by list of locales all together separated by '|#' for example "1|#2|#3|#first tag|#second tag|#third tag|#12|#13|#14|#eng-GB|#eng-GB|#eng-GB" @pa...
entailment
public function serializeContentObjectAttribute( $package, $objectAttribute ) { $node = $this->createContentObjectAttributeDOMNode( $objectAttribute ); /** @var $eZTags eZTags */ $eZTags = $objectAttribute->content(); if ( !$eZTags instanceof eZTags ) return $node; ...
Serializes the content object attribute @param eZPackage $package @param eZContentObjectAttribute $objectAttribute @return DOMNode
entailment
public function unserializeContentObjectAttribute( $package, $objectAttribute, $attributeNode ) { $idString = $attributeNode->getElementsByTagName( 'id-string' )->item( 0 )->textContent; $keywordString = $attributeNode->getElementsByTagName( 'keyword-string' )->item( 0 )->textContent; $paren...
Unserializes the content object attribute from provided DOM node @param eZPackage $package @param eZContentObjectAttribute $objectAttribute @param DOMElement $attributeNode
entailment
private function isEmptyLine(array $tokensInLine): bool { if (count($tokensInLine) > 1) { return false; } $firstToken = $tokensInLine[0]; return $firstToken->getType() === TokenInterface::TYPE_WHITESPACE && $firstToken->getValue() === "\n"; }
Checks if a stream of tokens is an empty line. @param TokenInterface[] $tokensInLine @return bool
entailment
private function reduceIndentationLevel(int $indentationLevel, array $tokensInLine): int { $raisingIndentation = [ TokenInterface::TYPE_BRACE_CLOSE, ]; if ($this->indentConditions) { $raisingIndentation[] = TokenInterface::TYPE_CONDITION_END; } forea...
Check whether indentation should be reduced by one level, for current line. Checks tokens in current line, and whether they will reduce the indentation by one. @param int $indentationLevel The current indentation level @param TokenInterface[] $tokensInLine @return int The new indentation level
entailment
private function raiseIndentationLevel(int $indentationLevel, array $tokensInLine): int { $raisingIndentation = [ TokenInterface::TYPE_BRACE_OPEN, ]; if ($this->indentConditions && $this->insideCondition === false) { $raisingIndentation[] = TokenInterface::TYPE_CONDI...
Check whether indentation should be raised by one level, for current line. Checks tokens in current line, and whether they will raise the indentation by one. @param int $indentationLevel The current indentation level @param TokenInterface[] $tokensInLine @return int The new indentation level
entailment
public function execute(EntityInterface $entity = NULL, array &$normalized = NULL, array $context = NULL) { $config = $this->getConfiguration(); $drupal_predicate = $config[self::URI_PREDICATE]; if (!is_null($drupal_predicate) && !empty($drupal_predicate)) { $url = $entity ->toUrl('canonical',...
{@inheritdoc}
entailment
public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $config = $this->getConfiguration(); $form[self::URI_PREDICATE] = [ '#type' => 'textfield', '#title' => $this->t('Drupal URI predicate'), '#description' => $this->t("The Drupal object's URI will be added to t...
{@inheritdoc}
entailment
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) { $drupal_predicate = $form_state->getValue(self::URI_PREDICATE); if (!is_null($drupal_predicate) and !empty($drupal_predicate)) { if (preg_match('/^https?:\/\//', $drupal_predicate)) { // Can't validate all UR...
{@inheritdoc}
entailment
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { $this->setConfiguration([self::URI_PREDICATE => $form_state->getValue(self::URI_PREDICATE)]); }
{@inheritdoc}
entailment
public function field($fieldName, $fieldValue = '', $fieldBoost = null) { if(empty($fieldName)) { throw new \InvalidArgumentException('Please provide a fieldname'); } $field = array( 'name'=> $fieldName, 'value' => $fieldValue ); if(!empty($fieldBoost)) { ...
Add a 'field' entry for this document @param String $fieldName @param String $fieldValue @param int $fieldBoost @throws \InvalidArgumentException
entailment
public function getField($fieldName) { if(empty($fieldName)) { throw new \InvalidArgumentException('Please provide a fieldname'); } $values = array(); foreach($this->fields as $field) { if($field['name'] == $fieldName) { $values[] = $field...
Return value(s) for one field @param String $fieldName
entailment
protected function init($curlOptions) { $client = new Curl; $client->setVerifyPeer(false); $client->setTimeout(60000); foreach($curlOptions as $option => $value) { $client->setOption($option, $value); } $this->client = $client; $this->browse...
Initialise
entailment
private function buildUrl($request) { return $this->options['url'] . $request->getUrlPrefix() . $request->getPath() . '?' . $this->getUrlPartParameters($request); }
Build final URL to call @param OpenSearchServer\Request $request
entailment
public function submit(Request $request) { try { $response = $this->browser->call( $this->buildUrl($request), $request->getMethod(), $request->getHeaders(), $request->getData() ); $response...
Submit a request to the API. @param OpenSearchServer\Request $request @return object
entailment
public function submitFile(RequestFile $requestOSS, array $options = array()) { $request = curl_init($this->buildUrl($requestOSS)); ($requestOSS->getMethod() == 'PUT') ? curl_setopt($request, CURLOPT_CUSTOMREQUEST, 'PUT') : curl_setopt($request, CURLOPT_POST, true); ...
Submit a PUT or POST request to the API, sending a file using CURL directly. @param OpenSearchServer\RequestFile $requestOSS @param array $options
entailment
public function attribute( $name ) { if ( !$this->hasAttribute( $name ) ) { eZDebug::writeError( "Attribute '$name' does not exist", __METHOD__ ); return null; } if ( $name == 'tags' ) return $this->tags(); else if ( $name == 'tags_count' ...
Returns the specified attribute @param string $name @return mixed
entailment
static public function createFromStrings( eZContentObjectAttribute $attribute, $idString, $keywordString, $parentString, $localeString ) { $idArray = explode( '|#', $idString ); $keywordArray = explode( '|#', $keywordString ); $parentArray = explode( '|#', $parentString ); $localeArr...
Initializes the tags @static @param eZContentObjectAttribute $attribute @param string $idString @param string $keywordString @param string $parentString @param string $localeString @return eZTags The newly created eZTags object
entailment
static public function createFromAttribute( eZContentObjectAttribute $attribute, $locale = null ) { $idArray = array(); $keywordArray = array(); $parentArray = array(); $localeArray = array(); if ( !is_numeric( $attribute->attribute( 'id' ) ) || !is_numeric( $attribute->attr...
Fetches the tags for the given attribute and locale @static @param eZContentObjectAttribute $attribute @param string|null $locale @return eZTags The newly created eZTags object
entailment
public function store( eZContentObjectAttribute $attribute ) { $this->Attribute = $attribute; if( !is_numeric( $this->Attribute->attribute( 'id' ) ) || !is_numeric( $this->Attribute->attribute( 'version' ) ) ) return; $db = eZDB::instance(); $db->begin(); // fi...
Stores the tags to database @param eZContentObjectAttribute $attribute
entailment
private function getPermissionArray() { $permissionArray = array( 'can_add' => false, 'subtree_limit' => $this->Attribute->contentClassAttribute()->attribute( eZTagsType::SUBTREE_LIMIT_FIELD ), 'allowed_locations' => array(), 'allowed_locations_t...
Returns the array with permission info for linking tags to current content object attribute @return array
entailment
static private function canSave( $pathString, array $allowedLocations ) { foreach ( $allowedLocations as $location ) { if ( $location == 0 || strpos( $pathString, '/' . $location . '/' ) !== false ) return true; } return false; }
Checks if tags can be saved below tag with provided path string, taking into account allowed locations for tag placement @static @param string $pathString @param array $allowedLocations @return bool
entailment
static private function createAndLinkTag( eZContentObjectAttribute $attribute, $parentID, $parentPathString, $parentDepth, $keyword, $locale, $priority ) { $languageID = eZContentLanguage::idByLocale( $locale ); if ( $languageID === false ) return; $ini = eZINI::instance( 'eztag...
Creates a new tag and links it to provided content object attribute @static @param eZContentObjectAttribute $attribute @param int $parentID @param string $parentPathString @param int $parentDepth @param string $keyword @param string $locale
entailment
static private function linkTag( eZContentObjectAttribute $attribute, eZTagsObject $tagObject, $keyword, $locale, $priority ) { $languageID = eZContentLanguage::idByLocale( $locale ); if ( $languageID === false ) return; if ( $locale == $attribute->attribute( 'language_code' ) )...
Links the content object attribute and tag @static @param eZContentObjectAttribute $attribute @param eZTagsObject $tagObject @param string $keyword @param string $locale
entailment
public function tags() { if ( !is_array( $this->IDArray ) || empty( $this->IDArray ) ) return array(); $tags = array(); foreach ( eZTagsObject::fetchList( array( 'id' => array( $this->IDArray ) ) ) as $item ) { $tags[array_search( $item->attribute( 'id' ), $t...
Returns tags within this instance @return eZTagsObject[]
entailment
public function tagsCount() { if ( !is_array( $this->IDArray ) || empty( $this->IDArray ) ) return 0; return eZTagsObject::fetchListCount( array( 'id' => array( $this->IDArray ) ) ); }
Returns the count of tags within this instance @return int
entailment
public function metaKeywordString() { $tagKeywords = array_map( function( $tag ) { /** @var eZTagsObject $tag */ return $tag->attribute( 'keyword' ); }, $this->tags() ); return !empty( $tagKeywords ) ? implode( ', '...
Returns the keywords as a string @return string
entailment
public function up() { Schema::table('messages', function (Blueprint $table) { $table->dropForeign('messages_thread_id_foreign'); $table->dropForeign('messages_user_id_foreign'); }); Schema::table('participants', function (Blueprint $table) { $table->drop...
Run the migrations. @return void
entailment
public function generateEvent(EntityInterface $entity, UserInterface $user, array $data) { $user_url = $user->toUrl()->setAbsolute()->toString(); if ($entity instanceof FileInterface) { $entity_url = $entity->url(); $mimetype = $entity->getMimeType(); } else { $entity_url = $entity->...
{@inheritdoc}
entailment
public function execute(EntityInterface $entity = NULL, array &$normalized = NULL, array $context = NULL) { $config = $this->getConfiguration(); // Use a pre-configured field as the source of the additional @type. if (($entity->hasField($config['source_field'])) && (!empty($entity->get($config['sour...
{@inheritdoc}
entailment
public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $options = []; $fieldsArray = \Drupal::service('entity_field.manager')->getFieldMap(); foreach ($fieldsArray as $entity_type => $entity_fields) { foreach ($entity_fields as $field => $field_properties) { $opt...
{@inheritdoc}
entailment
protected function generateData(EntityInterface $entity) { $data = parent::generateData($entity); $data['source_field'] = $this->mediaSource->getSourceFieldName($entity->bundle()); return $data; }
{@inheritdoc}
entailment
public function evaluate() { if (empty($this->configuration['uri']) && !$this->isNegated()) { return TRUE; } $media = $this->getContextValue('media'); if (!$media) { return FALSE; } return $this->evaluateEntity($media); }
{@inheritdoc}
entailment
protected function _fixVersionTables(Event $event) { if (!preg_match('/Versions$/', $event->subject->viewVars['name'])) { return; } unset($event->subject->viewVars['rulesChecker']['version_id']); foreach ($event->subject->viewVars['associations']['belongsTo'] as $i => $a...
Removes unnecessary associations @param Event $event An Event instance @return void
entailment
protected function _checkAssociation(Event $event, $tableSuffix) { $subject = $event->subject; $connection = ConnectionManager::get($subject->viewVars['connection']); $schema = $connection->getSchemaCollection(); $versionTable = sprintf('%s_%s', Hash::get($event->subject->viewVars, ...
Attaches the behavior and modifies associations as necessary @param Event $event An Event instance @param string $tableSuffix a suffix for the primary table @return bool true if modified, false otherwise
entailment
protected function _modifyBelongsTo(Event $event) { $belongsTo = $event->subject->viewVars['associations']['belongsTo']; foreach ($belongsTo as $i => $association) { if ($association['alias'] !== 'Versions' || $association['foreignKey'] !== 'version_id') { continue; ...
Removes unnecessary belongsTo associations @param Event $event An Event instance @return array
entailment
protected function _modifyRulesChecker(Event $event) { $rulesChecker = $event->subject->viewVars['rulesChecker']; foreach ($rulesChecker as $key => $config) { if (Hash::get($config, 'extra') !== 'Versions' || $key !== 'version_id') { continue; } ...
Removes unnecessary rulesChecker entries @param Event $event An Event instance @return array
entailment
public function writeReport(Report $report): void { $xml = new \DOMDocument('1.0', 'UTF-8'); $root = $xml->createElement('checkstyle'); $root->setAttribute('version', APP_NAME . '-' . APP_VERSION); foreach ($report->getFiles() as $file) { $xmlFile = $xml->createElement(...
Writes a report in checkstyle XML format. @param Report $report The report to print. @return void
entailment
public function sort($field, $direction = self::SORT_DESC) { if(empty($this->data['sorts'])) { $this->data['sorts'] = array(); } $this->data['sorts'][] = array( 'field' => $field, 'direction' => $direction ); return $this; }
Add one level of sorting @return OpenSearchServer\Search\Search
entailment
public function collapsing($field, $max, $mode = self::COLLAPSING_MODE_OFF, $type = self::COLLAPSING_TYPE_FULL) { if(empty($this->data['collapsing'])) { $this->data['collapsing'] = array(); } $this->data['collapsing'] = array( 'field' => $field, 'mode' => $mode, 'type' => $type, 'max' => $max ); ...
Configure collapsing @return OpenSearchServer\Search\Search
entailment
public function facet($field, $min = 0, $multi = false, $postCollapsing = false) { if(empty($this->data['facets'])) { $this->data['facets'] = array(); } $this->data['facets'][] = array( 'field' => $field, 'minCount' => $min, 'multivalued' => $multi, 'postCollapsing' => $postCollapsing ); return...
Add a facet to search results @return OpenSearchServer\Search\Search
entailment
public function snippet($field, $tag = 'b', $separator = '...', $maxSize = 200, $maxNumber = 1, $fragmenter = self::SNIPPET_NO_FRAGMENTER) { if(empty($this->data['snippets'])) { $this->data['snippets'] = array(); } $this->data['snippets'][] = array( 'field' => $field, 'tag' => $tag, 'separator' => $se...
Add one snippet @return OpenSearchServer\Search\Search
entailment
public function scoring($field = null, $weight = 1, $ascending = false, $type = self::SCORING_FIELD_ORDER) { if(empty($this->data['scorings'])) { $this->data['scorings'] = array(); } $newScoring = array( 'ascending' => (boolean) $ascending, 'type' => $type, 'weight' => $weight ); if(!empty($field)...
Add one level of scoring @return OpenSearchServer\Search\Search
entailment
public function boostingQuery($query, $boost = 1) { if(empty($this->data['boostingQueries'])) { $this->data['boostingQueries'] = array(); } $newBoosting = array( 'patternQuery' => $query, 'boost' => $boost ); $this->data['boostingQueries'][] = $newBoosting; return $this; }
Add one boosting query @return OpenSearchServer\Search\Search
entailment
public function join($indexName, $queryTemplate, $queryString, $localField, $foreignField, $type = self::JOIN_INNER, $returnFields = true, $returnScores = false, $returnFacets = false) { if(empty($this->data['joins'])) { $this->data['joins'] = array(); } $this->data['joins'][] = array( 'indexName' => $index...
Add one join @return OpenSearchServer\Search\Search
entailment
public function sorts($sorts, $direction = self::SORT_DESC) { foreach($sorts as $sort) { $this->sort($sort, $direction); } return $this; }
Helper method: add several sorts @return OpenSearchServer\Search\Search
entailment
public function evaluate() { if (empty($this->configuration['uri']) && !$this->isNegated()) { return TRUE; } $media = $this->getContextValue('media'); if (!$media) { return FALSE; } $node = $this->utils->getParentNode($media); if (!$node) { return FALSE; } return $...
{@inheritdoc}
entailment
public function modify( $tpl, $operatorName, $operatorParameters, &$rootNamespace, &$currentNamespace, &$operatorValue, &$namedParameters ) { switch ( $operatorName ) { case 'eztagscloud': { $searchEngine = eZINI::instance()->variable( 'SearchSettings', 'Searc...
Executes the PHP function for the operator cleanup and modifies $operatorValue. @param eZTemplate $tpl @param string $operatorName @param array $operatorParameters @param string $rootNamespace @param string $currentNamespace @param mixed $operatorValue @param array $namedParameters
entailment
private function tagCloud( $params ) { $parentNodeID = 0; $classIdentifier = ''; $classIdentifierSQL = ''; $pathString = ''; $parentNodeIDSQL = ''; $dbParams = array(); $orderBySql = 'ORDER BY eztags.keyword ASC'; if ( isset( $params['class_identifier...
Returns the tag cloud for specified parameters using eZ Publish database @param array $params @return array
entailment
private function solrTagCloud( $params ) { $offset = 0; if( isset( $params['offset'] ) && is_numeric( $params['offset'] ) ) $offset = (int) $params['offset']; // It seems that Solr doesn't like PHP_INT_MAX constant on 64bit operating systems $limit = 1000000; if(...
Returns the tag cloud for specified parameters using eZ Find @param array $params @return array
entailment
private function normalizeTagCounts( &$tagsArray, $tagCounts ) { $maxFontSize = 200; $minFontSize = 100; $maxCount = max( $tagCounts ); $minCount = min( $tagCounts ); $spread = $maxCount - $minCount; if ( $spread == 0 ) $spread = 1; $step = ( $m...
Normalizes the count of tags to be able to be displayed properly on the page @param array $tagsArray @param array $tagCounts
entailment
public function connect($host, $ssl = false, $port = 21, $timeout = 90) { if ($ssl) { $this->connection = @ftp_ssl_connect($host, $port, $timeout); } else { $this->connection = @ftp_connect($host, $port, $timeout); } if ($this->connection == null) { ...
Opens a FTP connection @param string $host @param bool $ssl @param int $port @param int $timeout @return FTPClient
entailment
public function login($username = 'anonymous', $password = '') { $result = @ftp_login($this->connection, $username, $password); if ($result === false) { throw new Exception('Login incorrect'); } else { // set passive mode if (!is_null($this->passive)) { ...
Logins to FTP Server @param string $username @param string $password @return FTPClient
entailment
public function passive($passive = true) { $this->passive = $passive; if ($this->connection) { $result = ftp_pasv($this->connection, $passive); if ($result === false) { throw new Exception('Unable to change passive mode'); } } ret...
Changes passive mode,,, @param bool $passive @return FTPClient,
entailment
public function changeDirectory($directory) { $result = @ftp_chdir($this->connection, $directory); if ($result === false) { throw new Exception('Unable to change directory'); } return $this; }
Changes the current directory to the specified one @return FTPClient
entailment
public function createDirectory($directory) { $result = @ftp_mkdir($this->connection, $directory); if ($result === false) { throw new Exception('Unable to create directory'); } return $this; }
Creates a directory @param string $directory @return FTPClient
entailment
public function removeDirectory($directory) { $result = @ftp_rmdir($this->connection, $directory); if ($result === false) { throw new Exception('Unable to remove directory'); } return $this; }
Removes a directory @param string $directory @return FTPClient
entailment
public function listDirectory($directory) { $result = @ftp_nlist($this->connection, $directory); if ($result === false) { throw new Exception('Unable to list directory'); } asort($result); return $result; }
Returns a list of files in the given directory @param string $directory @return array
entailment
public function rawlistDirectory($parameters, $recursive = false) { $result = @ftp_rawlist($this->connection, $parameters, $recursive); if ($result === false) { throw new Exception('Unable to list directory'); } return $result; }
@param string $parameters @param bool $recursive @return array @throws \Exception
entailment
public function delete($path) { $result = @ftp_delete($this->connection, $path); if ($result === false) { throw new Exception('Unable to get parent folder'); } return $this; }
Deletes a file on the FTP server @param string $path @return FTPClient
entailment
public function size($remoteFile) { $size = @ftp_size($this->connection, $remoteFile); if ($size === -1) { throw new Exception('Unable to get file size'); } return $size; }
Returns the size of the given file. Return -1 on error @param string $remoteFile @return int
entailment
public function modifiedTime($remoteFile, $format = null) { $time = ftp_mdtm($this->connection, $remoteFile); if ( $time !== -1 && $format !== null ) { return date($format, $time); } else { return $time; } }
Returns the last modified time of the given file. Return -1 on error @param string $remoteFile @return int
entailment
public function rename($currentName, $newName) { $result = @ftp_rename($this->connection, $currentName, $newName); return $result; }
Renames a file or a directory on the FTP server @param string $currentName @param string $newName @return bool
entailment
public function get($localFile, $remoteFile, $resumePosision = 0) { $mode = $this->getMode(); $result = @ftp_get($this->connection, $localFile, $remoteFile, $mode, $resumePosision); if ($result === false) { throw new Exception(sprintf('Unable to get or save file "%s" fro...
Downloads a file from the FTP server @param string $localFile @param string $remoteFile @param int $mode @param int $resumepos @return FTPClient
entailment
public function put($remoteFile, $localFile, $startPosision = 0) { $mode = $this->getMode(); $result = @ftp_put($this->connection, $remoteFile, $localFile, $mode, $startPosision); if ($result === false) { throw new Exception('Unable to put file'); } retu...
Uploads from an open file to the FTP server @param string $remoteFile @param string $localFile @param int $mode @param int $startPosision @return FTPClient
entailment
public function fget($handle, $remoteFile, $resumePosision = 0) { $mode = $this->getMode(); $result = @ftp_fget($this->connection, $handle, $remoteFile, $mode, $resumePosision); if ($result === false) { throw new Exception('Unable to get file'); } return...
Downloads a file from the FTP server and saves to an open file @param resource $handle @param string $remoteFile @param int $mode @param int $resumepos @return FTPClient
entailment
public function fput($remoteFile, $handle, $startPosision = 0) { $mode = $this->getMode(); $result = @ftp_fput($this->connection, $remoteFile, $handle, $mode, $startPosision); if ($result === false) { throw new Exception('Unable to put file'); } return $...
Uploads from an open file to the FTP server @param string $remoteFile @param resource $handle @param int $mode @param int $startPosision @return FTPClient
entailment
public function getOption($option) { switch ($option) { case FTPClient::TIMEOUT_SEC: case FTPClient::AUTOSEEK: $result = @ftp_get_option($this->connection, $option); return $result; break; default: ...
Retrieves various runtime behaviours of the current FTP stream TIMEOUT_SEC | AUTOSEEK @param mixed $option @return mixed
entailment
public function setOption($option, $value) { switch ($option) { case FTPClient::TIMEOUT_SEC: if ($value <= 0) { throw new Exception('Timeout value must be greater than zero'); } break; case FTPClient::AUTOSEEK: ...
Set miscellaneous runtime FTP options TIMEOUT_SEC | AUTOSEEK @param mixed $option @param mixed $value @return mixed
entailment
public function allocate($filesize) { $result = @ftp_alloc($this->connection, $filesize); if ($result === false) { throw new Exception('Unable to allocate'); } return $this; }
Allocates space for a file to be uploaded @param int $filesize @return FTPClient
entailment
public function chmod($mode, $filename) { $result = @ftp_chmod($this->connection, $mode, $filename); if ($result === false) { throw new Exception('Unable to change permissions'); } return $this; }
Set permissions on a file via FTP @param int $mode @param string $filename @return FTPClient
entailment
public function exec($command) { $result = @ftp_exec($this->connection, $command); if ($result === false) { throw new Exception('Unable to exec command'); } return $this; }
Requests execution of a command on the FTP server @param string $command @return FTPClient
entailment
public function find($key) { if (isset($this->payload[$key])) { return $this->payload[$key]; } return null; }
Find a value from array with given key. @param $key @return mixed
entailment
protected function execute(InputInterface $input, OutputInterface $output): void { $configFilesOption = $input->getOption('config'); $outputOption = $input->getOption('output'); $formatOption = $input->getOption('format'); '@phan-var string $configFilesOption'; '@phan-var st...
Executes this command. @param InputInterface $input Input options. @param OutputInterface $output Output stream. @return void @throws BadOutputFileException
entailment
public function getIssues(): array { usort( $this->issues, function (Issue $a, Issue $b) { return $a->getLine() - $b->getLine(); } ); return $this->issues; }
Gets all issues for this file. The issues will be sorted by line numbers, not by order of addition to this report. @return Issue[] The issues for this file.
entailment
public function getIssuesBySeverity(string $severity): array { return array_values(array_filter($this->getIssues(), function(Issue $i) use ($severity) { return $i->getSeverity() === $severity; })); }
Gets all issues for this file that have a certain severity. @param string $severity The severity. Should be one of the Issue class' SEVERITY_* constants @return Issue[] All issues with the given severity
entailment
public function merge(File $other): self { $new = new static($this->filename); $new->issues = array_merge($this->issues, $other->issues); return $new; }
Merges this file report with another file report @param File $other The file report to merge this report with @return File The merged report
entailment
public function execute() { $methods = array_values($this->implementedEvents()); foreach ($methods as $method) { $this->dispatchEvent(sprintf('Bake.%s', $method), null, $this->event->subject); } }
Dispatches all the attached events @return void
entailment
public function isType($type) { $template = sprintf('Bake/%s.ctp', $type); return strpos($this->event->getData('0'), $template) !== false; }
Check whether or not a bake call is a certain type. @param string|array $type The type of file you want to check. @return bool Whether or not the bake template is the type you are checking.
entailment
public function implementedEvents() { $methodMap = [ 'config/routes' => 'beforeRenderRoutes', 'Controller/component' => 'beforeRenderComponent', 'Controller/controller' => 'beforeRenderController', 'Model/behavior' => 'beforeRenderBehavior', 'Model...
Get the callbacks this class is interested in. @return array
entailment
public function boot(Router $router) { Storage::extend('cloudinary', function ($app, $config) { return new Filesystem(new CloudinaryAdapter($config)); }); }
Bootstrap the application services. @return void
entailment
public function execute(EntityInterface $entity = NULL) { $config = $this->getConfiguration(); $action_ids = $config['actions']; foreach ($action_ids as $action_id) { $action = $this->actionStorage->load($action_id); $action->execute([$entity]); } }
{@inheritdoc}
entailment
public function buildConfigurationForm(array $form, FormStateInterface $form_state) { $actions = $this->actionStorage->loadMultiple(); foreach ($actions as $action) { $options[ucfirst($action->getType())][$action->id()] = $action->label(); } $config = $this->getConfiguration(); $form['actions...
{@inheritdoc}
entailment
public function version($versionId, $reset = false) { $versions = $this->versions($reset); if (empty($versions[$versionId])) { return null; } return $versions[$versionId]; }
Retrieves a specified version for the current entity @param int $versionId The version number to retrieve @param bool $reset If true, will re-retrieve the related version collection @return \Cake\ORM\Entity|null
entailment
public function versions($reset = false) { if ($reset === false && $this->has('_versions')) { return $this->get('_versions'); } /* * @var \Josegonzalez\Version\Model\Behavior\VersionBehavior $table * @var \Cake\Datasource\EntityInterface $this */ ...
Retrieves the related versions for the current entity @param bool $reset If true, will re-retrieve the related version collection @return \Cake\Collection\CollectionInterface
entailment
public function getData() { if(!empty($this->jsonText)) { return $this->jsonText; }elseif(!empty($this->jsonValues)) { return json_encode($this->jsonValues); } elseif(!empty($this->data)) { return json_encode($this->data); } return null; }
{@inheritdoc}
entailment
public static function create(ConfigFactoryInterface $config) { // Get broker url from config. $settings = $config->get(IslandoraSettingsForm::CONFIG_NAME); $brokerUrl = $settings->get(IslandoraSettingsForm::BROKER_URL); // Try a sensible default if one hasn't been configured. if (empty($brokerUrl)...
Factory function. @param \Drupal\Core\Config\ConfigFactoryInterface $config Config. @return \Stomp\StatefulStomp Stomp client.
entailment
protected function generateData(EntityInterface $entity) { $uri = $entity->getFileUri(); $scheme = $this->fileSystem->uriScheme($uri); $flysystem_config = Settings::get('flysystem'); $data = parent::generateData($entity); if (isset($flysystem_config[$scheme]) && $flysystem_config[$scheme]['driver']...
{@inheritdoc}
entailment
public function getSourceFieldName($media_type) { $bundle = $this->entityTypeManager->getStorage('media_type')->load($media_type); if (!$bundle) { throw new NotFoundHttpException("Bundle $media_type does not exist"); } $type_configuration = $bundle->get('source_configuration'); if (!isset($ty...
Gets the name of a source field for a Media. @param string $media_type Media bundle whose source field you are searching for. @return string|null Field name if it exists in configuration, else NULL.
entailment