public function toArray($set = [], $convert = true) {

		$methods = get_class_methods($this);
		$array 	 = [];

		if(true === is_string($set)) {
			$set = [$set];
		}

		$set 	= array_flip($set);
		$amount = count($set);

		foreach($methods as $method) {
			
			$chunks = explode('get', $method);

			if(count($chunks) == 2) {

				$key = (true === $convert) ? strtolower($chunks[1]) : $chunks[1];

				if($amount === 0 || ($amount > 0 && true === isset($set[$key]))) {

					$value = call_user_func_array([$this, $method], []);

					if($value instanceof Container) {
						$value = $value -> all();
					}

					if(0 === strlen(trim($key)) && ($value === null || 0 === strlen(trim($value)))) {
						continue;
					}

					$array[$key] = $value;
				}
			}
		}
		
		return json_decode(json_encode($array), true);
	}
public function toArray($set = [], $convert = true) {

		$methods = get_class_methods($this);
		$array 	 = [];

		if(true === is_string($set)) {
			$set = [$set];
		}

		$set 	= array_flip($set);
		$amount = count($set);

		foreach($methods as $method) {
			
			$chunks = explode('get', $method);

			if(count($chunks) == 2) {

				$key = (true === $convert) ? strtolower($chunks[1]) : $chunks[1];

				if($amount === 0 || ($amount > 0 && true === isset($set[$key]))) {

					$value = call_user_func_array([$this, $method], []);

					if($value instanceof Container) {
						$value = $value -> all();
					}

					if(0 === strlen(trim($key)) && ($value === null || 0 === strlen(trim($value)))) {
						continue;
					}

					$array[$key] = $value;
				}
			}
		}
		
		return json_decode(json_encode($array), true);
	}
public function toArray ( $ set = [ ] , $ convert = true ) { $ methods = get_class_methods ( $ this ) ; $ array = [ ] ; if ( true === is_string ( $ set ) ) { $ set = [ $ set ] ; } $ set = array_flip ( $ set ) ; $ amount = count ( $ set ) ; foreach ( $ methods as $ method ) { $ chunks = explode ( 'get' , $ method ) ; if ( count ( $ chunks ) == 2 ) { $ key = ( true === $ convert ) ? strtolower ( $ chunks [ 1 ] ) : $ chunks [ 1 ] ; if ( $ amount === 0 || ( $ amount > 0 && true === isset ( $ set [ $ key ] ) ) ) { $ value = call_user_func_array ( [ $ this , $ method ] , [ ] ) ; if ( $ value instanceof Container ) { $ value = $ value -> all ( ) ; } if ( 0 === strlen ( trim ( $ key ) ) && ( $ value === null || 0 === strlen ( trim ( $ value ) ) ) ) { continue ; } $ array [ $ key ] = $ value ; } } } return json_decode ( json_encode ( $ array ) , true ) ; }
Converts all getters to an Array
@param array $set
@param boolean $convert
@return array
Converts all getters to an Array