Issues (10)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Columns/AbstractColumn.php (9 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace donatj\MySqlSchema\Columns;
4
5
use donatj\MySqlSchema\Columns\Interfaces\CharsetColumnInterface;
6
use donatj\MySqlSchema\Columns\Interfaces\OptionalLengthInterface;
7
use donatj\MySqlSchema\Columns\Interfaces\RequiredLengthInterface;
8
use donatj\MySqlSchema\Columns\Interfaces\SignedInterface;
9
use donatj\MySqlSchema\Columns\Numeric\AbstractIntegerColumn;
10
use donatj\MySqlSchema\Table;
11
use donatj\MySqlSchema\Traits\EscapeTrait;
12
13
abstract class AbstractColumn {
14
15
	use EscapeTrait;
16
17
	/**
18
	 * @var \donatj\MySqlSchema\Table[]
19
	 */
20
	protected $tables = [ ];
21
	/**
22
	 * @var string
23
	 */
24
	protected $name;
25
	/**
26
	 * @var string
27
	 */
28
	protected $comment = '';
29
	/**
30
	 * @var bool
31
	 */
32
	protected $nullable = false;
33
	/**
34
	 * @var mixed
35
	 */
36
	protected $default;
37
38
	/**
39
	 * @param string $name
40
	 */
41
	public function __construct( $name ) {
42
		$this->name = $name;
43
	}
44
45
	/**
46
	 * @access private
47
	 * @param \donatj\MySqlSchema\Table $table
48
	 */
49
	public function addTable( Table $table ) {
50
		$this->tables[spl_object_hash($table)] = $table;
51
	}
52
53
	/**
54
	 * @return \donatj\MySqlSchema\Table[]
55
	 */
56
	public function getTables() {
57
		return array_values($this->tables);
58
	}
59
60
	/**
61
	 * @return string
62
	 */
63
	public function getComment() {
64
		return $this->comment;
65
	}
66
67
	/**
68
	 * @param string $comment
69
	 */
70
	public function setComment( $comment ) {
71
		$this->comment = $comment;
72
	}
73
74
	/**
75
	 * @return boolean
76
	 */
77
	public function isNullable() {
78
		return $this->nullable;
79
	}
80
81
	/**
82
	 * @param boolean $nullable
83
	 */
84
	public function setNullable( $nullable ) {
85
		$this->nullable = $nullable;
86
	}
87
88
	/**
89
	 * @return string
90
	 */
91
	public function getName() {
92
		return $this->name;
93
	}
94
95
	/**
96
	 * @param string $name
97
	 */
98
	public function setName( $name ) {
99
		$this->name = $name;
100
	}
101
102
	/**
103
	 * @param \donatj\MySqlSchema\Table $table
104
	 * @return string
105
	 */
106
	public function toString( Table $table ) {
107
		$type = $this->getTypeName();
108
109
		$nullable = '';
110
		if( !$this->nullable ) {
111
			$nullable = ' NOT NULL';
112
		}
113
114
		$length = '';
115
		if( $this instanceof RequiredLengthInterface ||
116
			($this instanceof OptionalLengthInterface && $this->getLength())
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class donatj\MySqlSchema\Columns\AbstractColumn as the method getLength() does only exist in the following sub-classes of donatj\MySqlSchema\Columns\AbstractColumn: donatj\MySqlSchema\Colum...\AbstractFractionColumn, donatj\MySqlSchema\Colum...c\AbstractIntegerColumn, donatj\MySqlSchema\Colum...ic\AbstractNumberColumn, donatj\MySqlSchema\Colum...ixedPoint\DecimalColumn, donatj\MySqlSchema\Colum...atingPoint\DoubleColumn, donatj\MySqlSchema\Colum...oatingPoint\FloatColumn, donatj\MySqlSchema\Colum...c\Integers\BigIntColumn, donatj\MySqlSchema\Colum...eric\Integers\IntColumn, donatj\MySqlSchema\Colum...ntegers\MediumIntColumn, donatj\MySqlSchema\Colum...Integers\SmallIntColumn, donatj\MySqlSchema\Colum...\Integers\TinyIntColumn, donatj\MySqlSchema\Colum...AbstractCharacterColumn, donatj\MySqlSchema\Colum...ng\Character\CharColumn, donatj\MySqlSchema\Colum...Character\VarcharColumn, donatj\MySqlSchema\Columns\Temporal\YearColumn. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
117
		) {
118
			$l      = intval($this->getLength());
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class donatj\MySqlSchema\Columns\AbstractColumn as the method getLength() does only exist in the following sub-classes of donatj\MySqlSchema\Columns\AbstractColumn: donatj\MySqlSchema\Colum...\AbstractFractionColumn, donatj\MySqlSchema\Colum...c\AbstractIntegerColumn, donatj\MySqlSchema\Colum...ic\AbstractNumberColumn, donatj\MySqlSchema\Colum...ixedPoint\DecimalColumn, donatj\MySqlSchema\Colum...atingPoint\DoubleColumn, donatj\MySqlSchema\Colum...oatingPoint\FloatColumn, donatj\MySqlSchema\Colum...c\Integers\BigIntColumn, donatj\MySqlSchema\Colum...eric\Integers\IntColumn, donatj\MySqlSchema\Colum...ntegers\MediumIntColumn, donatj\MySqlSchema\Colum...Integers\SmallIntColumn, donatj\MySqlSchema\Colum...\Integers\TinyIntColumn, donatj\MySqlSchema\Colum...AbstractCharacterColumn, donatj\MySqlSchema\Colum...ng\Character\CharColumn, donatj\MySqlSchema\Colum...Character\VarcharColumn, donatj\MySqlSchema\Columns\Temporal\YearColumn. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
119
			$length = "($l)";
120
		}
121
122
		$signed = '';
123
		if( $this instanceof SignedInterface ) {
124
			if( !$this->isSigned() ) {
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class donatj\MySqlSchema\Columns\AbstractColumn as the method isSigned() does only exist in the following sub-classes of donatj\MySqlSchema\Columns\AbstractColumn: donatj\MySqlSchema\Colum...\AbstractFractionColumn, donatj\MySqlSchema\Colum...c\AbstractIntegerColumn, donatj\MySqlSchema\Colum...ic\AbstractNumberColumn, donatj\MySqlSchema\Colum...ixedPoint\DecimalColumn, donatj\MySqlSchema\Colum...atingPoint\DoubleColumn, donatj\MySqlSchema\Colum...oatingPoint\FloatColumn, donatj\MySqlSchema\Colum...c\Integers\BigIntColumn, donatj\MySqlSchema\Colum...eric\Integers\IntColumn, donatj\MySqlSchema\Colum...ntegers\MediumIntColumn, donatj\MySqlSchema\Colum...Integers\SmallIntColumn, donatj\MySqlSchema\Colum...\Integers\TinyIntColumn. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
125
				$signed = " unsigned";
126
			}
127
		}
128
129
		$default = '';
130
		if( !is_null($this->default) ) {
131
			$default = ' DEFAULT ' . $this->mkString($this->default, "'");;
132
		}
133
134
		$charset   = '';
135
		$collation = '';
136 View Code Duplication
		if( $this instanceof CharsetColumnInterface ) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
137
			if( $this->getCharset() ) {
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class donatj\MySqlSchema\Columns\AbstractColumn as the method getCharset() does only exist in the following sub-classes of donatj\MySqlSchema\Columns\AbstractColumn: donatj\MySqlSchema\Colum...AbstractCharacterColumn, donatj\MySqlSchema\Colum...ng\AbstractStringColumn, donatj\MySqlSchema\Colum...ring\AbstractTextColumn, donatj\MySqlSchema\Colum...ng\Character\CharColumn, donatj\MySqlSchema\Colum...Character\VarcharColumn, donatj\MySqlSchema\Colum...ing\Text\LongTextColumn, donatj\MySqlSchema\Colum...g\Text\MediumTextColumn, donatj\MySqlSchema\Columns\String\Text\TextColumn, donatj\MySqlSchema\Colum...ing\Text\TinyTextColumn. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
138
				$charset = ' CHARACTER SET ' . $this->getCharset();
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class donatj\MySqlSchema\Columns\AbstractColumn as the method getCharset() does only exist in the following sub-classes of donatj\MySqlSchema\Columns\AbstractColumn: donatj\MySqlSchema\Colum...AbstractCharacterColumn, donatj\MySqlSchema\Colum...ng\AbstractStringColumn, donatj\MySqlSchema\Colum...ring\AbstractTextColumn, donatj\MySqlSchema\Colum...ng\Character\CharColumn, donatj\MySqlSchema\Colum...Character\VarcharColumn, donatj\MySqlSchema\Colum...ing\Text\LongTextColumn, donatj\MySqlSchema\Colum...g\Text\MediumTextColumn, donatj\MySqlSchema\Columns\String\Text\TextColumn, donatj\MySqlSchema\Colum...ing\Text\TinyTextColumn. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
139
				if( $this->getCollation() ) {
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class donatj\MySqlSchema\Columns\AbstractColumn as the method getCollation() does only exist in the following sub-classes of donatj\MySqlSchema\Columns\AbstractColumn: donatj\MySqlSchema\Colum...AbstractCharacterColumn, donatj\MySqlSchema\Colum...ng\AbstractStringColumn, donatj\MySqlSchema\Colum...ring\AbstractTextColumn, donatj\MySqlSchema\Colum...ng\Character\CharColumn, donatj\MySqlSchema\Colum...Character\VarcharColumn, donatj\MySqlSchema\Colum...ing\Text\LongTextColumn, donatj\MySqlSchema\Colum...g\Text\MediumTextColumn, donatj\MySqlSchema\Columns\String\Text\TextColumn, donatj\MySqlSchema\Colum...ing\Text\TinyTextColumn. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
140
					$collation = ' COLLATE ' . $this->getCollation();
0 ignored issues
show
It seems like you code against a specific sub-type and not the parent class donatj\MySqlSchema\Columns\AbstractColumn as the method getCollation() does only exist in the following sub-classes of donatj\MySqlSchema\Columns\AbstractColumn: donatj\MySqlSchema\Colum...AbstractCharacterColumn, donatj\MySqlSchema\Colum...ng\AbstractStringColumn, donatj\MySqlSchema\Colum...ring\AbstractTextColumn, donatj\MySqlSchema\Colum...ng\Character\CharColumn, donatj\MySqlSchema\Colum...Character\VarcharColumn, donatj\MySqlSchema\Colum...ing\Text\LongTextColumn, donatj\MySqlSchema\Colum...g\Text\MediumTextColumn, donatj\MySqlSchema\Columns\String\Text\TextColumn, donatj\MySqlSchema\Colum...ing\Text\TinyTextColumn. Maybe you want to instanceof check for one of these explicitly?

Let’s take a look at an example:

abstract class User
{
    /** @return string */
    abstract public function getPassword();
}

class MyUser extends User
{
    public function getPassword()
    {
        // return something
    }

    public function getDisplayName()
    {
        // return some name.
    }
}

class AuthSystem
{
    public function authenticate(User $user)
    {
        $this->logger->info(sprintf('Authenticating %s.', $user->getDisplayName()));
        // do something.
    }
}

In the above example, the authenticate() method works fine as long as you just pass instances of MyUser. However, if you now also want to pass a different sub-classes of User which does not have a getDisplayName() method, the code will break.

Available Fixes

  1. Change the type-hint for the parameter:

    class AuthSystem
    {
        public function authenticate(MyUser $user) { /* ... */ }
    }
    
  2. Add an additional type-check:

    class AuthSystem
    {
        public function authenticate(User $user)
        {
            if ($user instanceof MyUser) {
                $this->logger->info(/** ... */);
            }
    
            // or alternatively
            if ( ! $user instanceof MyUser) {
                throw new \LogicException(
                    '$user must be an instance of MyUser, '
                   .'other instances are not supported.'
                );
            }
    
        }
    }
    
Note: PHP Analyzer uses reverse abstract interpretation to narrow down the types inside the if block in such a case.
  1. Add the method to the parent class:

    abstract class User
    {
        /** @return string */
        abstract public function getPassword();
    
        /** @return string */
        abstract public function getDisplayName();
    }
    
Loading history...
141
				}
142
			}
143
		}
144
145
		$comment = '';
146
		if( $this->comment ) {
147
			$comment = ' COMMENT ' . $this->mkString($this->comment, "'");
148
		}
149
150
		$autoIncrement = '';
151
		if( $this instanceof AbstractIntegerColumn ) {
152
			if( $table->isAutoIncrement($this) ) {
0 ignored issues
show
$this of type object<donatj\MySqlSchema\Columns\AbstractColumn> is not a sub-type of object<donatj\MySqlSchem...\AbstractIntegerColumn>. It seems like you assume a child class of the class donatj\MySqlSchema\Columns\AbstractColumn to be always present.

This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.

Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.

Loading history...
153
				$autoIncrement = ' AUTO_INCREMENT';
154
			}
155
		}
156
157
		$name = $this->mkString($this->name);
158
159
		return "{$name} {$type}{$length}{$signed}{$charset}{$collation}{$nullable}{$default}{$autoIncrement}{$comment}";
160
	}
161
162
	/**
163
	 * @return string
164
	 */
165
	abstract public function getTypeName();
166
167
	/**
168
	 * @return mixed
169
	 */
170
	public function getDefault() {
171
		return $this->default;
172
	}
173
174
	/**
175
	 * @param mixed $default
176
	 */
177
	public function setDefault( $default ) {
178
		$this->default = $default;
179
	}
180
}
181