return $this->remove($name);
}
- public function offsetExists($offset)
+ public function offsetExists($offset): bool
{
return $this->contains($offset);
}
- public function offsetGet($offset)
+ public function offsetGet($offset): mixed
{
return $this->get($offset);
}
- public function offsetSet($offset, $value)
+ public function offsetSet($offset, $value): void
{
if ( ! isset($offset)) {
$this->add($value);
}
}
- public function offsetUnset($offset)
+ public function offsetUnset($offset): void
{
- return $this->remove($offset);
+ $this->remove($offset);
}
public function remove($offset)
<?php
-class IPF_ORM_Collection extends IPF_ORM_Access implements Countable, IteratorAggregate, Serializable
+class IPF_ORM_Collection extends IPF_ORM_Access implements Countable, IteratorAggregate
{
protected $data = array();
protected $_table;
$this->data = $data;
}
- public function serialize()
+ public function __serialize(): array
{
$vars = get_object_vars($this);
$vars['_table'] = $vars['_table']->getComponentName();
- return serialize($vars);
+ return $vars;
}
- public function unserialize($serialized)
+ public function __unserialize(array $serialized): void
{
$connection = IPF_ORM_Manager::connection();
- $array = unserialize($serialized);
-
- foreach ($array as $name => $values) {
+ foreach ($serialized as $name => $values) {
$this->$name = $values;
}
$this->_table = $connection->getTable($this->_table);
- $keyColumn = isset($array['keyColumn']) ? $array['keyColumn'] : null;
+ $keyColumn = isset($serialized['keyColumn']) ? $serialized['keyColumn'] : null;
if ($keyColumn === null) {
$keyColumn = $this->_table->getBoundQueryPart('indexBy');
}
return array_keys($this->data);
}
- public function count()
+ public function count(): int
{
return count($this->data);
}
}
}
- public function getIterator()
+ public function getIterator(): Traversable
{
$data = $this->data;
return new ArrayIterator($data);
return $this->tables;
}
- public function getIterator()
+ public function getIterator(): Traversable
{
return new ArrayIterator($this->tables);
}
- public function count()
+ public function count(): int
{
return $this->_count;
}
public function fetch($fetchMode = IPF_ORM::FETCH_BOTH,
$cursorOrientation = IPF_ORM::FETCH_ORI_NEXT,
- $cursorOffset = null)
+ $cursorOffset = 0)
{
$event = new IPF_ORM_Event($this, IPF_ORM_Event::STMT_FETCH, $this->getQuery());
<?php
-class IPF_ORM_Query extends IPF_ORM_Query_Abstract implements Countable, Serializable
+class IPF_ORM_Query extends IPF_ORM_Query_Abstract implements Countable
{
protected static $_keywords = array('ALL',
'AND',
return $q;
}
- public function count($params = array())
+ public function count($params = array()): int
{
$q = $this->getCountQuery();
$this->_dqlParts = array();
$this->_enumParams = array();
}
-
- public function serialize()
- {
- $vars = get_object_vars($this);
- }
-
- public function unserialize($serialized)
- {
- }
}
<?php
-abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countable, IteratorAggregate, Serializable
+abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countable, IteratorAggregate
{
const STATE_DIRTY = 1;
const STATE_TDIRTY = 2;
}
}
- public function serialize()
+ public function __serialize(): array
{
$event = new IPF_ORM_Event($this, IPF_ORM_Event::RECORD_SERIALIZE);
}
}
- $str = serialize($vars);
-
$this->postSerialize($event);
- return $str;
+ return $vars;
}
- public function unserialize($serialized)
+ public function __unserialize(array $serialized): void
{
$event = new IPF_ORM_Event($this, IPF_ORM_Event::RECORD_UNSERIALIZE);
$this->_table = $connection->getTable(get_class($this));
- $array = unserialize($serialized);
-
- foreach($array as $k => $v) {
+ foreach($serialized as $k => $v) {
$this->$k = $v;
}
return $a;
}
- public function count()
+ public function count(): int
{
return count($this->_data);
}
return $this->_table->hasRelation($fieldName);
}
- public function getIterator()
+ public function getIterator(): Traversable
{
return new IPF_ORM_Record_Iterator($this);
}
return $this->definition['equal'];
}
- public function offsetExists($offset)
+ public function offsetExists($offset): bool
{
return isset($this->definition[$offset]);
}
- public function offsetGet($offset)
+ public function offsetGet($offset): mixed
{
if (isset($this->definition[$offset])) {
return $this->definition[$offset];
return null;
}
- public function offsetSet($offset, $value)
+ public function offsetSet($offset, $value): void
{
if (isset($this->definition[$offset])) {
$this->definition[$offset] = $value;
}
}
- public function offsetUnset($offset)
+ public function offsetUnset($offset): void
{
$this->definition[$offset] = false;
}
return $where;
}
- public function count()
+ public function count(): int
{
$a = $this->_conn->execute('SELECT COUNT(1) FROM ' . $this->_options['tableName'])->fetch(IPF_ORM::FETCH_NUM);
return current($a);
return $this->registry[$oid];
}
- public function count()
+ public function count(): int
{
return count($this->registry);
}
return $evicted;
}
- public function getIterator()
+ public function getIterator(): Traversable
{
return new ArrayIterator($this->registry);
}