Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Db / Sql / Ddl / Column / Column.php
blob1451275b587b380ee8a99f3ca8fd986e2330a085
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Db\Sql\Ddl\Column;
12 class Column implements ColumnInterface
14 /**
15 * @var null|string|int
17 protected $default = null;
19 /**
20 * @var bool
22 protected $isNullable = false;
24 /**
25 * @var string
27 protected $name = null;
29 /**
30 * @var array
32 protected $options = array();
34 /**
35 * @var string
37 protected $specification = '%s %s';
39 /**
40 * @var string
42 protected $type = 'INTEGER';
44 /**
45 * @param null|string $name
47 public function __construct($name = null)
49 (!$name) ?: $this->setName($name);
52 /**
53 * @param string $name
54 * @return self
56 public function setName($name)
58 $this->name = $name;
59 return $this;
62 /**
63 * @return null|string
65 public function getName()
67 return $this->name;
70 /**
71 * @param bool $nullable
72 * @return self
74 public function setNullable($nullable)
76 $this->isNullable = (bool) $nullable;
77 return $this;
80 /**
81 * @return bool
83 public function isNullable()
85 return $this->isNullable;
88 /**
89 * @param null|string|int $default
90 * @return self
92 public function setDefault($default)
94 $this->default = $default;
95 return $this;
98 /**
99 * @return null|string|int
101 public function getDefault()
103 return $this->default;
107 * @param array $options
108 * @return self
110 public function setOptions(array $options)
112 $this->options = $options;
113 return $this;
117 * @param string $name
118 * @param string $value
119 * @return self
121 public function setOption($name, $value)
123 $this->options[$name] = $value;
124 return $this;
128 * @return array
130 public function getOptions()
132 return $this->options;
136 * @return array
138 public function getExpressionData()
140 $spec = $this->specification;
142 $params = array();
143 $params[] = $this->name;
144 $params[] = $this->type;
146 $types = array(self::TYPE_IDENTIFIER, self::TYPE_LITERAL);
148 if (!$this->isNullable) {
149 $params[1] .= ' NOT NULL';
152 if ($this->default !== null) {
153 $spec .= ' DEFAULT %s';
154 $params[] = $this->default;
155 $types[] = self::TYPE_VALUE;
158 return array(array(
159 $spec,
160 $params,
161 $types,