Overview

Namespaces

  • PHP
  • PhpOptions
    • Types

Classes

  • AType
  • CharType
  • DatetimeType
  • DateType
  • DirectoryType
  • EmailType
  • EnumType
  • FileType
  • InifileType
  • IntegerType
  • RealType
  • SeriesType
  • StringType
  • TimeType
  • Types
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: /**
 4:  * PhpOptions
 5:  * @link https://github.com/masicek/PhpOptions
 6:  * @author Viktor Mašíček <viktor@masicek.net>
 7:  * @license "New" BSD License
 8:  */
 9: 
10: namespace PhpOptions\Types;
11: 
12: require_once __DIR__ . '/AType.php';
13: 
14: /**
15:  * Series/Array type
16:  *
17:  * @author Viktor Mašíček <viktor@masicek.net>
18:  */
19: class SeriesType extends AType
20: {
21: 
22:     /**
23:      * List of delimiters for explode input value into array
24:      *
25:      * @var string
26:      */
27:     private $delimiters = ', ;|';
28: 
29: 
30:     /**
31:      * Set object
32:      *
33:      * @param array $setting Array of setting of object
34:      */
35:     public function __construct($settings = array())
36:     {
37:         parent::__construct($settings);
38:         if (isset($settings[0]))
39:         {
40:             $this->delimiters = $settings[0];
41:         }
42:     }
43: 
44: 
45:     /**
46:      * Return uppercase name of type
47:      *
48:      * @return string
49:      */
50:     public function getName()
51:     {
52:         return 'ARRAY';
53:     }
54: 
55: 
56:     /**
57:      * Return modified value
58:      *
59:      * @param mixed $value Filtered value
60:      *
61:      * @return mixed
62:      */
63:     protected function useFilter($value)
64:     {
65:         if (is_array($value))
66:         {
67:             return $value;
68:         }
69: 
70:         $value = preg_replace('/[' . $this->delimiters . ']+/', $this->delimiters[0], $value);
71:         return explode($this->delimiters[0], $value);
72:     }
73: 
74: 
75: }
76: 
PhpOptions API documentation generated by ApiGen.
Generated using the TokenReflection library.