/**
  * Create an array containing only the available command property values.
  *
  * @param \Searchperience\Api\Client\Domain\AbstractEntity  $command
  * @return array
  */
 protected function buildRequestArray(\Searchperience\Api\Client\Domain\AbstractEntity $command)
 {
     $valueArray = array();
     /** @var $command \Searchperience\Api\Client\Domain\Command\AbstractCommand */
     $valueArray['name'] = $command->getName();
     $arguments = $command->getArguments();
     foreach ($arguments as $argumentKey => $argumentValue) {
         $valueArray['arguments'][$argumentKey] = $argumentValue;
     }
     return $valueArray;
 }
 /**
  * Create an array containing only the available urlqueue property values.
  *
  * @param \Searchperience\Api\Client\Domain\UrlQueueItem\UrlQueueItem $urlQueue
  * @return array
  */
 protected function buildRequestArray(\Searchperience\Api\Client\Domain\AbstractEntity $urlQueue)
 {
     $valueArray = array();
     if (!is_null($urlQueue->getDeleted()) && !$urlQueue->getDeleted()) {
         $valueArray['deleted'] = 0;
     }
     if (!is_null($urlQueue->getDocumentId())) {
         $valueArray['documentId'] = $urlQueue->getDocumentId();
     }
     //only reset allowed
     if (!is_null($urlQueue->getFailCount()) && $urlQueue->getFailCount() == 0) {
         $valueArray['failCount'] = $urlQueue->getFailCount();
     }
     if (!is_null($urlQueue->getPriority())) {
         $valueArray['priority'] = $urlQueue->getPriority();
     }
     if (!is_null($urlQueue->getUrl())) {
         $valueArray['url'] = $urlQueue->getUrl();
     }
     // documentId is readonly and will not be persistet
     // lastError is readonly and will not be persistet
     // processingStartTime is readonly and will not be persistet
     // processingThreadId is readonly and will not be persistet
     return $valueArray;
 }
 /**
  * @param \Searchperience\Api\Client\Domain\AbstractEntity $enrichment
  * @return array
  */
 protected function buildRequestArray(\Searchperience\Api\Client\Domain\AbstractEntity $enrichment)
 {
     $valueArray = array();
     if (!is_null($enrichment->getId())) {
         $valueArray['id'] = $enrichment->getId();
     }
     if (!is_null($enrichment->getDescription())) {
         $valueArray['description'] = $enrichment->getDescription();
     }
     if (!is_null($enrichment->getEnabled())) {
         $valueArray['status'] = $enrichment->getEnabled() ? 1 : 0;
     }
     if (!is_null($enrichment->getTitle())) {
         $valueArray['title'] = $enrichment->getTitle();
     }
     if (!is_null($enrichment->getAddBoost())) {
         $valueArray['addBoost'] = $enrichment->getAddBoost();
     }
     if (!is_null($enrichment->getMatchingRulesCombinationType())) {
         $valueArray['matchingRuleCombinationType'] = $enrichment->getMatchingRulesCombinationType();
     }
     if (!is_null($enrichment->getMatchingRulesExpectedResult())) {
         $valueArray['matchingRuleExpectedResult'] = $enrichment->getMatchingRulesExpectedResult() ? 1 : 0;
     }
     foreach ($enrichment->getFieldEnrichments() as $key => $fieldEnrichment) {
         /**
          * @var $fieldEnrichment FieldEnrichment
          */
         $data = array();
         $data['fieldName'] = $fieldEnrichment->getFieldName();
         $data['content'] = $fieldEnrichment->getContent();
         $valueArray['fieldEnrichments'][$key] = $data;
     }
     foreach ($enrichment->getMatchingRules() as $key => $matchingRule) {
         /**
          * @var $matchingRule MatchingRule
          */
         $data = array();
         $data['fieldName'] = $matchingRule->getFieldName();
         $data['operator'] = $matchingRule->getOperator();
         $data['operandValue'] = $matchingRule->getOperandValue();
         $valueArray['matchingRules'][$key] = $data;
     }
     $valueArray['contextsBoosting'] = [];
     /** @var ContextsBoostingCollection $enrichmentContextsBoostingCollection */
     $enrichmentContextsBoostingCollection = $enrichment->getContextsBoosting();
     if ($enrichmentContextsBoostingCollection->getCount() != 0) {
         foreach ($enrichmentContextsBoostingCollection as $key => $contextsBoosting) {
             /** @var ContextsBoosting $contextsBoosting */
             $data = [];
             $data['boostFieldName'] = $contextsBoosting->getBoostFieldName();
             $data['boostFieldValue'] = $contextsBoosting->getBoostFieldValue();
             $data['boostOptionName'] = $contextsBoosting->getBoostOptionName();
             $data['boostOptionValue'] = (bool) (int) $contextsBoosting->getBoostOptionValue() ? 1 : 0;
             $data['boostingValue'] = (double) $contextsBoosting->getBoostingValue();
             $valueArray['contextsBoosting'][$key] = $data;
         }
     }
     return $valueArray;
 }
 /**
  * Creates an data array the is send by postRequest for a stopword
  *
  * @param \Searchperience\Api\Client\Domain\AbstractEntity $stopword
  * @return array
  */
 protected function buildRequestArray(\Searchperience\Api\Client\Domain\AbstractEntity $stopword)
 {
     $valueArray = array();
     /** @var \Searchperience\Api\Client\Domain\Stopword\Stopword $stopword */
     if (!is_null($stopword->getWord())) {
         $valueArray['word'] = $stopword->getWord();
     }
     if (!is_null($stopword->getTagName())) {
         $valueArray['tagName'] = $stopword->getTagName();
     }
     return $valueArray;
 }
 /**
  * Create an array containing only the available indexer command log property values.
  *
  * @param \Searchperience\Api\Client\Domain\AbstractEntity $commandLog
  * @return array
  */
 protected function buildRequestArray(\Searchperience\Api\Client\Domain\AbstractEntity $commandLog)
 {
     $valueArray = array();
     if (!is_null($commandLog->getCommandName())) {
         $valueArray['commandName'] = $commandLog->getCommandName();
     }
     if (!is_null($commandLog->getProcessId())) {
         $valueArray['processId'] = $commandLog->getProcessId();
     }
     if (!is_null($commandLog->getStatus())) {
         $valueArray['status'] = $commandLog->getStatus();
     }
     if ($commandLog->getStartTime() instanceof \DateTime) {
         $valueArray['startTime'] = $this->dateTimeService->getDateStringFromDateTime($commandLog->getStartTime());
     }
     if (!is_null($commandLog->getDuration())) {
         $valueArray['duration'] = $commandLog->getDuration();
     }
     if (!is_null($commandLog->getLogMessage())) {
         $valueArray['logMessage'] = $commandLog->getLogMessage();
     }
     return $valueArray;
 }
 /**
  * Creates an data array the is send by postRequest for a synonym
  *
  * @param \Searchperience\Api\Client\Domain\AbstractEntity $synonym
  * @return array
  */
 protected function buildRequestArray(\Searchperience\Api\Client\Domain\AbstractEntity $synonym)
 {
     $valueArray = array();
     /** @var \Searchperience\Api\Client\Domain\Synonym\Synonym $synonym */
     if (!is_null($synonym->getSynonyms())) {
         $valueArray['synonyms'] = $synonym->getSynonyms();
     }
     if (!is_null($synonym->getTagName())) {
         $valueArray['tagName'] = $synonym->getTagName();
     }
     if (!is_null($synonym->getType())) {
         $valueArray['type'] = $synonym->getType();
     }
     if (!is_null($synonym->getMappedWords())) {
         $valueArray['mappedWords'] = $synonym->getMappedWords();
     }
     return $valueArray;
 }
 /**
  * Create an array containing only the available activity logs property values.
  *
  * @param \Searchperience\Api\Client\Domain\AbstractEntity $activityLogs
  * @return array
  */
 protected function buildRequestArray(\Searchperience\Api\Client\Domain\AbstractEntity $activityLogs)
 {
     $valueArray = array();
     if (!is_null($activityLogs->getId())) {
         $valueArray['id'] = $activityLogs->getId();
     }
     if ($activityLogs->getLogTime() instanceof \DateTime) {
         $valueArray['logTime'] = $this->dateTimeService->getDateStringFromDateTime($activityLogs->getLogTime());
     }
     if (!is_null($activityLogs->getProcessId())) {
         $valueArray['processId'] = $activityLogs->getProcessId();
     }
     if (!is_null($activityLogs->getSeverity())) {
         $valueArray['severity'] = $activityLogs->getSeverity();
     }
     if (!is_null($activityLogs->getMessage())) {
         $valueArray['message'] = $activityLogs->getMessage();
     }
     if (!is_null($activityLogs->getAdditionalData())) {
         $valueArray['additionalData'] = $activityLogs->getAdditionalData();
     }
     if (!is_null($activityLogs->getPackageKey())) {
         $valueArray['packageKey'] = $activityLogs->getPackageKey();
     }
     if (!is_null($activityLogs->getClassName())) {
         $valueArray['className'] = $activityLogs->getClassName();
     }
     if (!is_null($activityLogs->getMethodName())) {
         $valueArray['methodName'] = $activityLogs->getMethodName();
     }
     if (!is_null($activityLogs->getTag())) {
         $valueArray['tag'] = $activityLogs->getTag();
     }
     return $valueArray;
 }
 /**
  * Create an array containing only the available document property values.
  *
  * @param \Searchperience\Api\Client\Domain\Document\Document $document
  * @return array
  */
 protected function buildRequestArray(\Searchperience\Api\Client\Domain\AbstractEntity $document)
 {
     $valueArray = array();
     if ($document->getLastProcessingDate() instanceof \DateTime) {
         $valueArray['lastProcessing'] = $this->dateTimeService->getDateStringFromDateTime($document->getLastProcessingDate());
     }
     if (!is_null($document->getBoostFactor())) {
         $valueArray['boostFactor'] = $document->getBoostFactor();
     }
     if (!is_null($document->getIsProminent())) {
         $valueArray['isProminent'] = $document->getIsProminent();
     }
     if (!is_null($document->getIsMarkedForProcessing())) {
         $valueArray['isMarkedForProcessing'] = $document->getIsMarkedForProcessing();
     }
     if (!is_null($document->getIsMarkedForDeletion())) {
         $valueArray['isMarkedForDeletion'] = $document->getIsMarkedForDeletion();
     }
     if (!is_null($document->getNoIndex())) {
         $valueArray['noIndex'] = $document->getNoIndex();
     }
     if (!is_null($document->getForeignId())) {
         $valueArray['foreignId'] = $document->getForeignId();
     }
     if (!is_null($document->getUrl())) {
         $valueArray['url'] = $document->getUrl();
     }
     if (!is_null($document->getSource())) {
         $valueArray['source'] = $document->getSource();
     }
     if (!is_null($document->getMimeType())) {
         $valueArray['mimeType'] = $document->getMimeType();
     }
     if (!is_null($document->getContent())) {
         $valueArray['content'] = $document->getContent();
     }
     if (!is_null($document->getGeneralPriority())) {
         $valueArray['generalPriority'] = $document->getGeneralPriority();
     }
     if (!is_null($document->getTemporaryPriority())) {
         $valueArray['temporaryPriority'] = $document->getTemporaryPriority();
     }
     if (!is_null($document->getPageRank())) {
         $valueArray['pageRank'] = $document->getPageRank();
     }
     if (!is_null($document->getSolrCoreHints())) {
         $valueArray['solrCoreHints'] = $document->getSolrCoreHints();
     }
     return $valueArray;
 }