public function cast($property, $type, $useFactory = false) {
		foreach($this->_data as &$data) {
			if (! array_key_exists($property, $data)) {
				continue;
			}
			
			if (is_string($type)) {
				if ($useFactory) {
					$data[$property] = $type::factory($data[$property]);
				} else {
					$data[$property] = new $type($data[$property]);
				}
				
				continue;
			} elseif ($type === self::TYPE_MODEL) {
				$modelClass = $this->getModel();
			}
			
			switch ($type) {
				case self::TYPE_BOOL:
					$data[$property] = (bool) $data[$property];
					break;
				
				case self::TYPE_INT:
					$data[$property] = (int) $data[$property];
					break;
				
				case self::TYPE_FLOAT:
					$data[$property] = (float) $data[$property];
					break;
				
				case self::TYPE_DOUBLE:
					$data[$property] = (double) $data[$property];
					break;
				
				case self::TYPE_STRING:
					$data[$property] = (string) $data[$property];
					break;
				
				case self::TYPE_ARRAY:
					$data[$property] = (array) $data[$property];
					break;
				
				case self::TYPE_OBJECT:
					$data[$property] = (object) $data[$property];
					break;
				
				case self::TYPE_MODEL:
					$data[$property] = $modelClass::factory($data[$property]);
					break;
				
				case self::TYPE_COLLECTION:
					$data[$property] = static::factory($data[$property]);
					break;
			}
		}
		
		return $this;
	}
public function cast($property, $type, $useFactory = false) {
		foreach($this->_data as &$data) {
			if (! array_key_exists($property, $data)) {
				continue;
			}
			
			if (is_string($type)) {
				if ($useFactory) {
					$data[$property] = $type::factory($data[$property]);
				} else {
					$data[$property] = new $type($data[$property]);
				}
				
				continue;
			} elseif ($type === self::TYPE_MODEL) {
				$modelClass = $this->getModel();
			}
			
			switch ($type) {
				case self::TYPE_BOOL:
					$data[$property] = (bool) $data[$property];
					break;
				
				case self::TYPE_INT:
					$data[$property] = (int) $data[$property];
					break;
				
				case self::TYPE_FLOAT:
					$data[$property] = (float) $data[$property];
					break;
				
				case self::TYPE_DOUBLE:
					$data[$property] = (double) $data[$property];
					break;
				
				case self::TYPE_STRING:
					$data[$property] = (string) $data[$property];
					break;
				
				case self::TYPE_ARRAY:
					$data[$property] = (array) $data[$property];
					break;
				
				case self::TYPE_OBJECT:
					$data[$property] = (object) $data[$property];
					break;
				
				case self::TYPE_MODEL:
					$data[$property] = $modelClass::factory($data[$property]);
					break;
				
				case self::TYPE_COLLECTION:
					$data[$property] = static::factory($data[$property]);
					break;
			}
		}
		
		return $this;
	}
public function cast ( $ property , $ type , $ useFactory = false ) { foreach ( $ this -> _data as & $ data ) { if ( ! array_key_exists ( $ property , $ data ) ) { continue ; } if ( is_string ( $ type ) ) { if ( $ useFactory ) { $ data [ $ property ] = $ type :: factory ( $ data [ $ property ] ) ; } else { $ data [ $ property ] = new $ type ( $ data [ $ property ] ) ; } continue ; } elseif ( $ type === self :: TYPE_MODEL ) { $ modelClass = $ this -> getModel ( ) ; } switch ( $ type ) { case self :: TYPE_BOOL : $ data [ $ property ] = ( bool ) $ data [ $ property ] ; break ; case self :: TYPE_INT : $ data [ $ property ] = ( int ) $ data [ $ property ] ; break ; case self :: TYPE_FLOAT : $ data [ $ property ] = ( float ) $ data [ $ property ] ; break ; case self :: TYPE_DOUBLE : $ data [ $ property ] = ( double ) $ data [ $ property ] ; break ; case self :: TYPE_STRING : $ data [ $ property ] = ( string ) $ data [ $ property ] ; break ; case self :: TYPE_ARRAY : $ data [ $ property ] = ( array ) $ data [ $ property ] ; break ; case self :: TYPE_OBJECT : $ data [ $ property ] = ( object ) $ data [ $ property ] ; break ; case self :: TYPE_MODEL : $ data [ $ property ] = $ modelClass :: factory ( $ data [ $ property ] ) ; break ; case self :: TYPE_COLLECTION : $ data [ $ property ] = static :: factory ( $ data [ $ property ] ) ; break ; } } return $ this ; }
Cast a property to a type

@param  string       $property
@param  int | string $type
@param  bool         $useFactory
@return Collection
Cast a property to a type