Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00015 final class PrimitiveHttpUrl extends PrimitiveString
00016 {
00017 public function import($scope)
00018 {
00019 if (!$result = parent::import($scope))
00020 return $result;
00021
00022 try {
00023 $this->value = HttpUrl::create()->parse($this->value);
00024 } catch (WrongArgumentException $e) {
00025 $this->value = null;
00026
00027 return false;
00028 }
00029
00030 if (!$this->value->isValid()) {
00031 $this->value = null;
00032 return false;
00033 }
00034
00035 $this->value->normalize();
00036
00037 return true;
00038 }
00039
00040 public function importValue($value)
00041 {
00042 if ($value instanceof HttpUrl) {
00043
00044 return
00045 $this->import(
00046 array($this->getName() => $value->toString())
00047 );
00048 }
00049
00050 return parent::importValue(null);
00051 }
00052
00053 public function exportValue()
00054 {
00055 if (!$this->value)
00056 return null;
00057
00058 return $this->value->toString();
00059 }
00060 }
00061 ?>