Review sync.

@return array
197696
public function reviewSync()
    {
        //find orders to review and register campaign
        $this->orderFactory->create()
            ->createReviewCampaigns();
        //sync reviews
        $result = $this->reviewFactory->create()
            ->sync();

        return $result;
    }
289095
public function getChecks()
	{
		$client = new \Guzzle\Service\Client('https://api.pingdom.com/api/2.0');

		/** @var $request \Guzzle\Http\Message\Request */
		$request = $client->get('checks', array('App-Key' => $this->token));
		$request->setAuth($this->username, $this->password);
		$response = $request->send();
		$response = json_decode($response->getBody(), true);

		return $response['checks'];
	}
217587
public function getIssues()
	{
		if ( isset($this->result['issues']) ) {
			$result = array();

			foreach ( $this->result['issues'] as $issue ) {
				$result[] = new Issue($issue);
			}

			return $result;
		}

		return array();
	}
770201
public function getIssues(): array
    {
        usort(
            $this->issues,
            function (Issue $a, Issue $b) {
                return $a->getLine() - $b->getLine();
            }
        );
        return $this->issues;
    }
1287633
public function check()
    {
        $current = $this->getCurrentUptime();

        $inTrouble =
            $current['load_1'] > $this->target->maxLoad['load_1'] ||
            $current['load_5'] > $this->target->maxLoad['load_5'] ||
            $current['load_15'] > $this->target->maxLoad['load_15'];

        return $this->makeResult(! $inTrouble, $this->makeMessage($current));
    }
1047301
protected function getSyncMaps() {
        if (!$this->_syncMaps) {
            $this->_syncMaps = new SyncMapList($this->version, $this->solution['sid']);
        }

        return $this->_syncMaps;
    }
5038
public function compare()
    {
        $remoteRevision = null;
        $filesToUpload = array();
        $filesToDelete = array();

        // The revision file goes inside the submodule.
        if ($this->isSubmodule) {
            $this->revisionFile = $this->isSubmodule . '/' . $this->revisionFile;
        }

        if ($this->bridge->exists($this->revisionFile)) {
            $remoteRevision = $this->bridge->get($this->revisionFile);

            $message = "\r\n» Taking it from '" . substr($remoteRevision, 0, 7) . "'";
        } else {
            $message = "\r\n» Fresh deployment - grab a coffee";
        }

        // A remote version exists.
        if ($remoteRevision) {
            // Get the files from the diff.
            $output = $this->git->diff($remoteRevision);

            foreach ($output as $line) {
                // Added, changed or modified.
                if ($line[0] == 'A' or $line[0] == 'C' or $line[0] == 'M') {
                    $filesToUpload[] = trim(substr($line, 1));
                }
                // Deleted.
                elseif ($line[0] == 'D') {
                    $filesToDelete[] = trim(substr($line, 1));
                }
                // Unknown status.
                else {
                    throw new Exception("Unknown git-diff status: {$line[0]}");
                }
            }
        }
        // No remote version. Get all files.
        else {
            $filesToUpload = $this->git->files();
        }

        // Remove ignored files from the list of uploads.
        $filesToUpload = array_diff($filesToUpload, $this->ignoredFiles);

        $this->filesToUpload = $filesToUpload;
        $this->filesToDelete = $filesToDelete;

        return $message;
    }
816742
public function &GetReviewsPublished()
    {
        $oReviews = $this->GetFromInternalCache('oPublishedReviews');
        if (is_null($oReviews)) {
            $oReviews = &TdbShopArticleReviewList::GetPublishedReviews($this->id, $this->iLanguageId);
            $this->SetInternalCache('oPublishedReviews', $oReviews);
        }

        return $oReviews;
    }
198411
public function getStatusesHuman()
    {
        return [
            self::STATUS_PENDING          => 'Pending',
            self::STATUS_PROCESSING       => 'Processing',
            self::STATUS_COMPLETE         => 'Complete',
            self::STATUS_FAILED           => 'Failed',
            self::STATUS_REFUNDED         => 'Refunded',
            self::STATUS_REFUNDED_PARTIAL => 'Partially Refunded',
        ];
    }
651057
public function getStatus() : array
    {

        return [
            'status'        => $this->engine->getStats(),
            'version'       => $this->engine->getVersion(),
            'server_list'   => $this->engine->getServerList()
        ];
    }
1044881
public function getSnaps() {
		$updates = $this->getUpdates();

		if (empty($updates)) {
			return FALSE;
		}

		// We'll make these a little more readable.
		$snaps = array();
		foreach ($updates->snaps as $snap) {
			$snaps[] = (object) array(
				'id' => $snap->id,
				'media_id' => empty($snap->c_id) ? FALSE : $snap->c_id,
				'media_type' => $snap->m,
				'time' => empty($snap->t) ? FALSE : $snap->t,
				'sender' => empty($snap->sn) ? $this->username : $snap->sn,
				'recipient' => empty($snap->rp) ? $this->username : $snap->rp,
				'status' => $snap->st,
				'screenshot_count' => empty($snap->c) ? 0 : $snap->c,
				'sent' => $snap->sts,
				'opened' => $snap->ts,
				'broadcast' => empty($snap->broadcast) ? FALSE : (object) array(
					'url' => $snap->broadcast_url,
					'action_text' => $snap->broadcast_action_text,
					'hide_timer' => $snap->broadcast_hide_timer,
				),
			);
		}

		return $snaps;
	}
