public function wrap($value)
	{
		// Look for an 'AS' identifier first, and make sure not to choke on that
		if (strpos(strtolower($value), ' as ') !== false)
		{
			$parts = explode(' ', $value);

			return $this->wrap($parts[0]) . ' AS ' . $this->wrap($parts[2]);
		}

		$quoted = [];
		$parts  = explode('.', $value);

		foreach ($parts as $part)
		{
			// Make sure it's not an *, which shouldn't be quoted
			$quoted[] = $part !== '*' ? sprintf($this->wrapper, $part) : $part;
		}

		// Put it back together and return
		return implode('.', $quoted);
	}
public function wrap($value)
	{
		// Look for an 'AS' identifier first, and make sure not to choke on that
		if (strpos(strtolower($value), ' as ') !== false)
		{
			$parts = explode(' ', $value);

			return $this->wrap($parts[0]) . ' AS ' . $this->wrap($parts[2]);
		}

		$quoted = [];
		$parts  = explode('.', $value);

		foreach ($parts as $part)
		{
			// Make sure it's not an *, which shouldn't be quoted
			$quoted[] = $part !== '*' ? sprintf($this->wrapper, $part) : $part;
		}

		// Put it back together and return
		return implode('.', $quoted);
	}
public function wrap ( $ value ) { // Look for an 'AS' identifier first, and make sure not to choke on that if ( strpos ( strtolower ( $ value ) , ' as ' ) !== false ) { $ parts = explode ( ' ' , $ value ) ; return $ this -> wrap ( $ parts [ 0 ] ) . ' AS ' . $ this -> wrap ( $ parts [ 2 ] ) ; } $ quoted = [ ] ; $ parts = explode ( '.' , $ value ) ; foreach ( $ parts as $ part ) { // Make sure it's not an *, which shouldn't be quoted $ quoted [ ] = $ part !== '*' ? sprintf ( $ this -> wrapper , $ part ) : $ part ; } // Put it back together and return return implode ( '.' , $ quoted ) ; }
Quotes table names and columns in the appropriate characters

The only difference between this and quoteName above is that this
allows you to directly pass in a string already including the AS
statement, and still correctly quote it.

@param   string  $value  The table definition
@return  string
Quotes table names and columns in the appropriate characters