Skip to content

Commit

Permalink
update some for mem table
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jan 16, 2020
1 parent b11a43a commit 904ffaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/MemFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class MemFactory
/**
* @param string $name
* @param int $size
* @param array $columns
* @param array $columns ['field' => ['type', 'size']]
*
* @return MemTable
*/
Expand Down
12 changes: 9 additions & 3 deletions src/MemTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use function file_get_contents;
use function file_put_contents;
use function json_encode;
use function property_exists;

/**
* Class MemTable - an simple memory table base on swoole table
Expand Down Expand Up @@ -76,14 +77,19 @@ class MemTable
* @param string $name
* @param int $size
* @param array $columns ['field' => ['type', 'size']]
*
* @throws InvalidArgumentException
* @param array $options
*/
public function __construct(string $name = '', int $size = 0, array $columns = [])
public function __construct(string $name = '', int $size = 0, array $columns = [], array $options = [])
{
$this->setName($name);
$this->setSize($size);
$this->setColumns($columns);

foreach ($options as $key => $value) {
if (property_exists($this, $key)) {
$this->$key = $value;
}
}
}

/**
Expand Down

0 comments on commit 904ffaf

Please sign in to comment.