00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00016 final class ExplodedPrimitive extends PrimitiveString
00017 {
00018 protected $separator = ' ';
00019 protected $splitByRegexp = false;
00020
00024 public function setSeparator($separator)
00025 {
00026 $this->separator = $separator;
00027
00028 return $this;
00029 }
00030
00031 public function getSeparator()
00032 {
00033 return $this->separator;
00034 }
00035
00036 public function setSplitByRegexp($splitByRegexp = false)
00037 {
00038 $this->splitByRegexp = ($splitByRegexp === true);
00039
00040 return $this;
00041 }
00042
00043 public function isSplitByRegexp()
00044 {
00045 return $this->splitByRegexp;
00046 }
00047
00048 public function import($scope)
00049 {
00050 if (!$result = parent::import($scope))
00051 return $result;
00052
00053 if (
00054 $this->value =
00055 $this->isSplitByRegexp()
00056 ?
00057 preg_split(
00058 $this->separator,
00059 $this->value,
00060 -1,
00061 PREG_SPLIT_NO_EMPTY
00062 )
00063 : explode($this->separator, $this->value)
00064 ) {
00065 return true;
00066 } else {
00067 return false;
00068 }
00069
00070 Assert::isUnreachable();
00071 }
00072 }
00073 ?>