Pop\I18n\I18n::factory PHP Method

factory() public static method

Static method to load the I18n object.
public static factory ( string $lang = null ) : I18n
$lang string
return I18n
    public static function factory($lang = null)
    {
        return new self($lang);
    }

Usage Example

 /**
  * Method to evaluate the validator
  *
  * @param  mixed $input
  * @throws Exception
  * @return boolean
  */
 public function evaluate($input = null)
 {
     // Check to make sure the input is a valid Ipv4 address.
     $ip = new Ipv4();
     if (!Ipv4::factory()->evaluate($input)) {
         throw new Exception('The IP address must be a valid IPv4 address.');
     }
     // Set the input, if passed
     if (null !== $input) {
         $this->input = $input;
     }
     // Set the default message
     if (null === $this->defaultMessage) {
         if ($this->condition) {
             $this->defaultMessage = I18n::factory()->__('The value must be part of the subnet %1.', $this->value);
         } else {
             $this->defaultMessage = I18n::factory()->__('The value must not be part of the subnet %1.', $this->value);
         }
     }
     // Evaluate the input against the validator
     if ((substr($this->input, 0, strrpos($this->input, '.')) == $this->value) == $this->condition) {
         $this->result = true;
     } else {
         $this->result = false;
     }
     return $this->result;
 }
All Usage Examples Of Pop\I18n\I18n::factory