HEX
Server: Apache/2.2.22 (Debian)
System: Linux ns382018.ip-46-105-97.eu 3.14.32-xxxx-grs-ipv6-64 #9 SMP Thu Oct 20 14:53:52 CEST 2016 x86_64
User: web279 (5281)
PHP: 5.4.45-0+deb7u8
Disabled: NONE
Upload Files
File: /var/www/clients/client0/web279/web/MTDrubik/plugins/backwpup/inc/Notice/EnvironmentNotice.php
<?php

namespace Inpsyde\BackWPup\Notice;

use Inpsyde\EnvironmentChecker\EnvironmentChecker;
use Inpsyde\EnvironmentChecker\Exception\ConstraintFailedException;

/**
 * Class EnvironmentNotice
 *
 * @package Inpsyde\BackWPup\Notice
 */
abstract class EnvironmentNotice extends Notice
{
    /**
     * {@inheritdoc}
     */
    protected function render(NoticeMessage $message)
    {
        $this->view->warning($message, $this->getDismissActionUrl());
    }

/**
 * {@inheritdoc}
 */
    protected function isScreenAllowed()
    {
        return true;
    }

    /**
     * {@inheritdoc}
     */
    protected function shouldDisplay()
    {
        if (parent::shouldDisplay()) {
            $checker = new EnvironmentChecker($this->getConstraints());

            try {
                $checker->check();

                // Passed constraints, so do not display
                return false;
            } catch (ConstraintFailedException $e) {
                return true;
            }
        }

        return false;
    }

    /**
     * Returns list of constraints to check
     *
     * @return array The list of constraints
     */
    abstract protected function getConstraints();
}