protected function getTable(array $queryParts)
    {
        if (isset($queryParts['table'])) {
            $from =
                (isset($queryParts['fields']) && !empty($queryParts['fields'])) ||
                strtoupper($queryParts['type']) === 'DELETE' ?
                'FROM ' :
                '';

            if (is_a($queryParts['table'], 'Database\Table')) {
                $select = !empty($from) ? $from . '%s' : '%s';

                if (!empty($from) && strtoupper($queryParts['type']) !== 'DELETE') {
                    $select .= ' AS %s';
                }

                return sprintf(
                    $select,
                    $this->quoteTable($queryParts['table']->getTable()),
                    $this->quoteTable($queryParts['table']->getName())
                );
            } else {
                return $from . $this->quoteTable($queryParts['table']);
            }
        }

        return null;
    }
protected function getTable(array $queryParts)
    {
        if (isset($queryParts['table'])) {
            $from =
                (isset($queryParts['fields']) && !empty($queryParts['fields'])) ||
                strtoupper($queryParts['type']) === 'DELETE' ?
                'FROM ' :
                '';

            if (is_a($queryParts['table'], 'Database\Table')) {
                $select = !empty($from) ? $from . '%s' : '%s';

                if (!empty($from) && strtoupper($queryParts['type']) !== 'DELETE') {
                    $select .= ' AS %s';
                }

                return sprintf(
                    $select,
                    $this->quoteTable($queryParts['table']->getTable()),
                    $this->quoteTable($queryParts['table']->getName())
                );
            } else {
                return $from . $this->quoteTable($queryParts['table']);
            }
        }

        return null;
    }
protected function getTable ( array $ queryParts ) { if ( isset ( $ queryParts [ 'table' ] ) ) { $ from = ( isset ( $ queryParts [ 'fields' ] ) && ! empty ( $ queryParts [ 'fields' ] ) ) || strtoupper ( $ queryParts [ 'type' ] ) === 'DELETE' ? 'FROM ' : '' ; if ( is_a ( $ queryParts [ 'table' ] , 'Database\Table' ) ) { $ select = ! empty ( $ from ) ? $ from . '%s' : '%s' ; if ( ! empty ( $ from ) && strtoupper ( $ queryParts [ 'type' ] ) !== 'DELETE' ) { $ select .= ' AS %s' ; } return sprintf ( $ select , $ this -> quoteTable ( $ queryParts [ 'table' ] -> getTable ( ) ) , $ this -> quoteTable ( $ queryParts [ 'table' ] -> getName ( ) ) ) ; } else { return $ from . $ this -> quoteTable ( $ queryParts [ 'table' ] ) ; } } return null ; }
Prepare the table name for use in the MySQL query.
@param  array $queryParts
@return null|string
Prepare the table name for use in the MySQL query .