ソースを参照

Switched position of static/non-static functions.

Taddeus Kroes 14 年 前
コミット
e4ec329a1d
1 ファイル変更71 行追加71 行削除
  1. 71 71
      pquery.php

+ 71 - 71
pquery.php

@@ -80,6 +80,77 @@ class pQuery {
 	 */
 	var $arguments = array();
 	
+	/**
+	 * Parse the type of the given variable, and convert it if needed.
+	 * 
+	 * @param mixed $variable The variable to parse.
+	 * @param bool $force Whether not to check the variables type against the accepted types.
+	 */
+	function set_variable($variable, $force=false) {
+		$this->variable = $variable;
+		
+		if( $force )
+			return;
+		
+		$type = gettype($variable);
+		$class_name = get_class($this);
+		$accepts = $class_name::$accepts;
+		
+		if( isset($accepts[$type]) ) {
+			$convert_method = $accepts[$type];
+			
+			if( !method_exists($this, $convert_method) ) {
+				return self::error('Plugin "%s" has no conversion method "%s".',
+					$class_name, $convert_method);
+			}
+			
+			$result = $this->$convert_method($variable);
+			$result === null || $this->variable = $result;
+		} else if( !in_array($type, $accepts) ) {
+			return self::error('Variable type "%s" is not accepted by class "%s".',
+				$type, $class_name);
+		}
+	}
+	
+	/**
+	 * Getter for {@link variable}.
+	 * 
+	 * @see variable_alias
+	 */
+	function __get($name) {
+		$class_name = get_class($this);
+		
+		if( in_array($name, (array)$class_name::$variable_alias) )
+			return $this->variable;
+	}
+	
+	/**
+	 * Setter for {@link variable}.
+	 * 
+	 * @see variable_alias
+	 */
+	function __set($name, $value) {
+		$class_name = get_class($this);
+		
+		if( in_array($name, (array)$class_name::$variable_alias) )
+			$this->variable = $value;
+	}
+	
+	/**
+	 * Handler for pQuery exceptions.
+	 * 
+	 * If the execption is a (@link pQueryException}, exit the script with
+	 * its message. Otherwise, throw the exception further.
+	 * 
+	 * @param Exception $e The exception to handle.
+	 */
+	function exception_handler($e) {
+		if( $e instanceof pQueryException )
+			die(nl2br($e->getMessage()));
+		
+		throw $e;
+	}
+	
 	/**
 	 * Extend pQuery with a plugin.
 	 * 
@@ -202,77 +273,6 @@ class pQuery {
 			include_once $path;
 		}
 	}
-	
-	/**
-	 * Parse the type of the given variable, and convert it if needed.
-	 * 
-	 * @param mixed $variable The variable to parse.
-	 * @param bool $force Whether not to check the variables type against the accepted types.
-	 */
-	function set_variable($variable, $force=false) {
-		$this->variable = $variable;
-		
-		if( $force )
-			return;
-		
-		$type = gettype($variable);
-		$class_name = get_class($this);
-		$accepts = $class_name::$accepts;
-		
-		if( isset($accepts[$type]) ) {
-			$convert_method = $accepts[$type];
-			
-			if( !method_exists($this, $convert_method) ) {
-				return self::error('Plugin "%s" has no conversion method "%s".',
-					$class_name, $convert_method);
-			}
-			
-			$result = $this->$convert_method($variable);
-			$result === null || $this->variable = $result;
-		} else if( !in_array($type, $accepts) ) {
-			return self::error('Variable type "%s" is not accepted by class "%s".',
-				$type, $class_name);
-		}
-	}
-	
-	/**
-	 * Getter for {@link variable}.
-	 * 
-	 * @see variable_alias
-	 */
-	function __get($name) {
-		$class_name = get_class($this);
-		
-		if( in_array($name, (array)$class_name::$variable_alias) )
-			return $this->variable;
-	}
-	
-	/**
-	 * Setter for {@link variable}.
-	 * 
-	 * @see variable_alias
-	 */
-	function __set($name, $value) {
-		$class_name = get_class($this);
-		
-		if( in_array($name, (array)$class_name::$variable_alias) )
-			$this->variable = $value;
-	}
-	
-	/**
-	 * Handler for pQuery exceptions.
-	 * 
-	 * If the execption is a (@link pQueryException}, exit the script with
-	 * its message. Otherwise, throw the exception further.
-	 * 
-	 * @param Exception $e The exception to handle.
-	 */
-	function exception_handler($e) {
-		if( $e instanceof pQueryException )
-			die(nl2br($e->getMessage()));
-		
-		throw $e;
-	}
 }
 
 /**