vendor/pimcore/pimcore/lib/Tool/Requirements/Check.php line 21

Open in your IDE?
  1. <?php
  2. /**
  3.  * Pimcore
  4.  *
  5.  * This source file is available under two different licenses:
  6.  * - GNU General Public License version 3 (GPLv3)
  7.  * - Pimcore Commercial License (PCL)
  8.  * Full copyright and license information is available in
  9.  * LICENSE.md which is distributed with this source code.
  10.  *
  11.  *  @copyright  Copyright (c) Pimcore GmbH (http://www.pimcore.org)
  12.  *  @license    http://www.pimcore.org/license     GPLv3 and PCL
  13.  */
  14. namespace Pimcore\Tool\Requirements;
  15. /**
  16.  * @internal
  17.  */
  18. final class Check implements \ArrayAccess
  19. {
  20.     const STATE_OK 1;
  21.     const STATE_WARNING 2;
  22.     const STATE_ERROR 3;
  23.     /**
  24.      * @var string
  25.      */
  26.     public $name;
  27.     /**
  28.      * @var string
  29.      */
  30.     public $link;
  31.     /**
  32.      * @var string
  33.      */
  34.     public $state;
  35.     /**
  36.      * @var string
  37.      */
  38.     public $message;
  39.     /**
  40.      * Check constructor.
  41.      *
  42.      * @param array $data
  43.      */
  44.     public function __construct(array $data = [])
  45.     {
  46.         foreach ($data as $key => $value) {
  47.             $this->$key $value;
  48.         }
  49.     }
  50.     /**
  51.      * @return string
  52.      */
  53.     public function getName()
  54.     {
  55.         return $this->name;
  56.     }
  57.     /**
  58.      * @param string $name
  59.      */
  60.     public function setName($name)
  61.     {
  62.         $this->name $name;
  63.     }
  64.     /**
  65.      * @return string
  66.      */
  67.     public function getLink()
  68.     {
  69.         return $this->link;
  70.     }
  71.     /**
  72.      * @param string $link
  73.      */
  74.     public function setLink($link)
  75.     {
  76.         $this->link $link;
  77.     }
  78.     /**
  79.      * @return string
  80.      */
  81.     public function getState()
  82.     {
  83.         return $this->state;
  84.     }
  85.     /**
  86.      * @param string $state
  87.      */
  88.     public function setState($state)
  89.     {
  90.         $this->state $state;
  91.     }
  92.     /**
  93.      * @return string
  94.      */
  95.     public function getMessage()
  96.     {
  97.         if (empty($this->message)) {
  98.             return $this->getName() . ' is required.';
  99.         }
  100.         return $this->message;
  101.     }
  102.     /**
  103.      * @param string $message
  104.      */
  105.     public function setMessage($message)
  106.     {
  107.         $this->message $message;
  108.     }
  109.     /**
  110.      * @param string $offset
  111.      *
  112.      * @return bool
  113.      */
  114.     public function offsetExists($offset)
  115.     {
  116.         return isset($this->$offset);
  117.     }
  118.     /**
  119.      * @param string $offset
  120.      *
  121.      * @return string
  122.      */
  123.     public function offsetGet($offset)
  124.     {
  125.         return $this->{'get'.$offset}();
  126.     }
  127.     /**
  128.      * @param string $offset
  129.      * @param string $value
  130.      */
  131.     public function offsetSet($offset$value)
  132.     {
  133.         $this->{'set'.$offset}($value);
  134.     }
  135.     /**
  136.      * @param string $offset
  137.      */
  138.     public function offsetUnset($offset)
  139.     {
  140.         unset($this->$offset);
  141.     }
  142. }