200370
public function sync()
    {
        $response = ['success' => true, 'message' => 'Done.'];

        // Initialise a return hash containing results of our sync attempt
        $this->searchWebsiteAccounts();

        foreach ($this->accounts as $account) {
            $orders = $account->getOrders();
            $ordersForSingleSync = $account->getOrdersForSingleSync();
            $numOrders = count($orders);
            $numOrdersForSingleSync = count($ordersForSingleSync);
            $website = $account->getWebsites();
            $this->countOrders += $numOrders;
            $this->countOrders += $numOrdersForSingleSync;
            //create bulk
            if ($numOrders) {
                $this->helper->log('--------- Order sync ---------- : ' . $numOrders);
                //queue order into importer
                $this->importerFactory->create()
                    ->registerQueue(
                        \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_ORDERS,
                        $orders,
                        \Dotdigitalgroup\Email\Model\Importer::MODE_BULK,
                        $website[0]
                    );
            }
            //create single
            if ($numOrdersForSingleSync) {
                $this->createSingleImports($ordersForSingleSync, $website);
            }

            //mark the orders as imported
            $this->orderResource->setImported($this->orderIds);

            unset($this->accounts[$account->getApiUsername()]);
        }

        /**
         * Add guests to contact table.
         */
        if (! empty($this->guests)) {
            $orderEmails = array_keys($this->guests);
            $guestsEmailFound = $this->contactCollectionFactory->create()
                ->addFieldToFilter('email', ['in' => $orderEmails])
                ->getColumnValues('email');
            //remove the contacts that already exists
            foreach ($guestsEmailFound as $email) {
                unset($this->guests[strtolower($email)]);
            }

            //insert new guests contacts
            $this->contactResource->insertGuests($this->guests);
            //mark the existing contacts with is guest in bulk
            $this->contactResource->updateContactsAsGuests($guestsEmailFound);
        }

        if ($this->countOrders) {
            $response['message'] = 'Orders updated ' . $this->countOrders;
        }

        return $response;
    }
341782
public function check()
    {
        $response = Director::test($this->url);

        if ($response->getStatusCode() != 200) {
            return [
                EnvironmentCheck::ERROR,
                sprintf('Error retrieving "%s" (Code: %d)', $this->url, $response->getStatusCode())
            ];
        } elseif ($this->testString && (strpos($response->getBody(), $this->testString) === false)) {
            return [
                EnvironmentCheck::WARNING,
                sprintf('Success retrieving "%s", but string "%s" not found', $this->url, $this->testString)
            ];
        }
        return [
            EnvironmentCheck::OK,
            sprintf('Success retrieving "%s"', $this->url)
        ];
    }
567163
private function getReview()
    {
        $review = [];
        $review_area = $this->_parser->find('.js-scrollfix-bottom-rel', 0);
        $review_area = $review_area->find('table tr', 1);
        $review_area = $review_area->find('.borderDark');
        foreach ($review_area as $each_review) {
            $tmp = [];

            $top_area = $each_review->find('.spaceit', 0);
            $bottom_area = $top_area->next_sibling();
            $very_bottom_area = $bottom_area->next_sibling();

            $tmp['id'] = $this->getReviewId($very_bottom_area);
            $tmp['username'] = $this->getReviewUser($top_area);
            $tmp['image'] = $this->getReviewImage($top_area);
            $tmp['helpful'] = $this->getReviewHelpful($top_area);
            $tmp['date'] = $this->getReviewDate($top_area);
            if ($this->_type == 'anime') {
                $tmp['episode'] = $this->getReviewEpisode($top_area);
            } else {
                $tmp['chapter'] = $this->getReviewEpisode($top_area);
            }
            $tmp['score'] = $this->getReviewScore($bottom_area);
            $tmp['review'] = $this->getReviewText($bottom_area);

            $review[] = $tmp;
        }

        return $review;
    }
145050
protected function GetReviews()
    {
        $oActiveArticle = TdbShop::GetActiveItem();
        $oReviewList = null;
        if ($oActiveArticle) {
            $oReviewList = $this->GetReviewsForArticle($oActiveArticle);
        } else {
            $oReviewList = $this->GetReviewsForUser();
        }

        return $oReviewList;
    }
278810
public function getStatusSummary()
    {
        $map = [
            'total' => Slave::ANY,
            'ready' => Slave::READY,
            'busy' => Slave::BUSY,
            'created' => Slave::CREATED,
            'registered' => Slave::REGISTERED,
            'closed' => Slave::CLOSED
        ];

        return array_map(function ($state) {
            return count($this->getByStatus($state));
        }, $map);
    }
1241020
protected function getSyncStreams() {
        if (!$this->_syncStreams) {
            $this->_syncStreams = new SyncStreamList($this->version, $this->solution['sid']);
        }

        return $this->_syncStreams;
    }