<?php

require_once dirname(__FILE__) . '/DiamanteDeskRequirements.php';
require_once dirname(__FILE__) . '/autoload.php';
$diamanteDeskRequirements = new DiamanteDeskRequirements();
$iniPath = $diamanteDeskRequirements->getPhpIniConfigPath();
echo "*************************************\n";
echo "*                                   *\n";
echo "*  DiamanteDesk requirements check  *\n";
echo "*                                   *\n";
echo "*************************************\n\n";
echo $iniPath ? sprintf("* Configuration file used by PHP: %s\n\n", $iniPath) : "* WARNING: No configuration file (php.ini) used by PHP!\n\n";
echo "** ATTENTION **\n";
echo "*  The PHP CLI can use a different php.ini file\n";
echo "*  than the one used with your web server.\n";
if ('\\' == DIRECTORY_SEPARATOR) {
    echo "*  (especially on the Windows platform)\n";
}
echo "*  To be on the safe side, please also launch the requirements check\n";
echo "*  from your web server using the web/config.php script.\n";
echo_title('Mandatory requirements');
$checkPassed = true;
foreach ($diamanteDeskRequirements->getRequirements() as $req) {
    /** @var $req Requirement */
    echo_requirement($req);
    if (!$req->isFulfilled()) {
        $checkPassed = false;
    }
}
echo_title('Optional recommendations');
foreach ($diamanteDeskRequirements->getRecommendations() as $req) {
use Symfony\Component\HttpFoundation\Request;
require_once __DIR__ . '/../app/DiamanteDeskRequirements.php';
require_once __DIR__ . '/../app/autoload.php';
// check for installed system
$paramFile = __DIR__ . '/../app/config/parameters.yml';
if (file_exists($paramFile)) {
    $data = Yaml::parse($paramFile);
    if (is_array($data) && isset($data['parameters']) && isset($data['parameters']['installed']) && false != $data['parameters']['installed']) {
        exit('DiamanteDesk is already installed.');
    }
}
/**
 * @todo Identify correct locale (headers?)
 */
$locale = 'en';
$collection = new DiamanteDeskRequirements();
$translator = new Translator($locale);
$majorProblems = $collection->getFailedRequirements();
$minorProblems = $collection->getFailedRecommendations();
$translator->addLoader('yml', new YamlFileLoader());
$translator->addResource('yml', __DIR__ . '/../app/Resources/translations/install.' . $locale . '.yml', $locale);
function iterateRequirements(array $collection)
{
    foreach ($collection as $requirement) {
        ?>
        <tr>
            <td class="dark">
                <?php 
        if ($requirement->isFulfilled()) {
            ?>
                <span class="icon-yes">
 /**
  * @param OutputInterface $output
  *
  * @return $this
  * @throws \RuntimeException
  */
 protected function checkRequirementsStep(OutputInterface $output)
 {
     $output->writeln('<info>Requirements check:</info>');
     if (!class_exists('DiamanteDeskRequirements')) {
         require_once $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . 'DiamanteDeskRequirements.php';
     }
     $collection = new \DiamanteDeskRequirements();
     $this->renderTable($collection->getMandatoryRequirements(), 'Mandatory requirements', $output);
     $this->renderTable($collection->getPhpIniRequirements(), 'PHP settings', $output);
     $this->renderTable($collection->getOroRequirements(), 'Oro specific requirements', $output);
     $this->renderTable($collection->getDiamanteDeskRequirements(), 'DiamanteDesk requirements', $output);
     $this->renderTable($collection->getRecommendations(), 'Optional recommendations', $output);
     if (count($collection->getFailedRequirements())) {
         throw new \RuntimeException('Some system requirements are not fulfilled. Please check output messages and fix them.');
     }
     $output->writeln('');
     return $this;
 }