├── .gitignore ├── logo.png ├── src ├── Query │ ├── Clauses │ │ ├── On.php │ │ ├── Where.php │ │ ├── Order.php │ │ └── Join.php │ ├── Objects │ │ ├── Condition.php │ │ ├── Operators │ │ │ ├── Equal.php │ │ │ ├── In.php │ │ │ ├── NotEqual.php │ │ │ ├── NotIn.php │ │ │ └── Operator.php │ │ ├── ColumnWithIndex.php │ │ ├── GroupedDataSet.php │ │ ├── Comparison.php │ │ ├── Parser.php │ │ └── ReturnSet.php │ ├── Interfaces │ │ └── QueryType.php │ ├── Type.php │ ├── Traits │ │ ├── Whereable.php │ │ ├── Limitable.php │ │ ├── Orderable.php │ │ ├── ConditionBehaviour.php │ │ ├── Groupable.php │ │ └── Joinable.php │ └── Type │ │ ├── Delete.php │ │ ├── Update.php │ │ ├── Select.php │ │ └── Insert.php ├── AB │ ├── Table │ │ ├── Index │ │ │ └── ForeignKey.php │ │ ├── Column │ │ │ └── KeepColumn.php │ │ ├── KeepTable.php │ │ ├── DataType │ │ │ ├── DataType.php │ │ │ ├── VarChar.php │ │ │ ├── Integer.php │ │ │ └── Date.php │ │ └── Column.php │ ├── DataSet │ │ ├── KeepDataSet.php │ │ ├── Row │ │ │ ├── Cell.php │ │ │ └── KeepRow.php │ │ └── Row.php │ ├── Traits │ │ ├── Indexed.php │ │ ├── KeepDataSet.php │ │ └── Aliasable.php │ ├── Table.php │ └── DataSet.php ├── constants.php ├── ABException.php ├── Functions │ ├── Agregate │ │ ├── Count.php │ │ ├── Sum.php │ │ └── GroupConcat.php │ ├── IfNull.php │ ├── Concat.php │ ├── ABFunction.php │ ├── IfElse.php │ └── Agregate.php ├── KeepAB.php ├── KeepQuery.php ├── ABTestCase.php ├── Query.php ├── AB.php └── Helper.php ├── .travis.yml ├── .phpunit.result.cache ├── phpunit.xml ├── tests ├── ABTest.php ├── AB │ └── TableTest.php ├── QueryTest.php └── HelperTest.php ├── .vscode └── launch.json ├── composer.json ├── LICENSE ├── example └── index.php ├── README.md ├── logo.svg └── composer.lock /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | errors.txt 3 | test 4 | /.vscode -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whizsid/arraybase/HEAD/logo.png -------------------------------------------------------------------------------- /src/Query/Clauses/On.php: -------------------------------------------------------------------------------- 1 | getCode().'] '.$this->getMessage().' '.$this->getTraceAsString(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Query/Interfaces/QueryType.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ./tests 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Functions/IfNull.php: -------------------------------------------------------------------------------- 1 | else = $column; 18 | 19 | $this->condition = $cnd; 20 | 21 | $this->validate(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Functions/Agregate/Sum.php: -------------------------------------------------------------------------------- 1 | ab = $ab; 24 | 25 | return $this; 26 | } 27 | 28 | /** 29 | * Returning the array base instance. 30 | * 31 | * @return AB 32 | */ 33 | public function getAB() 34 | { 35 | return $this->ab(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/AB/DataSet/Row/Cell.php: -------------------------------------------------------------------------------- 1 | value; 25 | } 26 | 27 | /** 28 | * Setting value. 29 | * 30 | * @param mixed 31 | */ 32 | public function setValue($value) 33 | { 34 | $this->value = $value; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/AB/Traits/Indexed.php: -------------------------------------------------------------------------------- 1 | index = $indx; 24 | } 25 | 26 | /** 27 | * Returning the index for the given instance. 28 | * 29 | * @return int 30 | */ 31 | public function getIndex() 32 | { 33 | return $this->index; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Query/Type.php: -------------------------------------------------------------------------------- 1 | table->__getDataSet(); 23 | 24 | $mainDataSet = $orgMainDataSet->cloneMe(); 25 | $mainDataSet->globalizeMe($this->table->getName()); 26 | 27 | $this->dataSet = $mainDataSet; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/KeepQuery.php: -------------------------------------------------------------------------------- 1 | query; 25 | } 26 | 27 | /** 28 | * Setting the parent query. 29 | * 30 | * @param Query $query 31 | * 32 | * @return self 33 | */ 34 | public function setQuery($query) 35 | { 36 | $this->query = $query; 37 | 38 | return $this; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/AB/Traits/KeepDataSet.php: -------------------------------------------------------------------------------- 1 | dataSet = $set; 26 | 27 | return $this; 28 | } 29 | 30 | /** 31 | * Returning the data set for the given instance. 32 | * 33 | * @return DataSet 34 | */ 35 | public function getDataSet() 36 | { 37 | return $this->dataSet; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Functions/Agregate/GroupConcat.php: -------------------------------------------------------------------------------- 1 | separator = $sprtr; 27 | 28 | return $this; 29 | } 30 | 31 | protected function getReturn($arr) 32 | { 33 | return implode($this->separator, $arr); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/AB/Table/Column/KeepColumn.php: -------------------------------------------------------------------------------- 1 | column = $column; 26 | 27 | return $this; 28 | } 29 | 30 | /** 31 | * Returning the column instance. 32 | * 33 | * @return Column 34 | */ 35 | public function getColumn() 36 | { 37 | return $this->column; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/AB/Table/KeepTable.php: -------------------------------------------------------------------------------- 1 | table = $tbl; 26 | 27 | return $this; 28 | } 29 | 30 | /** 31 | * Getting the table. 32 | * 33 | * @return \WhizSid\ArrayBase\AB\Table 34 | */ 35 | public function getTable() 36 | { 37 | return $this->table; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/AB/DataSet/Row/KeepRow.php: -------------------------------------------------------------------------------- 1 | row = $row; 27 | 28 | return $this; 29 | } 30 | 31 | /** 32 | * Returning the parent row. 33 | * 34 | * @return Row 35 | */ 36 | public function getRow() 37 | { 38 | return $this->row; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/ABTest.php: -------------------------------------------------------------------------------- 1 | createTestTable(); 14 | 15 | $this->assertTrue(Helper::isTable($this->ab->getTable('test'))); 16 | } 17 | 18 | public function testWrongTableName() 19 | { 20 | $this->expectException(ABException::class); 21 | $this->expectExceptionCode(1); 22 | 23 | $this->ab->getTable('test1'); 24 | } 25 | 26 | public function testCreatingNewQuery() 27 | { 28 | $query = $this->ab->query(); 29 | 30 | $this->assertTrue(Helper::isQuery($query)); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "name": "Listen for XDebug", 10 | "type": "php", 11 | "request": "launch", 12 | "port": 9000 13 | }, 14 | { 15 | "name": "Launch currently open script", 16 | "type": "php", 17 | "request": "launch", 18 | "program": "${file}", 19 | "cwd": "${fileDirname}", 20 | "port": 9000, 21 | "runtimeExecutable": "/usr/bin/php" 22 | }, 23 | { 24 | "name": "Launch example", 25 | "type": "php", 26 | "request": "launch", 27 | "program": "${workspaceFolder}/example/index.php", 28 | "cwd": "${workspaceFolder}/example", 29 | "port": 9000, 30 | "runtimeExecutable": "/usr/bin/php" 31 | } 32 | ] 33 | } -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "whizsid/arraybase", 3 | "description": "Pure PHP runtime SQL like query language for manipulate php array data.", 4 | "type": "library", 5 | "keywords":[ 6 | "sql","join","group","order","php","array","left","inner","right","outer","select","update","collection" 7 | ], 8 | "license": "MIT", 9 | "authors": [ 10 | { 11 | "name": "WhizSid", 12 | "email": "whizsid@aol.com" 13 | } 14 | ], 15 | "minimum-stability": "dev", 16 | "require": { 17 | "php": "^7.2" 18 | }, 19 | "autoload":{ 20 | "psr-4":{ 21 | "WhizSid\\ArrayBase\\":"src/" 22 | }, 23 | "files":[ 24 | "src/constants.php" 25 | ] 26 | }, 27 | "autoload-dev": { 28 | "psr-4": { 29 | "WhizSid\\ArrayBase\\Tests\\": "tests/" 30 | } 31 | }, 32 | "require-dev": { 33 | "phpunit/phpunit": "7" 34 | }, 35 | "version":"1.0.1" 36 | } 37 | -------------------------------------------------------------------------------- /src/ABTestCase.php: -------------------------------------------------------------------------------- 1 | ab = new AB(); 22 | } 23 | 24 | protected function createTestTable() 25 | { 26 | $this->ab->createTable('test', function (Table $table) { 27 | $table->createColumn('testColumn', function (Column $column) { 28 | $column->setType('varchar'); 29 | }); 30 | 31 | $table->createColumn('testSecondColumn', function (Column $column) { 32 | $column->setType('varchar'); 33 | }); 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/AB/Table/DataType/DataType.php: -------------------------------------------------------------------------------- 1 | obj = $obj; 32 | $this->mode = $mode == 'asc' ? AB_ORDER_ASC : AB_ORDER_DESC; 33 | } 34 | 35 | /** 36 | * Returning the sorting column or function. 37 | * 38 | * @return Column 39 | */ 40 | public function getObject() 41 | { 42 | return $this->obj; 43 | } 44 | 45 | /** 46 | * Returning the sort mode. 47 | * 48 | * @return int AB_ORDER_ASC | AB_ORDER_DESC 49 | */ 50 | public function getMode() 51 | { 52 | return $this->mode; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/AB/Table/DataType/VarChar.php: -------------------------------------------------------------------------------- 1 | \\ 62 | if ($max > 500) { 63 | throw new ABException('The given length is exceed the available max length.', 14); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AB/Table/DataType/Integer.php: -------------------------------------------------------------------------------- 1 | \\ 62 | if ($max > 256) { 63 | throw new ABException('The given length is exceed the available max length.', 13); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/AB/Table/DataType/Date.php: -------------------------------------------------------------------------------- 1 | \\ 62 | if ($max > 19) { 63 | throw new ABException('The given length is exceed the available max length.', 12); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Functions/Concat.php: -------------------------------------------------------------------------------- 1 | concats = $args; 28 | 29 | $this->validate(); 30 | } 31 | 32 | /** 33 | * Validating arguments. 34 | * 35 | * @return void 36 | */ 37 | public function validate() 38 | { 39 | foreach ($this->concats as $key => $concat) { 40 | $this->validateBasicArgument($concat); 41 | } 42 | } 43 | 44 | /** 45 | * {@inheritdoc} 46 | */ 47 | public function execute(int $rowId = 0) 48 | { 49 | $concated = ''; 50 | 51 | foreach ($this->concats as $key => $concat) { 52 | $parsedValue = $this->parseArgument($concat, $rowId); 53 | 54 | if (!$parsedValue) { 55 | $parsedValue = ''; 56 | } 57 | 58 | $concated .= $parsedValue; 59 | } 60 | 61 | return $concated; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/Query/Traits/Whereable.php: -------------------------------------------------------------------------------- 1 | setAB($this->ab)->setQuery($this->query); 25 | 26 | $this->where = $where; 27 | 28 | return $where; 29 | } 30 | 31 | /** 32 | * Executing the where clause. 33 | * 34 | * @return void 35 | */ 36 | public function executeWhere() 37 | { 38 | if (!isset($this->where)) { 39 | return; 40 | } 41 | /** @var DataSet $dataSet */ 42 | $dataSet = $this->dataSet; 43 | /** @var Where $where */ 44 | $where = $this->where; 45 | $where->setDataSet($dataSet); 46 | 47 | $count = $dataSet->getCount(); 48 | $rows = $dataSet->__getRows(); 49 | $newRows = []; 50 | 51 | for ($i = 0; $i < $count; $i++) { 52 | $matched = $where->execute($i); 53 | 54 | if ($matched) { 55 | $newRows[] = $rows[$i]; 56 | } 57 | } 58 | 59 | $dataSet->__setRows($newRows); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /tests/AB/TableTest.php: -------------------------------------------------------------------------------- 1 | createTestTable(); 14 | 15 | $this->ab->test->createColumn('newColumn', function (Column $column) { 16 | $column->setType('integer'); 17 | }); 18 | 19 | $this->assertTrue(Helper::isColumn($this->ab->test->newColumn)); 20 | } 21 | 22 | public function testGetColumn() 23 | { 24 | $this->createTestTable(); 25 | 26 | $column = $this->ab->test->getColumn('testColumn'); 27 | 28 | $this->assertTrue(Helper::isColumn($column)); 29 | } 30 | 31 | public function testGetColumns() 32 | { 33 | $this->createTestTable(); 34 | 35 | $columns = $this->ab->test->getColumns(); 36 | 37 | foreach ($columns as $key => $column) { 38 | $this->assertTrue(Helper::isColumn($column)); 39 | } 40 | } 41 | 42 | public function testGetColumnNames() 43 | { 44 | $this->createTestTable(); 45 | 46 | $columnNames = $this->ab->test->getColumnNames(); 47 | 48 | $this->assertTrue(count($columnNames) == 2); 49 | $this->assertTrue(in_array('testColumn', $columnNames)); 50 | $this->assertTrue(in_array('testSecondColumn', $columnNames)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/Query/Objects/ColumnWithIndex.php: -------------------------------------------------------------------------------- 1 | setColumn($column); 31 | $this->setIndex($index); 32 | } 33 | 34 | /** 35 | * Returning the column. 36 | * 37 | * @return Column 38 | */ 39 | public function getColumn() 40 | { 41 | return $this->column; 42 | } 43 | 44 | /** 45 | * Setting up the column. 46 | * 47 | * @param Column $column 48 | */ 49 | public function setColumn($column) 50 | { 51 | $this->column = $column; 52 | } 53 | 54 | /** 55 | * Setting the row index. 56 | * 57 | * @param int $index 58 | */ 59 | public function setIndex($index) 60 | { 61 | $this->index = $index; 62 | } 63 | 64 | /** 65 | * Returning the index. 66 | * 67 | * @return int 68 | */ 69 | public function getIndex() 70 | { 71 | return $this->index; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /tests/QueryTest.php: -------------------------------------------------------------------------------- 1 | query = new Query(); 23 | 24 | $this->query->setAB($this->ab); 25 | } 26 | 27 | public function testSelect() 28 | { 29 | $this->createTestTable(); 30 | 31 | $selectQuery = $this->query->select($this->ab->test, $this->ab->test->testColumn); 32 | 33 | $this->assertTrue(Helper::isSelectQuery($selectQuery)); 34 | } 35 | 36 | public function testUpdate() 37 | { 38 | $this->createTestTable(); 39 | 40 | $updateQuery = $this->query->update($this->ab->test); 41 | 42 | $this->assertTrue(Helper::isUpdateQuery($updateQuery)); 43 | } 44 | 45 | public function testInsert() 46 | { 47 | $this->createTestTable(); 48 | 49 | $insertQuery = $this->query->insert(); 50 | 51 | $this->assertTrue(Helper::isInsertQuery($insertQuery)); 52 | } 53 | 54 | public function testDelete() 55 | { 56 | $this->createTestTable(); 57 | 58 | $deleteQuery = $this->query->delete($this->ab->test); 59 | 60 | $this->assertTrue(Helper::isDeleteQuery($deleteQuery)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Query/Traits/Limitable.php: -------------------------------------------------------------------------------- 1 | limit = $limit; 42 | $this->offset = $offset; 43 | $this->limited = true; 44 | 45 | return $this; 46 | } 47 | 48 | /** 49 | * Executing the limit clause. 50 | */ 51 | public function executeLimit() 52 | { 53 | if (!$this->limited) { 54 | return; 55 | } 56 | /** @var DataSet $dataSet */ 57 | $dataSet = $this->dataSet; 58 | 59 | $rows = $dataSet->__getRows(); 60 | $newRows = []; 61 | 62 | for ($i = $this->offset; $i < $this->offset + $this->limit; $i++) { 63 | if (isset($rows[$i])) { 64 | $newRows[] = $rows[$i]; 65 | } 66 | } 67 | 68 | $dataSet->__setRows($newRows); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/AB/Traits/Aliasable.php: -------------------------------------------------------------------------------- 1 | cloneMe(); 30 | 31 | $cloned->setName($alias); 32 | 33 | $cloned->__setAliased(); 34 | 35 | return $cloned; 36 | } 37 | 38 | /** 39 | * Returning the name of the alisable instance. 40 | * 41 | * @return string 42 | */ 43 | public function getName() 44 | { 45 | return $this->name; 46 | } 47 | 48 | /** 49 | * Setting the name. 50 | * 51 | * @param string $name 52 | */ 53 | public function setName($name) 54 | { 55 | $this->name = $name; 56 | } 57 | 58 | /** 59 | * Cloned a instance from me. 60 | * 61 | * @return self 62 | */ 63 | public function cloneMe() 64 | { 65 | return clone $this; 66 | } 67 | 68 | /** 69 | * Checking the instance is aliased or not. 70 | * 71 | * @return bool 72 | */ 73 | public function isAliased() 74 | { 75 | return $this->aliased; 76 | } 77 | 78 | /** 79 | * Seting the aliased status. 80 | * 81 | * @param bool $aliased 82 | */ 83 | public function __setAliased($aliased = true) 84 | { 85 | $this->aliased = $aliased; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/AB/DataSet/Row.php: -------------------------------------------------------------------------------- 1 | setRow($this); 32 | $cell->setDataSet($this->dataSet); 33 | $cell->setValue($value); 34 | 35 | $index = count($this->cells); 36 | $cell->setIndex($index); 37 | } else { 38 | $cell = $value; 39 | } 40 | 41 | $this->cells[] = $cell; 42 | 43 | return $cell; 44 | } 45 | 46 | /** 47 | * Returning a cell by column name. 48 | * 49 | * @param int $index 50 | * 51 | * @return Cell 52 | */ 53 | public function getCell($index) 54 | { 55 | return $this->cells[$index]; 56 | } 57 | 58 | /** 59 | * Creating a new row and fill it by cells with null values. 60 | * 61 | * @param int $length 62 | * 63 | * @return Row 64 | */ 65 | public function newNullRow($length) 66 | { 67 | $row = new self(); 68 | 69 | $row->setDataSet($this->dataSet); 70 | 71 | for ($i = 0; $i < $length; $i++) { 72 | $row->newCell(null); 73 | } 74 | 75 | return $row; 76 | } 77 | 78 | public function insertCell() 79 | { 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/Functions/ABFunction.php: -------------------------------------------------------------------------------- 1 | \\ 41 | throw new ABException('Invalid argument given to function '.$this->name.'.', 33); 42 | } 43 | 44 | /** 45 | * Validating an basic argument. 46 | * 47 | * @param mixed $arg 48 | */ 49 | public function validateBasicArgument($arg) 50 | { 51 | if (!Helper::isColumn($arg) && !is_string($arg) && !is_numeric($arg) && !is_null($arg)) { 52 | $this->argumentError(); 53 | } 54 | } 55 | 56 | /** 57 | * Parsing and argument. 58 | * 59 | * @param mixed $arg 60 | * @param int $rowIndex 61 | * 62 | * @return mixed 63 | */ 64 | protected function parseArgument($arg, $rowIndex) 65 | { 66 | if (Helper::isColumn($arg)) { 67 | /** @var Column $arg */ 68 | $value = $this->dataSet->getCell($arg, $rowIndex); 69 | } else { 70 | $value = $arg; 71 | } 72 | 73 | $parsedValue = Parser::parseValue($value); 74 | 75 | return $parsedValue; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/Query/Objects/GroupedDataSet.php: -------------------------------------------------------------------------------- 1 | dataSet = $set; 32 | } 33 | 34 | /** 35 | * Returning the data set. 36 | * 37 | * @return DataSet 38 | */ 39 | public function getDataSet() 40 | { 41 | return $this->dataSet; 42 | } 43 | 44 | /** 45 | * Setting the has. 46 | * 47 | * @param string $hash 48 | */ 49 | public function setHash($hash) 50 | { 51 | $this->hash = $hash; 52 | } 53 | 54 | /** 55 | * Matching the hash. 56 | * 57 | * @param string $matchMe 58 | * 59 | * @return bool 60 | */ 61 | public function match($matchMe) 62 | { 63 | return $this->hash == $matchMe; 64 | } 65 | 66 | /** 67 | * Returning a value from grouped set. 68 | * 69 | * @param mixed $var 70 | * 71 | * @return mixed 72 | */ 73 | public function getValue($var) 74 | { 75 | if (Helper::isColumn($var)) { 76 | return $this->dataSet->getCell($var, 0)->getValue(); 77 | } elseif (Helper::isAgregate($var)) { 78 | /* @var Agregate $var */ 79 | 80 | return $var->setGroupedSet($this)->execute(); 81 | } elseif (Helper::isFunction($var)) { 82 | return $var->setDataSet($this->dataSet)->execute(0); 83 | } else { 84 | return $var; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/Query/Type/Delete.php: -------------------------------------------------------------------------------- 1 | table = $tbl; 33 | 34 | return $this; 35 | } 36 | 37 | public function execute() 38 | { 39 | $startTime = \microtime(true); 40 | $this->resolveDataSet(); 41 | $this->executeJoin(); 42 | $this->executeWhere(); 43 | $this->executeLimit(); 44 | $affected = $this->executeDelete(); 45 | $endTime = \microtime(true); 46 | 47 | $returnSet = new ReturnSet(); 48 | $returnSet->setAffectedRowsCount($affected); 49 | $returnSet->setTime($endTime - $startTime); 50 | 51 | return $returnSet; 52 | } 53 | 54 | /** 55 | * Executing the delete query. 56 | * 57 | * @return int affected rows count 58 | */ 59 | protected function executeDelete() 60 | { 61 | $dataSet = $this->dataSet; 62 | $tableDataSet = $this->table->__getDataSet(); 63 | 64 | $rows = $dataSet->__getRows(); 65 | $indexes = []; 66 | 67 | $tableRows = $tableDataSet->__getRows(); 68 | $newRows = []; 69 | 70 | foreach ($rows as $key => $row) { 71 | $indexes[] = $row->getIndex(); 72 | } 73 | 74 | foreach ($tableRows as $key => $row) { 75 | if (!in_array($row->getIndex(), $indexes)) { 76 | $newRows[] = $row; 77 | } 78 | } 79 | 80 | $tableDataSet->__setRows($newRows); 81 | 82 | return count($indexes); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/Query/Clauses/Join.php: -------------------------------------------------------------------------------- 1 | defaultMode; 25 | } 26 | 27 | if (!in_array($mode, $this->availableModes)) { 28 | // \\ 29 | throw new ABException('Invalid join method supplied.', 15); 30 | } 31 | $this->mode = array_search($mode, $this->availableModes) + 1; 32 | } 33 | 34 | /** 35 | * Setting an table to join. 36 | * 37 | * @param Table $table 38 | * 39 | * @return self 40 | */ 41 | public function setTable($table) 42 | { 43 | $this->table = $table; 44 | $this->query->addTable($table); 45 | 46 | return $this; 47 | } 48 | 49 | /** 50 | * Creating the on clause. 51 | * 52 | * @param mixed $leftSide 53 | * @param mixed $operator 54 | * @param mixed $rightSide 55 | * 56 | * @return On 57 | */ 58 | public function on($leftSide, $operator, $rightSide = null) 59 | { 60 | $on = new On($leftSide, $operator, $rightSide); 61 | $on->setQuery($this->query)->setAB($this->ab); 62 | $this->on = $on; 63 | 64 | return $on; 65 | } 66 | 67 | /** 68 | * Returning the joined table. 69 | * 70 | * @return Table 71 | */ 72 | public function getTable() 73 | { 74 | return $this->table; 75 | } 76 | 77 | /** 78 | * Returning the on clause. 79 | * 80 | * @return On 81 | */ 82 | public function getOnCluase() 83 | { 84 | return $this->on; 85 | } 86 | 87 | /** 88 | * Returning the join mode. 89 | * 90 | * @return int one of AB_JOIN_INNER | AB_JOIN_LEFT | AB_JOIN_RIGHT | AB_JOIN_OUTER 91 | */ 92 | public function getMode() 93 | { 94 | return $this->mode; 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /tests/HelperTest.php: -------------------------------------------------------------------------------- 1 | 'Test Data', 16 | 'column_test_int'=> 1, 17 | ], 18 | ]; 19 | 20 | $dataSet = Helper::parseDataArray($arr); 21 | 22 | $this->assertTrue(Helper::isDataSet($dataSet)); 23 | } 24 | 25 | public function testInvalidDataArrayParse() 26 | { 27 | $arr = [[['jnj'=>'jnj']]]; 28 | 29 | $this->expectException(ABException::class); 30 | $this->expectExceptionCode(17); 31 | 32 | Helper::parseDataArray($arr); 33 | } 34 | 35 | public function testParseTable() 36 | { 37 | $table = Helper::parseTable($this->ab, 'tst_tbl', [[ 38 | 'tst_id' => 1, 39 | 'tst_column'=> 'Test value', 40 | ]]); 41 | 42 | $this->assertTrue(Helper::isTable($table)); 43 | } 44 | 45 | public function testPascalCase() 46 | { 47 | $str = 'tst_string'; 48 | 49 | $pascal = Helper::pascalCase($str); 50 | 51 | $firstLetter = substr($pascal, 0, 1); 52 | $fourthLetter = substr($pascal, 3, 1); 53 | 54 | $this->assertTrue($firstLetter == 'T'); 55 | $this->assertTrue($fourthLetter == 'S'); 56 | } 57 | 58 | public function testFunction() 59 | { 60 | $this->createTestTable(); 61 | 62 | $func = $this->ab::concat($this->ab->test->testColumn, $this->ab->test->testSecondColumn); 63 | 64 | $this->assertTrue(Helper::isFunction($func)); 65 | } 66 | 67 | public function testAgregate() 68 | { 69 | $this->createTestTable(); 70 | 71 | $func = $this->ab::groupConcat($this->ab->test->testColumn)->separatedBy(' ,'); 72 | 73 | $this->assertTrue(Helper::isAgregate($func)); 74 | } 75 | 76 | public function testAgregateIsFunction() 77 | { 78 | $this->createTestTable(); 79 | 80 | $func = $this->ab::groupConcat($this->ab->test->testColumn)->separatedBy(' ,'); 81 | 82 | $this->assertTrue(Helper::isFunction($func)); 83 | } 84 | 85 | public function testStatics() 86 | { 87 | $this->createTestTable(); 88 | 89 | $this->assertTrue(Helper::isColumn($this->ab->test->testColumn)); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/Query.php: -------------------------------------------------------------------------------- 1 | setQuery($this) 29 | ->setAB($this->ab) 30 | ->setFrom($table) 31 | ->setColumns(...$columns); 32 | 33 | return $query; 34 | } 35 | 36 | /** 37 | * Creating a insert query. 38 | * 39 | * @return Insert 40 | */ 41 | public function insert() 42 | { 43 | $query = new Insert(); 44 | 45 | $query->setAB($this->ab) 46 | ->setQuery($this); 47 | 48 | return $query; 49 | } 50 | 51 | /** 52 | * Making a update query. 53 | * 54 | * @param Table $table 55 | * 56 | * @return Update 57 | */ 58 | public function update($table) 59 | { 60 | $query = new Update(); 61 | 62 | $query 63 | ->setTable($table) 64 | ->setQuery($this) 65 | ->setAB($this->ab); 66 | 67 | return $query; 68 | } 69 | 70 | /** 71 | * Creating a new delete query. 72 | * 73 | * @param Table $from 74 | * 75 | * @return Delete 76 | */ 77 | public function delete($from) 78 | { 79 | $query = new Delete(); 80 | 81 | $query 82 | ->setFrom($from) 83 | ->setQuery($this) 84 | ->setAB($this->ab); 85 | 86 | return $query; 87 | } 88 | 89 | /** 90 | * Adding a new table to the query. 91 | * 92 | * @param Table $table 93 | * 94 | * @return void 95 | */ 96 | public function addTable($table) 97 | { 98 | $this->tables[$table->getName()] = $table; 99 | } 100 | 101 | /** 102 | * Returning the table by name. 103 | * 104 | * @param string $name 105 | * 106 | * @return Table 107 | */ 108 | public function __get($name) 109 | { 110 | if (!isset($this->tables[$name])) { 111 | // \\ 112 | throw new ABException('Table is not in the query scope', 16); 113 | } 114 | 115 | return $this->tables[$name]; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /src/Query/Objects/Comparison.php: -------------------------------------------------------------------------------- 1 | 'Equal', 18 | '!=' => 'NotEqual', 19 | 'in' => 'In', 20 | 'not in'=> 'NotIn', 21 | ]; 22 | /** 23 | * Operator instance. 24 | * 25 | * @var Operator 26 | */ 27 | protected $operator; 28 | 29 | protected $defaultOperator = '='; 30 | 31 | protected $rightSide; 32 | 33 | protected $leftSide; 34 | 35 | public function __construct($leftSide, $operator, $rightSide = null) 36 | { 37 | if (!isset($rightSide)) { 38 | $rightSide = $operator; 39 | $operator = $this->defaultOperator; 40 | } 41 | 42 | if (!in_array($operator, array_keys($this->operators))) { 43 | throw new ABException('Supplied operator is not valid. Valid operators are '.implode(',', array_keys($this->operators))); 44 | } 45 | $operatorNamespace = "\WhizSid\ArrayBase\Query\Objects\Operators\\".$this->operators[$operator]; 46 | 47 | $operatorInst = new $operatorNamespace(); 48 | 49 | $this->operator = $operatorInst; 50 | $this->rightSide = $rightSide; 51 | $this->leftSide = $leftSide; 52 | } 53 | 54 | /** 55 | * Executing the comparison and return the value. 56 | * 57 | * @param int $key 58 | * 59 | * @return void 60 | */ 61 | public function execute(int $key) 62 | { 63 | $leftSide = $this->leftSide; 64 | $rightSide = $this->rightSide; 65 | 66 | if (Helper::isColumn($rightSide)) { 67 | $rightSide = $this->getCellByColumnAndRow($rightSide, $key); 68 | } 69 | 70 | if (Helper::isColumn($leftSide)) { 71 | $leftSide = $this->getCellByColumnAndRow($leftSide, $key); 72 | } 73 | 74 | $compared = $this->operator->compare($leftSide, $rightSide); 75 | 76 | return $compared; 77 | } 78 | 79 | /** 80 | * Returning the cell from data set by column and row index. 81 | * 82 | * @param Column $column 83 | * @param int $key 84 | * 85 | * @return Cell 86 | */ 87 | public function getCellByColumnAndRow($column, $key) 88 | { 89 | $columnName = $column->getName(); 90 | 91 | $tableName = $column->getTable()->getName(); 92 | 93 | $cell = $this->dataSet->getCell($tableName.'.'.$columnName, $key); 94 | 95 | return $cell; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /src/Functions/IfElse.php: -------------------------------------------------------------------------------- 1 | $func 41 | */ 42 | public function __construct($leftSide, $operator, $rightSide = null, $func = null) 43 | { 44 | if (\is_callable($rightSide)) { 45 | $func = $rightSide; 46 | $rightSide = null; 47 | } 48 | 49 | $cnd = new Condition($leftSide, $operator, $rightSide); 50 | 51 | if (isset($func)) { 52 | if (!is_callable($func)) { 53 | $this->argumentError(); 54 | } 55 | 56 | $func($cnd); 57 | } 58 | 59 | $this->condition = $cnd; 60 | 61 | $this->validate(); 62 | } 63 | 64 | /** 65 | * When success the condition. 66 | * 67 | * @param mixed $val 68 | * 69 | * @return self 70 | */ 71 | public function then($val) 72 | { 73 | $this->then = $val; 74 | 75 | return $this; 76 | } 77 | 78 | /** 79 | * When failed the condition. 80 | * 81 | * @param mixed $val 82 | * 83 | * @return self 84 | */ 85 | public function else($val) 86 | { 87 | $this->else = $val; 88 | 89 | return $this; 90 | } 91 | 92 | /** 93 | * Validating arguments. 94 | * 95 | * @return void 96 | */ 97 | public function validate() 98 | { 99 | $this->validateBasicArgument($this->then); 100 | $this->validateBasicArgument($this->else); 101 | } 102 | 103 | /** 104 | * {@inheritdoc} 105 | */ 106 | public function execute(int $rowId = 0) 107 | { 108 | $success = $this->condition->setDataSet($this->dataSet)->execute($rowId); 109 | 110 | if ($success) { 111 | return $this->parseArgument($this->then, $rowId); 112 | } else { 113 | return $this->parseArgument($this->else, $rowId); 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /src/Query/Traits/Orderable.php: -------------------------------------------------------------------------------- 1 | setAB($this->ab)->setQuery($this->query); 39 | $this->orderable[] = $order; 40 | 41 | return $this; 42 | } 43 | 44 | /** 45 | * Executing the order clause and sorting the dataset. 46 | */ 47 | public function executeOrder() 48 | { 49 | /** @var DataSet $orgDataSet */ 50 | $dataSet = $this->dataSet; 51 | 52 | $rows = $dataSet->__getRows(); 53 | 54 | $reversed = $this->orderable; 55 | 56 | usort($rows, function (Row $row1, Row $row2) use ($dataSet,$reversed) { 57 | 58 | /** @var Order $ordered */ 59 | foreach ($reversed as $ordered) { 60 | $object = $ordered->getObject(); 61 | $mode = $ordered->getMode(); 62 | 63 | if (Helper::isColumn($object)) { 64 | $aliase = $object->getTable()->getName().'.'.$object->getName(); 65 | $index = $dataSet->searchAlias($aliase); 66 | 67 | $cell1 = $row1->getCell($index); 68 | $value1 = Parser::parseValue($cell1); 69 | 70 | $cell2 = $row2->getCell($index); 71 | $value2 = Parser::parseValue($cell2); 72 | 73 | $multiplier = $mode == AB_ORDER_ASC ? 1 : -1; 74 | if (is_numeric($value1) && is_numeric($value2)) { 75 | $matched = ($value1 - $value2) * $multiplier; 76 | } else { 77 | $matched = strcasecmp($value1, $value2) * $multiplier; 78 | } 79 | if ($value1 != $value2) { 80 | return $matched; 81 | } 82 | } 83 | } 84 | 85 | return 1; 86 | }); 87 | 88 | $dataSet->__setRows($rows); 89 | 90 | $this->dataSet = $dataSet; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/Query/Traits/ConditionBehaviour.php: -------------------------------------------------------------------------------- 1 | addComparison($leftSide, $operator, $rightSide); 29 | } 30 | 31 | /** 32 | * Adding a comparison to where clause. 33 | * 34 | * @param mixed $leftSide 35 | * @param mixed $operator 36 | * @param mixed $rightSide 37 | * 38 | * @return void 39 | */ 40 | protected function addComparison($leftSide, $operator, $rightSide = null) 41 | { 42 | $comparison = new Comparison($leftSide, $operator, $rightSide); 43 | $this->comparisons[] = $comparison; 44 | } 45 | 46 | /** 47 | * Add a comparison with and operator. 48 | * 49 | * @param mixed $leftSide 50 | * @param mixed $operator 51 | * @param mixed $rightSide 52 | * 53 | * @return self 54 | */ 55 | public function and($leftSide, $operator, $rightSide = null) 56 | { 57 | $this->operators[] = 0; 58 | $this->addComparison($leftSide, $operator, $rightSide); 59 | 60 | return $this; 61 | } 62 | 63 | /** 64 | * Add a comparison with or operator. 65 | * 66 | * @param mixed $leftSide 67 | * @param mixed $operator 68 | * @param mixed $rightSide 69 | * 70 | * @return self 71 | */ 72 | public function or($leftSide, $operator, $rightSide = null) 73 | { 74 | $this->operators[] = 1; 75 | $this->addComparison($leftSide, $operator, $rightSide); 76 | 77 | return $this; 78 | } 79 | 80 | /** 81 | * Executing the where clause and returning the value. 82 | * 83 | * @param int $rowIndex 84 | * 85 | * @return bool 86 | */ 87 | public function execute($rowIndex) 88 | { 89 | $value = true; 90 | 91 | foreach ($this->comparisons as $key => $comparison) { 92 | $currentStatus = $comparison->setDataSet($this->dataSet)->execute($rowIndex); 93 | 94 | if ($key == 0) { 95 | $value = $currentStatus; 96 | } else { 97 | $operator = $this->operators[$key - 1]; 98 | 99 | if ($operator) { 100 | $value = $value || $currentStatus; 101 | } else { 102 | $value = $value && $currentStatus; 103 | } 104 | } 105 | } 106 | 107 | return $value; 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /example/index.php: -------------------------------------------------------------------------------- 1 | '; 12 | echo microtime(true); 13 | echo '
'; 14 | 15 | // Creating a array base table 16 | $ab->createTable('tbl_customer', [ 17 | [ 18 | 'c_id' => 1, 19 | 'c_name' => 'Customer 1', 20 | 'c_address'=> 'customer address 1', 21 | ], 22 | [ 23 | 'c_id' => 2, 24 | 'c_name' => null, 25 | 'c_address'=> 'customer address 2', 26 | ], 27 | [ 28 | 'c_id' => 10, 29 | 'c_name' => 'Customer 10', 30 | 'c_address'=> 'customer address 10', 31 | ], 32 | ]); 33 | 34 | echo "ArrayBase Table 'tbl_customer' created"; 35 | 36 | $ab->createTable('tbl_facility', [ 37 | [ 38 | 'c_id' => 1, 39 | 'fac_code'=> 'AFCJNKM', 40 | ], 41 | [ 42 | 'c_id' => 1, 43 | 'fac_code'=> 'AFCLKJN', 44 | ], 45 | [ 46 | 'c_id' => 2, 47 | 'fac_code'=> 'JNKLMMN', 48 | ], 49 | [ 50 | 'c_id' => 3, 51 | 'fac_code'=> 'BJNKMKN', 52 | ], 53 | ]); 54 | 55 | $ab->createTable('tbl_another', [ 56 | [ 57 | 'c_id' => 1, 58 | 'ant_id'=> 'A', 59 | ], 60 | ['c_id' => 2, 61 | 'ant_id'=> 'B', ], 62 | ]); 63 | 64 | $selectQuery = $ab->query()->select( 65 | $ab->tbl_customer, 66 | $ab::groupConcat(AB_DISTINCT, $ab->tbl_facility->fac_code)->as('new_sum'), 67 | $ab->tbl_customer->c_id, 68 | $ab->tbl_another->ant_id, 69 | $ab->tbl_facility->fac_code 70 | ); 71 | 72 | $selectQuery->join(AB_JOIN_INNER, $ab->tbl_facility)->on($ab->tbl_customer->c_id, '=', $ab->tbl_facility->c_id); 73 | $selectQuery->join(AB_JOIN_INNER, $ab->tbl_another)->on($ab->tbl_customer->c_id, '=', $ab->tbl_another->c_id); 74 | $selectQuery->orderBy($ab->tbl_customer->c_id, 'desc'); 75 | $selectQuery->groupBy($ab->tbl_another->ant_id); 76 | $selectQuery->where($ab->tbl_another->ant_id, '=', 'A'); 77 | $selectQuery->limit(1); 78 | $result = $selectQuery->execute()->fetchAssoc(); 79 | 80 | $updateQuery = $ab->query()->update($ab->tbl_customer)->set($ab->tbl_customer->c_name, 'Updated name'); 81 | $updateQuery->where($ab->tbl_another->ant_id, 'B'); 82 | $updateQuery->join(AB_JOIN_INNER, $ab->tbl_another)->on($ab->tbl_another->c_id, '=', $ab->tbl_customer->c_id); 83 | $updateQuery->limit(1); 84 | $updateQuery->execute(); 85 | 86 | $deleteQuery = $ab->query()->delete($ab->tbl_customer); 87 | $deleteQuery->where($ab->tbl_another->ant_id, 'B'); 88 | $deleteQuery->join(AB_JOIN_INNER, $ab->tbl_another)->on($ab->tbl_another->c_id, '=', $ab->tbl_customer->c_id); 89 | $deleteQuery->limit(1); 90 | $deleteQuery->execute(); 91 | 92 | $selectQuery = $ab->query()->select($ab->tbl_customer); 93 | 94 | $result = $selectQuery->execute()->fetchAssoc(); 95 | 96 | var_dump($result); 97 | 98 | echo '
'; 99 | echo microtime(true); 100 | echo '
'; 101 | 102 | die; 103 | -------------------------------------------------------------------------------- /src/Query/Objects/Parser.php: -------------------------------------------------------------------------------- 1 | getValue(); 27 | } elseif (Helper::isBindedColumn($ref)) { 28 | /** @var ColumnWithIndex $ref */ 29 | $rowIndex = $ref->getIndex(); 30 | 31 | $columnIndex = $ref->getColumn()->getIndex(); 32 | 33 | $value = $ref->getColumn() 34 | ->getTable() 35 | ->__getDataSet() 36 | ->getRow($rowIndex) 37 | ->getCell($columnIndex) 38 | ->getValue(); 39 | 40 | return (string) $value; 41 | } else { 42 | // < \\ 43 | throw new ABException('Invalid variable given for parser.', 27); 44 | } 45 | } 46 | 47 | /** 48 | * Parsing a name for a variable. 49 | * 50 | * @param mixed $arg 51 | * 52 | * @return string 53 | */ 54 | public static function parseName($arg) 55 | { 56 | if (Helper::isColumn($arg)) { 57 | $name = $arg->getFullName(); 58 | } elseif (Helper::isFunction($arg)) { 59 | $name = $arg->getName(); 60 | } elseif (is_null($arg)) { 61 | return "'NULL'"; 62 | } else { 63 | $name = "'$arg'"; 64 | } 65 | 66 | return $name; 67 | } 68 | 69 | /** 70 | * Getting an array from a subquery or array. 71 | * 72 | * @param mixed $ref 73 | * 74 | * @return array 75 | */ 76 | public static function parseArray($ref) 77 | { 78 | if (Helper::isDataSet($ref)) { 79 | /** @var DataSet $ref */ 80 | $cells = $ref->getColumnData(0); 81 | 82 | $values = array_map(function (Cell $cell) { 83 | return $cell->getValue(); 84 | }, $cells); 85 | 86 | return $values; 87 | } elseif (is_array($ref)) { 88 | return $ref; 89 | } else { 90 | // < \\ 91 | throw new ABException('Invalid variable given for parser.', 27); 92 | } 93 | } 94 | 95 | /** 96 | * Hashing an array to integer type. 97 | * 98 | * @param mixed $val 99 | * 100 | * @return string 101 | */ 102 | public static function parseHashInt($val) 103 | { 104 | return md5(json_encode($val)); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/Functions/Agregate.php: -------------------------------------------------------------------------------- 1 | clmn = $clmn; 34 | 35 | $this->validate(); 36 | } 37 | 38 | /** 39 | * {@inheritdoc} 40 | */ 41 | public function validate() 42 | { 43 | $this->validateBasicArgument($this->clmn); 44 | } 45 | 46 | /** 47 | * Grouped Data Set Setter. 48 | * 49 | * @param GroupedDataSet 50 | * 51 | * @return void 52 | */ 53 | public function setGroupedSet($set) 54 | { 55 | $this->groupedDataSet = $set; 56 | 57 | return $this; 58 | } 59 | 60 | /** 61 | * Setter for distinct. 62 | * 63 | * @param bool $dst 64 | */ 65 | public function distinct($dst) 66 | { 67 | $this->distinct = $dst; 68 | } 69 | 70 | /** 71 | * Returning the function distinct or not. 72 | * 73 | * @return bool $dst 74 | */ 75 | public function isDistinct() 76 | { 77 | return $this->distinct; 78 | } 79 | 80 | /** 81 | * Format the values and return the returning value from function. 82 | * 83 | * @param mixed[] $arr values to do the function operation 84 | * 85 | * @return mixed 86 | */ 87 | protected function getReturn($arr) 88 | { 89 | } 90 | 91 | /** 92 | * Validating a value in a row. 93 | * 94 | * @param mixed $value 95 | * 96 | * @return bool 97 | */ 98 | public function validateValue($value) 99 | { 100 | return true; 101 | } 102 | 103 | /** 104 | * Executing the function. 105 | * 106 | * @return mixed 107 | */ 108 | public function execute(int $rowIndex = 0) 109 | { 110 | $dataSet = $this->groupedDataSet->getDataSet(); 111 | 112 | $this->setDataSet($dataSet); 113 | 114 | $dataSetCount = $dataSet->getCount(); 115 | 116 | $values = []; 117 | 118 | for ($i = 0; $i < $dataSetCount; $i++) { 119 | $value = $this->parseArgument($this->clmn, $i); 120 | 121 | if (!$this->validateValue($value)) { 122 | return; 123 | } 124 | 125 | if (!is_numeric(array_search($value, $values)) || !$this->distinct) { 126 | $values[] = $value; 127 | } 128 | } 129 | 130 | return $this->getReturn($values); 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /src/Query/Type/Update.php: -------------------------------------------------------------------------------- 1 | table = $tbl; 42 | 43 | return $this; 44 | } 45 | 46 | /** 47 | * Returnig the table. 48 | * 49 | * @return Table 50 | */ 51 | public function getTable() 52 | { 53 | return $this->table; 54 | } 55 | 56 | /** 57 | * Select columns to update. 58 | * 59 | * @param Column $column 60 | * @param mixed $value 61 | * 62 | * @return self 63 | */ 64 | public function set($column, $value) 65 | { 66 | if (!Helper::isColumn($column)) { 67 | // \\ 68 | throw new ABException('Please provide a valid column to set clause.', 36); 69 | } 70 | if ($column->getTable()->getName() != $this->table->getName()) { 71 | // \\ 72 | throw new ABException('Column in set clause and main table is not matching.', 37); 73 | } 74 | $this->columns[] = [$column, $value]; 75 | 76 | return $this; 77 | } 78 | 79 | /** 80 | * {@inheritdoc} 81 | */ 82 | public function execute() 83 | { 84 | $startTime = \microtime(true); 85 | $this->resolveDataSet(); 86 | $this->executeJoin(); 87 | $this->executeWhere(); 88 | $this->executeLimit(); 89 | $this->executeUpdate(); 90 | $endTime = \microtime(true); 91 | 92 | $returnSet = new ReturnSet(); 93 | 94 | $returnSet->setTime($endTime - $startTime); 95 | $returnSet->setAffectedRowsCount($this->dataSet->getCount()); 96 | 97 | return $returnSet; 98 | } 99 | 100 | public function executeUpdate() 101 | { 102 | $dataSet = $this->dataSet; 103 | 104 | $count = $dataSet->getCount(); 105 | 106 | for ($i = 0; $i < $count; $i++) { 107 | foreach ($this->columns as $column) { 108 | $value = $dataSet->getValue($column[1], $i); 109 | $cell = $dataSet->getCell($column[0], $i); 110 | $cell->setValue($value); 111 | } 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /src/Query/Objects/ReturnSet.php: -------------------------------------------------------------------------------- 1 | dataSet = $dataSet; 50 | $this->count = $dataSet->getCount(); 51 | } 52 | 53 | /** 54 | * Setter for data set. 55 | * 56 | * @return int 57 | */ 58 | public function getAffectedRowsCount() 59 | { 60 | return $this->affectedRows; 61 | } 62 | 63 | /** 64 | * Setter for affected row count. 65 | * 66 | * @param int $count 67 | * 68 | * @return void 69 | */ 70 | public function setAffectedRowsCount($count) 71 | { 72 | $this->affectedRows = $count; 73 | } 74 | 75 | /** 76 | * Setter for time. 77 | * 78 | * @param float $time 79 | * 80 | * @return void 81 | */ 82 | public function setTime($time) 83 | { 84 | $this->time = $time; 85 | } 86 | 87 | /** 88 | * Returning the execution time in micro seconds. 89 | * 90 | * @return float 91 | */ 92 | public function getTime() 93 | { 94 | return $this->time; 95 | } 96 | 97 | /** 98 | * Setter for last index. 99 | * 100 | * @param int $index 101 | * 102 | * @return void 103 | */ 104 | public function setLastIndex($index) 105 | { 106 | $this->lastIndex = $index; 107 | } 108 | 109 | /** 110 | * Returning the last inserted index for insert queries. 111 | * 112 | * @return int 113 | */ 114 | public function getLastIndex() 115 | { 116 | return $this->lastIndex; 117 | } 118 | 119 | /** 120 | * Fetching the data set to associative array. 121 | * 122 | * @return void 123 | */ 124 | public function fetchAssoc() 125 | { 126 | $fetched = []; 127 | 128 | if (!isset($this->dataSet)) { 129 | return []; 130 | } 131 | 132 | $rows = $this->dataSet->__getRows(); 133 | $aliases = $this->dataSet->getAliases(); 134 | 135 | foreach ($rows as $row) { 136 | $arrRow = []; 137 | foreach ($aliases as $cellIndex => $alias) { 138 | $globalized = explode('.', $alias); 139 | $arrRow[end($globalized)] = $row->getCell($cellIndex)->getValue(); 140 | } 141 | 142 | $fetched[] = $arrRow; 143 | } 144 | 145 | return $fetched; 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /src/AB/Table.php: -------------------------------------------------------------------------------- 1 | name = $name; 46 | $this->dataSet = new DataSet(); 47 | $this->dataSet->setAB($this->ab); 48 | } 49 | 50 | /** 51 | * Create a column to table. 52 | * 53 | * @param string $str column name 54 | * @param callback<\WhizSid\ArrayBase\AB\Table\Column> $func You can access column as the first argument in function 55 | * 56 | * @return self 57 | */ 58 | public function createColumn($str, $func) 59 | { 60 | $col = new Table\Column($str); 61 | 62 | $col->setAB($this->ab); 63 | 64 | $col->setTable($this); 65 | 66 | $index = count($this->columnNames); 67 | 68 | $this->columns[$str] = $col; 69 | 70 | $func($col); 71 | 72 | $col->setIndex($index); 73 | $this->columnNames[] = $col->getName(); 74 | 75 | $col->validate(); 76 | 77 | $value = $col->getDefaultValue(); 78 | 79 | $this->dataSet->newColumn($str, $value); 80 | 81 | return $this; 82 | } 83 | 84 | /** 85 | * Getting a column by name. 86 | * 87 | * @param string $name 88 | * 89 | * @return \WhizSid\ArrayBase\AB\Table\Column 90 | */ 91 | public function getColumn($str) 92 | { 93 | // \\ 94 | if (!isset($this->columns[$str])) { 95 | throw new ABException('Can not find the column "'.$str.'"', 2); 96 | } 97 | 98 | return $this->columns[$str]; 99 | } 100 | 101 | /** 102 | * Getting all columns. 103 | * 104 | * @return \WhizSid\ArrayBase\AB\Table\Column[] 105 | */ 106 | public function getColumns() 107 | { 108 | return $this->columns; 109 | } 110 | 111 | /** 112 | * Returning all column names. 113 | * 114 | * @return string[] 115 | */ 116 | public function getColumnNames() 117 | { 118 | return $this->columnNames; 119 | } 120 | 121 | /** 122 | * Short way to get column by name. 123 | * 124 | * @param string $name 125 | * 126 | * @return AB\Table\Column 127 | */ 128 | public function __get(string $str) 129 | { 130 | return $this->getColumn($str); 131 | } 132 | 133 | /** 134 | * Setting the columns to table. 135 | * 136 | * @param Table\Column[] $columns 137 | */ 138 | public function __setColumns($columns) 139 | { 140 | $this->columns = $columns; 141 | } 142 | 143 | /** 144 | * Clone the table to new one. 145 | * 146 | * @return self 147 | */ 148 | public function cloneMe() 149 | { 150 | $columns = $this->columns; 151 | 152 | $clonedMe = clone $this; 153 | 154 | foreach ($columns as $key=>$column) { 155 | $newColumn = $column->cloneMe(); 156 | $newColumn->setTable($clonedMe); 157 | $columns[$key] = $newColumn; 158 | } 159 | 160 | $clonedMe->__setColumns($columns); 161 | 162 | return $clonedMe; 163 | } 164 | 165 | /** 166 | * Returning the data set. 167 | * 168 | * @return DataSet 169 | */ 170 | public function __getDataSet() 171 | { 172 | return $this->dataSet; 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /src/Query/Traits/Groupable.php: -------------------------------------------------------------------------------- 1 | \\ 49 | throw new ABException('Invalid column or function in group by clause.', 32); 50 | } 51 | $this->groups[] = $clmn; 52 | 53 | return $this; 54 | } 55 | 56 | /** 57 | * Finding grouped data set by it's hash. 58 | * 59 | * @param string $hash 60 | * 61 | * @return DataSet 62 | */ 63 | protected function __findGroupedSet($hash) 64 | { 65 | /** @var GroupedDataSet[] $groupedSets */ 66 | $groupedSets = $this->groupedSets; 67 | foreach ($groupedSets as $set) { 68 | if ($set->match($hash)) { 69 | return $set->getDataSet(); 70 | } 71 | } 72 | } 73 | 74 | /** 75 | * Executing the group by clause. 76 | * 77 | * @return void 78 | */ 79 | public function executeGroupBy() 80 | { 81 | /** @var DataSet $dataSet */ 82 | $dataSet = $this->dataSet->cloneMe(); 83 | 84 | if (empty($this->groups)) { 85 | $hasAgregate = false; 86 | 87 | foreach ($this->columns as $key => $column) { 88 | if (Helper::isAgregate($column)) { 89 | $hasAgregate = true; 90 | } 91 | } 92 | 93 | if ($hasAgregate) { 94 | $groupedSet = new GroupedDataSet(); 95 | $groupedSet->setDataSet($dataSet); 96 | $groupedSet->setHash(1); 97 | $this->grouped = true; 98 | $this->groupedSets[] = $groupedSet; 99 | } 100 | } else { 101 | $aliases = $dataSet->getAliases(); 102 | 103 | $rows = $dataSet->__getRows(); 104 | 105 | foreach ($rows as $row) { 106 | $hashMe = []; 107 | 108 | foreach ($this->groups as $group) { 109 | if (Helper::isColumn($group)) { 110 | /** @var Column $group */ 111 | $index = $dataSet->searchAlias($group->getFullName()); 112 | 113 | $cell = $row->getCell($index); 114 | $value = Parser::parseValue($cell); 115 | $hashMe[] = $value; 116 | } 117 | } 118 | 119 | $hash = Parser::parseHashInt($hashMe); 120 | 121 | /** @var DataSet $foundSet */ 122 | $foundSet = $this->__findGroupedSet($hash); 123 | 124 | if ($foundSet) { 125 | $newRow = $foundSet->newRow(); 126 | foreach ($aliases as $key => $alias) { 127 | $newRow->newCell($row->getCell($key)->getValue()); 128 | } 129 | } else { 130 | $groupedSet = new GroupedDataSet(); 131 | $newSet = $dataSet->cloneMe(); 132 | $newSet->__setRows([$row]); 133 | $groupedSet->setDataSet($newSet); 134 | $groupedSet->setHash($hash); 135 | $this->groupedSets[] = $groupedSet; 136 | } 137 | } 138 | 139 | $this->grouped = true; 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /src/AB.php: -------------------------------------------------------------------------------- 1 | |array $func 44 | * 45 | * @return self 46 | */ 47 | public function createTable($name, $funcOrArr) 48 | { 49 | if (!is_array($funcOrArr)) { 50 | $tbl = new AB\Table($name); 51 | 52 | $tbl->setAB($this); 53 | 54 | $this->tables[$name] = $tbl; 55 | 56 | $funcOrArr($tbl); 57 | } else { 58 | Helper::parseTable($this, $name, $funcOrArr); 59 | } 60 | 61 | return $this; 62 | } 63 | 64 | /** 65 | * Get a table by name. 66 | * 67 | * @param string $name 68 | * 69 | * @return AB\Table 70 | */ 71 | public function getTable($name) 72 | { 73 | // \\ 74 | if (!isset($this->tables[$name])) { 75 | throw new ABException('Can not find the table "'.$name.'"', 1); 76 | } 77 | 78 | return $this->tables[$name]; 79 | } 80 | 81 | /** 82 | * Short way to get a table by name. 83 | * 84 | * @param string $str 85 | * 86 | * @return AB\Table 87 | */ 88 | public function __get($str) 89 | { 90 | return $this->getTable($str); 91 | } 92 | 93 | /** 94 | * Creating a query and returning. 95 | * 96 | * @return Query 97 | */ 98 | public function query() 99 | { 100 | $query = new Query(); 101 | 102 | $query->setAB($this); 103 | 104 | $this->lastQuery = $query; 105 | 106 | return $query; 107 | } 108 | 109 | /** 110 | * Calling to arraybase functions. 111 | * 112 | * @param string $name 113 | * @param array $arguments 114 | * 115 | * @return ABFunction|Agregate 116 | */ 117 | public function __callStatic($name, $arguments) 118 | { 119 | $pascalCased = Helper::pascalCase($name); 120 | $normalFunction = "\WhizSid\ArrayBase\Functions\\".$pascalCased; 121 | $agrFunction = "\WhizSid\ArrayBase\Functions\Agregate\\".$pascalCased; 122 | 123 | if (class_exists($normalFunction)) { 124 | $function = new $normalFunction(...$arguments); 125 | 126 | return $function; 127 | } elseif (class_exists($agrFunction)) { 128 | if (count($arguments) > 1) { 129 | if ($arguments[0] != AB_DISTINCT) { 130 | // \\ 131 | throw new ABException("Invalid value passed as argument distinct to $name function", 35); 132 | } 133 | unset($arguments[0]); 134 | /** @var Agregate $function */ 135 | $function = new $agrFunction(...$arguments); 136 | 137 | $function->distinct(true); 138 | } else { 139 | $function = new $agrFunction(...$arguments); 140 | } 141 | 142 | return $function; 143 | } else { 144 | // \\ 145 | throw new ABException("Function $name is not implemented yet.", 34); 146 | } 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 |

3 | 4 | --- 5 | 6 |

7 | License: MIT 8 | Total Downloads 9 | Latest Stable Version 10 | Build: parsing 11 | Style CI: parsed 12 |

13 | 14 | Runtime SQL like query lanaguage for manipulate php arrays. written in pure php and not using any sql engine. Note:- this is not an any kind of query builder. 15 | 16 | ## Installation 17 | 18 | You can install arraybase on composer package manager by using below command. 19 | 20 | ``` 21 | composer require whizsid/arraybase 22 | ``` 23 | 24 | ## Basic 25 | 26 | ### Creating an ArrayBase instance 27 | This is how we are creating an array base instance. 28 | 29 | ``` 30 | use WhizSid\ArrayBase\AB; 31 | 32 | $ab = new AB; 33 | ``` 34 | ArrayBase is simpler than other SQL Engines. 35 | 36 | ### Creating an ArrayBase Table 37 | 38 | ``` 39 | use WhizSid\ArrayBase\AB\Table; 40 | use WhizSid\ArrayBase\AB\Table\Column; 41 | 42 | $ab->createTable('customers',function(Table $tbl){ 43 | $tbl->createColumn('cus_id',function(Column $clmn){ 44 | $clmn->setType('integer')->setAutoIncrement(); 45 | }); 46 | $tbl->createColumn('cus_name',function(Column $clmn){ 47 | $clmn->setType('varchar'); 48 | }); 49 | $tbl->createColumn('cus_phone',function(Column $clmn){ 50 | $clmn->setType('varchar'); 51 | }) 52 | }); 53 | 54 | ``` 55 | Or with data array. 56 | 57 | ``` 58 | $ab->createTable('tbl_another',[ 59 | [ 60 | 'c_id'=>1, 61 | 'ant_id'=>"A" 62 | ], 63 | [ 64 | 'c_id'=>2, 65 | 'ant_id'=>"B" 66 | ] 67 | ]); 68 | 69 | ``` 70 | 71 | ### Join Clause 72 | ``` 73 | use WhizSid\ArrayBase\AB\Query\Clause\Join; 74 | 75 | $query = $ab->query(); 76 | 77 | $select = $query->select($ab->tbl_customer->as('cus')); 78 | 79 | $select->join($ab->tbl_customer_cv->as('cv'))->on($query->cv->c_id,$query->cus->c_id); 80 | 81 | $results = $select->execute(); 82 | ``` 83 | 84 | ## Where Clause 85 | ``` 86 | $select->where($query->cus->c_id,"4567")->and($query->cv->c_name,"my name"); 87 | ``` 88 | 89 | ## Limit 90 | ``` 91 | $select->limit(10,20); 92 | ``` 93 | 94 | ## Order 95 | ``` 96 | $select->orderBy($query->cus->c_name)->orderBy($query->cus->c_address,"desc"); 97 | ``` 98 | 99 | ### Select query 100 | 101 | ``` 102 | $selectQuery = $ab->query()->select( 103 | $ab->tbl_customer, 104 | $ab::groupConcat(AB_DISTINCT,$ab->tbl_facility->fac_code)->as('new_sum'), 105 | $ab->tbl_customer->c_id, 106 | $ab->tbl_another->ant_id, 107 | $ab->tbl_facility->fac_code 108 | ); 109 | 110 | $selectQuery->join(AB_JOIN_INNER,$ab->tbl_facility)->on($ab->tbl_customer->c_id,'=',$ab->tbl_facility->c_id); 111 | $selectQuery->join(AB_JOIN_INNER,$ab->tbl_another)->on($ab->tbl_customer->c_id,'=',$ab->tbl_another->c_id); 112 | $selectQuery->orderBy($ab->tbl_customer->c_id,'desc'); 113 | $selectQuery->groupBy($ab->tbl_another->ant_id); 114 | $selectQuery->where($ab->tbl_another->ant_id,'=',"A"); 115 | $selectQuery->limit(1); 116 | $result = $selectQuery->execute()->fetchAssoc(); 117 | ``` 118 | 119 | ### Update Query 120 | 121 | ``` 122 | $updateQuery = $ab->query()->update($ab->tbl_customer)->set($ab->tbl_customer->c_name,'Updated name'); 123 | $updateQuery->where($ab->tbl_another->ant_id,"B"); 124 | $updateQuery->join(AB_JOIN_INNER,$ab->tbl_another)->on($ab->tbl_another->c_id,'=',$ab->tbl_customer->c_id); 125 | $updateQuery->limit(1); 126 | $updateQuery->execute(); 127 | ``` 128 | 129 | ### Delete query 130 | 131 | ``` 132 | $deleteQuery = $ab->query()->delete($ab->tbl_customer); 133 | $deleteQuery->where($ab->tbl_another->ant_id,"B"); 134 | $deleteQuery->join(AB_JOIN_INNER,$ab->tbl_another)->on($ab->tbl_another->c_id,'=',$ab->tbl_customer->c_id); 135 | $deleteQuery->limit(1); 136 | $deleteQuery->execute(); 137 | ``` 138 | 139 | All Examples in the `example/index.php` file. 140 | 141 | ## Goals 142 | 143 | To bring all MySQL functions to PHP. 144 | 145 | [Read the full documentation](https://whizsid.github.io/arraybase) 146 | 147 | 148 | -------------------------------------------------------------------------------- /src/Query/Type/Select.php: -------------------------------------------------------------------------------- 1 | table = $tbl; 45 | // Registering the table 46 | $this->query->addTable($tbl); 47 | 48 | return $this; 49 | } 50 | 51 | /** 52 | * Returning the base table. 53 | * 54 | * @return Table 55 | */ 56 | public function getFrom() 57 | { 58 | return $this->table; 59 | } 60 | 61 | /** 62 | * Setting columns in select clause. 63 | * 64 | * @param Column[] ...$columns 65 | * 66 | * @return void 67 | */ 68 | public function setColumns(...$columns) 69 | { 70 | $this->columns = array_merge($this->columns, $columns); 71 | 72 | return $this; 73 | } 74 | 75 | /** 76 | * Returning the columns. 77 | * 78 | * @return Column[] 79 | */ 80 | public function getColumns() 81 | { 82 | return $this->columns; 83 | } 84 | 85 | /** 86 | * {@inheritdoc} 87 | */ 88 | public function execute() 89 | { 90 | $startTime = \microtime(true); 91 | $this->resolveDataSet(); 92 | 93 | $this->executeJoin(); 94 | $this->executeWhere(); 95 | $this->executeOrder(); 96 | $this->executeGroupBy(); 97 | $this->executeSelect(); 98 | $this->executeLimit(); 99 | 100 | $endTime = \microtime(true); 101 | 102 | $returnSet = new ReturnSet(); 103 | $returnSet->setDataSet($this->dataSet); 104 | $returnSet->setTime($endTime - $startTime); 105 | 106 | return $returnSet; 107 | } 108 | 109 | public function executeSelect() 110 | { 111 | $columns = $this->columns; 112 | 113 | $dataSet = new DataSet(); 114 | 115 | $columns = $this->columns; 116 | 117 | if (empty($columns)) { 118 | $columns = array_values($this->table->getColumns()); 119 | 120 | foreach ($this->joins as $key => $join) { 121 | $table = $join->getTable(); 122 | 123 | $joinedTableColumns = array_values($table->getColumns()); 124 | 125 | $columns = array_merge($columns, $joinedTableColumns); 126 | } 127 | } 128 | 129 | foreach ($columns as $column) { 130 | $dataSet->newColumn(Parser::parseName($column)); 131 | } 132 | 133 | $rows = []; 134 | 135 | if ($this->grouped) { 136 | /** @var GroupedDataSet $groupedSet */ 137 | foreach ($this->groupedSets as $key=>$groupedSet) { 138 | $row = new Row(); 139 | $row->setDataSet($dataSet); 140 | $row->setIndex($key); 141 | foreach ($columns as $column) { 142 | $row->newCell($groupedSet->getValue($column)); 143 | } 144 | $rows[] = $row; 145 | } 146 | } else { 147 | $count = $this->dataSet->getCount(); 148 | 149 | for ($i = 0; $i < $count; $i++) { 150 | $row = new Row(); 151 | $row->setDataSet($dataSet); 152 | $row->setIndex($i); 153 | foreach ($columns as $column) { 154 | $row->newCell($this->dataSet->getValue($column, $i)); 155 | } 156 | $rows[] = $row; 157 | } 158 | } 159 | 160 | $dataSet->__setRows($rows); 161 | $this->dataSet = $dataSet; 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /src/Query/Type/Insert.php: -------------------------------------------------------------------------------- 1 | dataSet = Helper::parseDataArray($arr); 38 | 39 | return $this; 40 | } 41 | 42 | /** 43 | * Inserting a data set directly. 44 | * 45 | * @param DataSet $set 46 | * 47 | * @return self 48 | */ 49 | public function dataSet($set) 50 | { 51 | $this->dataSet = $set; 52 | 53 | return $this; 54 | } 55 | 56 | /** 57 | * Table to insert data. 58 | * 59 | * @param Table $table 60 | * 61 | * @return self 62 | */ 63 | public function into($table) 64 | { 65 | if ($table->isAliased()) { 66 | // \\ 67 | throw new ABException('Aliased tables is not valid to insert queries.', 24); 68 | } 69 | $this->table = $table; 70 | 71 | return $this; 72 | } 73 | 74 | /** 75 | * Inserting data from another query. 76 | * 77 | * @param Select $selectQuery 78 | */ 79 | public function query($selectQuery) 80 | { 81 | } 82 | 83 | /** 84 | * Validating the query. 85 | * 86 | * @throws ABException 87 | * 88 | * @return void 89 | */ 90 | public function __validate() 91 | { 92 | if (!isset($this->dataSet)) { 93 | // \\ 94 | throw new ABException('Please provide a data set to insert query', 21); 95 | } 96 | if (!isset($this->dataSet)) { 97 | // \\ 98 | throw new ABException('Please provide a table to insert data', 22); 99 | } 100 | } 101 | 102 | /** 103 | * Execute the query. 104 | * 105 | * @return DataSet 106 | */ 107 | public function execute() 108 | { 109 | $startTime = microtime(true); 110 | 111 | $this->__validate(); 112 | 113 | $lastId = $this->executeInsert(); 114 | 115 | $endTime = microtime(true); 116 | 117 | $returnSet = new ReturnSet(); 118 | 119 | $returnSet->setAffectedRowsCount($this->dataSet->getCount()); 120 | $returnSet->setTime($endTime - $startTime); 121 | $returnSet->setLastIndex($lastId); 122 | 123 | return $returnSet; 124 | } 125 | 126 | protected function executeInsert() 127 | { 128 | $set = $this->dataSet; 129 | $oldSet = $this->table->__getDataSet(); 130 | 131 | $aliases = $set->getAliases(); 132 | 133 | foreach ($aliases as $alias) { 134 | if (array_search($alias, $this->table->getColumnNames()) < 0) { 135 | // \\ 136 | throw new ABException("Invalid column name '$alias' in new Dataset.", 20); 137 | } 138 | } 139 | 140 | $rowCount = $set->getCount(); 141 | 142 | // Creating a new data set 143 | $newSet = new DataSet(); 144 | 145 | $originalAliases = $oldSet->getAliases(); 146 | 147 | for ($i = 0; $i < $rowCount; $i++) { 148 | $newRow = $newSet->newRow(); 149 | $oldRow = $set->getRow($i); 150 | 151 | foreach ($originalAliases as $key => $originalAlias) { 152 | if ($i == 0) { 153 | $newSet->addAlias($originalAlias); 154 | } 155 | $srcIndex = array_search($originalAlias, $aliases); 156 | $column = $this->table->getColumn($originalAlias); 157 | 158 | $value = null; 159 | if (is_numeric($srcIndex)) { 160 | $cell = $oldRow->getCell($srcIndex); 161 | $value = $cell ? $cell->getValue() : null; 162 | } elseif ($column->isAutoIncrement()) { 163 | $value = $newRow->getIndex() + 1; 164 | } 165 | 166 | if (is_null($value)) { 167 | $value = $column->getDefaultValue(); 168 | } 169 | 170 | $column->validateValue($value); 171 | 172 | $newRow->newCell($value); 173 | } 174 | } 175 | 176 | $oldSet->mergeDataSet($newSet); 177 | 178 | return $oldSet->getCount() - 1; 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /src/Query/Traits/Joinable.php: -------------------------------------------------------------------------------- 1 | setAB($this->ab)->setQuery($this->query); 48 | 49 | $join->setTable($tbl); 50 | 51 | $this->joins[] = $join; 52 | 53 | return $join; 54 | } 55 | 56 | /** 57 | * Transforming the aliases in a dataset by prepending table name. 58 | * 59 | * @param string $tableName 60 | * @param DataSet $dataSetOrg 61 | * 62 | * @return DataSet 63 | */ 64 | protected function __globalizeDataSet($tableName, $dataSetOrg) 65 | { 66 | $dataSet = $dataSetOrg->cloneMe(); 67 | $dataSet->globalizeMe($tableName); 68 | 69 | return $dataSet; 70 | } 71 | 72 | /** 73 | * Making new data set by merging dual rows. 74 | * 75 | * @param Row $firstRow 76 | * @param Row $secondRow 77 | * 78 | * @return DataSet 79 | */ 80 | protected function makeNewSetByDualRows($firstRow, $secondRow) 81 | { 82 | $fristAliases = $firstRow->getDataSet()->getAliases(); 83 | $secondAliases = $secondRow->getDataSet()->getAliases(); 84 | $index = $firstRow->getIndex(); 85 | 86 | $tmpDataSet = new DataSet(); 87 | 88 | foreach ($fristAliases as $key => $alias) { 89 | $tmpDataSet->addColumnData($alias, [$firstRow->getCell($key)]); 90 | } 91 | 92 | foreach ($secondAliases as $key => $alias) { 93 | if (!in_array($alias, $fristAliases)) { 94 | $tmpDataSet->addColumnData($alias, [$secondRow->getCell($key)]); 95 | } 96 | } 97 | 98 | $row = $tmpDataSet->getRow(0); 99 | $row->setIndex($index); 100 | 101 | return $tmpDataSet; 102 | } 103 | 104 | /** 105 | * Executing the join clause in the query. 106 | * 107 | * @return DataSet 108 | */ 109 | public function executeJoin() 110 | { 111 | 112 | /** @var Join $join */ 113 | foreach ($this->joins as $join) { 114 | $table = $join->getTable(); 115 | 116 | $mode = $join->getMode(); 117 | 118 | /** @var DataSet $joiningDataSet */ 119 | $joiningDataSet = $this->__globalizeDataSet($table->getName(), $table->__getDataSet()); 120 | 121 | if ($mode == AB_JOIN_RIGHT) { 122 | $rightDataSet = $this->dataSet; 123 | $leftDataSet = $joiningDataSet; 124 | } else { 125 | $rightDataSet = $joiningDataSet; 126 | $leftDataSet = $this->dataSet; 127 | } 128 | 129 | $joinedSet = new DataSet(); 130 | 131 | $leftAliases = $leftDataSet->getAliases(); 132 | $rightAliases = $rightDataSet->getAliases(); 133 | 134 | foreach ($leftAliases as $leftAliase) { 135 | $joinedSet->newColumn($leftAliase); 136 | } 137 | 138 | foreach ($rightAliases as $rightAliase) { 139 | if (!in_array($rightAliase, $leftAliases)) { 140 | $joinedSet->newColumn($rightAliase); 141 | } 142 | } 143 | 144 | $leftDataSetCount = $leftDataSet->getCount(); 145 | $rightDataSetCount = $rightDataSet->getCount(); 146 | 147 | for ($i = 0; $i < $leftDataSetCount; $i++) { 148 | $leftRow = $leftDataSet->getRow($i); 149 | 150 | $foundOneRight = false; 151 | for ($j = 0; $j < $rightDataSetCount; $j++) { 152 | if (!($foundOneRight && $mode != AB_JOIN_INNER)) { 153 | $rightRow = $rightDataSet->getRow($j); 154 | 155 | $tmpDataSet = $this->makeNewSetByDualRows($leftRow, $rightRow); 156 | 157 | $on = $join->getOnCluase(); 158 | 159 | $matched = $on->setDataSet($tmpDataSet)->execute(0); 160 | 161 | if ($matched) { 162 | if ($mode != AB_JOIN_OUTER) { 163 | $foundOneRight = true; 164 | } 165 | 166 | $newSet = $this->makeNewSetByDualRows($leftRow, $rightRow); 167 | 168 | $joinedSet->mergeDataSet($newSet); 169 | } elseif ($mode != AB_JOIN_INNER && $j == $rightDataSetCount - 1 && $i == $leftDataSetCount - 1) { 170 | $newSet = $this->makeNewSetByDualRows($leftRow, $rightRow->newNullRow(count($rightAliases))); 171 | 172 | $joinedSet->mergeDataSet($newSet); 173 | 174 | if ($mode == AB_JOIN_OUTER) { 175 | $newSet = $this->makeNewSetByDualRows($leftRow->newNullRow(count($leftAliases)), $rightRow); 176 | 177 | $joinedSet->mergeDataSet($newSet); 178 | } 179 | } 180 | } 181 | } 182 | } 183 | 184 | $this->dataSet = $joinedSet; 185 | } 186 | } 187 | } 188 | -------------------------------------------------------------------------------- /src/Helper.php: -------------------------------------------------------------------------------- 1 | 'WhizSid\ArrayBase\AB\Table', 35 | 'column' => 'WhizSid\ArrayBase\AB\Table\Column', 36 | 'bindedcolumn'=> 'WhizSid\ArrayBase\Query\Objects\ColumnWithIndex', 37 | 'dataset' => 'WhizSid\ArrayBase\AB\DataSet', 38 | 'cell' => 'WhizSid\ArrayBase\AB\DataSet\Row\Cell', 39 | 'query' => 'WhizSid\ArrayBase\Query', 40 | 'selectquery' => 'WhizSid\ArrayBase\Query\Type\Select', 41 | 'updatequery' => 'WhizSid\ArrayBase\Query\Type\Update', 42 | 'insertquery' => 'WhizSid\ArrayBase\Query\Type\Insert', 43 | 'deletequery' => 'WhizSid\ArrayBase\Query\Type\Delete', 44 | ]; 45 | 46 | /** 47 | * Parsing data array to dataset. 48 | * 49 | * @param array $arr 50 | * 51 | * @return DataSet 52 | */ 53 | public static function parseDataArray($arr) 54 | { 55 | $dataSet = new DataSet(); 56 | 57 | $keys = array_keys($arr); 58 | 59 | if (is_numeric($keys[0])) { 60 | $secondKeys = array_keys($arr[$keys[0]]); 61 | if (is_string($secondKeys[0])) { 62 | foreach ($arr as $key => $row) { 63 | $dataSetRow = $dataSet->newRow(); 64 | 65 | foreach ($row as $secondKey=>$cell) { 66 | if ($key == 0) { 67 | $dataSet->addAlias($secondKey); 68 | } 69 | 70 | $dataSetRow->newCell($cell); 71 | } 72 | } 73 | } else { 74 | // \\ 75 | throw new ABException('Suplied array format is invalid to parseDataArray.', 17); 76 | } 77 | } elseif (is_string($keys[0])) { 78 | $row = $dataSet->newRow(); 79 | 80 | foreach ($arr as $cellName=>$value) { 81 | $dataSet->addAlias($cellName); 82 | 83 | $row->newCell($value); 84 | } 85 | } else { 86 | // \\ 87 | throw new ABException('Suplied array format is invalid to parseDataArray.', 17); 88 | } 89 | 90 | return $dataSet; 91 | } 92 | 93 | /** 94 | * Passing multidimentional assoc array as a table. 95 | * 96 | * @param AB $ab 97 | * @param string $name 98 | * @param array $arr 99 | */ 100 | public static function parseTable($ab, $name, $arr) 101 | { 102 | $dataSet = self::parseDataArray($arr); 103 | 104 | if (!$dataSet->getCount()) { 105 | // \\ 106 | throw new ABException('Can not parse empty data set as a table', 25); 107 | } 108 | // Creating a array base table 109 | $ab->createTable($name, function (Table $tbl) use ($dataSet) { 110 | $firstRow = $dataSet->getRow(0); 111 | 112 | $aliases = $dataSet->getAliases(); 113 | 114 | foreach ($aliases as $cellIndex => $alias) { 115 | $cell = $firstRow->getCell($cellIndex); 116 | 117 | if (is_numeric($cell->getValue())) { 118 | $type = 'integer'; 119 | } elseif (is_float($cell->getValue())) { 120 | $type = 'decimal'; 121 | } elseif (is_string($cell->getValue())) { 122 | $type = 'varchar'; 123 | } else { 124 | // \\ 125 | throw new ABException('Invalid cell value supplied to parsing array', 26); 126 | } 127 | 128 | $tbl->createColumn($alias, function (Column $clmn) use ($type) { 129 | $clmn->setType($type); 130 | }); 131 | } 132 | }); 133 | 134 | $table = $ab->getTable($name); 135 | 136 | $ab->query()->insert()->into($table)->dataSet($dataSet)->execute(); 137 | 138 | return $table; 139 | } 140 | 141 | /** 142 | * Converting a string in underscore notaion to PascalCase. 143 | * 144 | * @param string $str 145 | * 146 | * @return string 147 | */ 148 | public static function pascalCase($str) 149 | { 150 | $camelCased = preg_replace_callback('/_([a-zA-Z0-9])/', function ($matched) { 151 | return strtoupper($matched[1]); 152 | }, $str); 153 | 154 | return ucfirst($camelCased); 155 | } 156 | 157 | /** 158 | * Checking the given value is in the correct type. 159 | */ 160 | public static function __callStatic($name, $arguments) 161 | { 162 | if (strtolower(substr($name, 0, 2)) == 'is' && count($arguments) == 1) { 163 | if (isset(self::$types[strtolower(substr($name, 2))])) { 164 | return is_object($arguments[0]) && self::$types[strtolower(substr($name, 2))] == get_class($arguments[0]); 165 | } else { 166 | // \\ 167 | throw new ABException("Invalid type supplied. Can not find the type $name.", 28); 168 | } 169 | } else { 170 | throw new BadMethodCallException('Invalid function called.'); 171 | } 172 | } 173 | 174 | /** 175 | * Checking a parsed value is a function or not. 176 | * 177 | * @param ABFunction $func 178 | * 179 | * @return bool 180 | */ 181 | public static function isFunction($func) 182 | { 183 | return is_subclass_of($func, ABFunction::class); 184 | } 185 | 186 | /** 187 | * Checking a parsed value is a agregate function or not. 188 | * 189 | * @param Agregate $func 190 | * 191 | * @return bool 192 | */ 193 | public static function isAgregate($func) 194 | { 195 | return is_subclass_of($func, Agregate::class); 196 | } 197 | } 198 | -------------------------------------------------------------------------------- /src/AB/Table/Column.php: -------------------------------------------------------------------------------- 1 | 'Date', 51 | 'integer'=> 'Integer', 52 | 'varchar'=> 'VarChar', 53 | ]; 54 | /** 55 | * You can also write comments to columns. 56 | * 57 | * @var string 58 | */ 59 | protected $comment; 60 | 61 | /** 62 | * Creating a column to a table. 63 | * 64 | * @param string $name 65 | */ 66 | public function __construct($name) 67 | { 68 | $this->name = $name; 69 | } 70 | 71 | /** 72 | * Setting column type. 73 | * 74 | * @param string $str 75 | * 76 | * @throws ABException 77 | * 78 | * @return void 79 | */ 80 | public function setType($str) 81 | { 82 | $this->validateName(); 83 | 84 | if (!in_array($str, array_keys($this->dataTypeAliases))) { 85 | // \\ 86 | throw new ABException('Invalid type "'.$str.'" for column "'.$this->name.'". Available types is '.implode(',', array_keys($this->dataTypeAliases)), 3); 87 | } 88 | $typeFullName = '\WhizSid\ArrayBase\AB\Table\DataType\\'.$this->dataTypeAliases[$str]; 89 | 90 | $this->type = new $typeFullName(); 91 | 92 | $this->setMaxLength(); 93 | } 94 | 95 | /** 96 | * Getting the column type. 97 | * 98 | * @return DataType\DataType 99 | */ 100 | public function getType() 101 | { 102 | return $this->type; 103 | } 104 | 105 | /** 106 | * Validating the column name. 107 | * 108 | * @throws ABException 109 | * 110 | * @return void 111 | */ 112 | protected function validateName() 113 | { 114 | if (!isset($this->name)) { 115 | // \\ 116 | throw new ABException('Please set a name to the column.', 4); 117 | } 118 | } 119 | 120 | /** 121 | * Validating type. 122 | * 123 | * @throws ABException 124 | * 125 | * @return void 126 | */ 127 | protected function validateType() 128 | { 129 | if (!isset($this->type)) { 130 | // \\ 131 | throw new ABException('Please set a type to the column.', 5); 132 | } 133 | } 134 | 135 | /** 136 | * Validating column required properties. 137 | * 138 | * @return void 139 | */ 140 | public function validate() 141 | { 142 | $this->validateName(); 143 | $this->validateType(); 144 | } 145 | 146 | /** 147 | * Setting max length for the column. 148 | * 149 | * @param int $max 150 | */ 151 | public function setMaxLength(int $max = null) 152 | { 153 | $this->validate(); 154 | 155 | if (!$max) { 156 | $max = $this->type->getDefaultMaxLength(); 157 | } 158 | 159 | $this->type->validateMaxLength($max); 160 | 161 | $this->maxLength = $max; 162 | } 163 | 164 | /** 165 | * Returning the max length for the column. 166 | * 167 | * @return int 168 | */ 169 | public function getMaxLength() 170 | { 171 | return $this->maxLength; 172 | } 173 | 174 | /** 175 | * Setting a default value to column. 176 | * 177 | * @param mixed $data 178 | * 179 | * @return void 180 | */ 181 | public function setDefaultValue($data) 182 | { 183 | $this->validate(); 184 | 185 | $content = $data; 186 | if (is_callable($data)) { 187 | $content = $data(); 188 | } 189 | 190 | $this->validateValue($content); 191 | 192 | $this->default = $data; 193 | } 194 | 195 | /** 196 | * Validating a given value by the column type. 197 | * 198 | * @param mixed $value 199 | * 200 | * @throws ABException 201 | * 202 | * @return void 203 | */ 204 | public function validateValue($value) 205 | { 206 | if (!is_null($value) && !$this->type->validate($value)) { 207 | // \\ 208 | throw new ABException('Invalid value provided to column. The value should be in "'.$this->type->getName().'" type.', 6); 209 | } 210 | if (!is_null($value) && $this->maxLength < strlen($value)) { 211 | // \\ 212 | throw new ABException('Supplied value is greater than the max length.', 7); 213 | } 214 | if (!$this->nullable && is_null($value)) { 215 | // \\ 216 | throw new ABException('Empty value supplied to non nullable column.', 8); 217 | } 218 | } 219 | 220 | /** 221 | * Getting default value for column. 222 | * 223 | * @return mixed 224 | */ 225 | public function getDefaultValue() 226 | { 227 | if (is_callable($this->default)) { 228 | return $this->default(); 229 | } else { 230 | return $this->default; 231 | } 232 | } 233 | 234 | /** 235 | * Setting the column to auto incrementing. 236 | * 237 | * @param bool $ai 238 | * 239 | * @throws ABException 240 | * 241 | * @return void 242 | */ 243 | public function setAutoIncrement(bool $ai = true) 244 | { 245 | $this->validate(); 246 | 247 | // \\ 248 | if ($this->type->getName() !== 'integer') { 249 | throw new ABException('We are allowing auto increment only for integer type columns', 9); 250 | } 251 | $this->autoIncrement = $ai; 252 | } 253 | 254 | /** 255 | * Determine the column has set to auto increment. 256 | * 257 | * @return bool 258 | */ 259 | public function isAutoIncrement() 260 | { 261 | return $this->autoIncrement; 262 | } 263 | 264 | /** 265 | * Setting nullable to columns. 266 | * 267 | * @param bool $nl 268 | * 269 | * @throws ABException 270 | * 271 | * @return void 272 | */ 273 | public function setNullable(bool $nl = true) 274 | { 275 | $this->validate(); 276 | 277 | // \\ 278 | if ($this->autoIncrement) { 279 | throw new ABException('We are not allowing to set nullable on auto incrementing columns', 10); 280 | } 281 | $this->nullable = $nl; 282 | } 283 | 284 | /** 285 | * Determine the weather the column has nullable attribute or not. 286 | * 287 | * @return bool 288 | */ 289 | public function isNullable() 290 | { 291 | return $this->nullable; 292 | } 293 | 294 | /** 295 | * Write a comment to the column. 296 | * 297 | * @param string $cmnt 298 | */ 299 | public function writeComment($cmnt) 300 | { 301 | $this->validate(); 302 | 303 | // \\ 304 | if (strlen($cmnt) > self::COMMENT_MAX_LENGTH) { 305 | throw new ABException('The comment max character length is '.self::COMMENT_MAX_LENGTH.'. Please summerize your comment.', 11); 306 | } 307 | $this->comment = substr($cmnt, 0, self::COMMENT_MAX_LENGTH); 308 | } 309 | 310 | /** 311 | * Getting the wrote comment. 312 | * 313 | * @return string 314 | */ 315 | public function getComment() 316 | { 317 | $this->validate(); 318 | 319 | return $this->comment; 320 | } 321 | 322 | /** 323 | * Reterning the full name with table name. 324 | * 325 | * @return string 326 | */ 327 | public function getFullName() 328 | { 329 | return $this->getTable()->getName().'.'.$this->getName(); 330 | } 331 | } 332 | -------------------------------------------------------------------------------- /src/AB/DataSet.php: -------------------------------------------------------------------------------- 1 | rows[$key]; 43 | } 44 | 45 | /** 46 | * Returning the count of data set. 47 | * 48 | * @return int 49 | */ 50 | public function getCount() 51 | { 52 | return count($this->rows); 53 | } 54 | 55 | /** 56 | * Creating a new row. 57 | * 58 | * @return Row 59 | */ 60 | public function newRow() 61 | { 62 | $row = new Row(); 63 | 64 | $row->setDataSet($this); 65 | 66 | $index = $this->getCount(); 67 | $row->setIndex($index); 68 | 69 | $this->rows[] = $row; 70 | 71 | return $row; 72 | } 73 | 74 | /** 75 | * Add a column alias to the data set. 76 | * 77 | * @param string $alias 78 | */ 79 | public function addAlias($alias) 80 | { 81 | $this->aliases[] = $alias; 82 | } 83 | 84 | /** 85 | * Renaming a alias. 86 | * 87 | * @param string $from 88 | * @param string $to 89 | * 90 | * @return void 91 | */ 92 | public function renameAlias($from, $to) 93 | { 94 | $index = $this->searchAlias($from); 95 | 96 | if ($index >= 0) { 97 | $this->aliases[$index] = $to; 98 | } else { 99 | // \\ 100 | throw new ABException("Can not find an alias with given name '$from'.", 18); 101 | } 102 | } 103 | 104 | /** 105 | * Returning the aliases list for the given dataset. 106 | * 107 | * @return string[] 108 | */ 109 | public function getAliases() 110 | { 111 | return $this->aliases; 112 | } 113 | 114 | /** 115 | * Returning the rows for data set. 116 | * 117 | * @return Row[] 118 | */ 119 | public function __getRows() 120 | { 121 | return $this->rows; 122 | } 123 | 124 | /** 125 | * Merge a data set to current data set. 126 | * 127 | * @param DataSet $set 128 | * 129 | * @return void 130 | */ 131 | public function mergeDataSet($set) 132 | { 133 | $rows = $set->__getRows(); 134 | 135 | if (count($set->getAliases()) != count($this->getAliases())) { 136 | // \\ 137 | throw new ABException('Column counts not matching for the new data set', 19); 138 | } 139 | $this->rows = array_merge($this->rows, $rows); 140 | } 141 | 142 | /** 143 | * Fixing another data set with the data set. 144 | * 145 | * @param DataSet $set 146 | * 147 | * @return void 148 | */ 149 | public function fixDataSet($set) 150 | { 151 | $aliases = $set->getAliases(); 152 | 153 | foreach ($aliases as $key=> $alias) { 154 | $columnData = $set->getColumnData($key); 155 | $this->addColumnData($alias, $columnData); 156 | } 157 | } 158 | 159 | /** 160 | * Returning a column data set. 161 | * 162 | * @param string|int $columnName 163 | * 164 | * @return Cell[] 165 | */ 166 | public function getColumnData($columnName) 167 | { 168 | $index = is_string($columnName) ? $this->searchAlias($columnName) : $columnName; 169 | 170 | if ($index < 0) { 171 | // \\ 172 | throw new ABException("Can not find an alias with given name '$columnName'.", 18); 173 | } 174 | $cells = []; 175 | 176 | foreach ($this->rows as $key => $row) { 177 | $cells[] = $row->getCell($index); 178 | } 179 | 180 | return $cells; 181 | } 182 | 183 | /** 184 | * Merging new column data set. 185 | * 186 | * @param string $name 187 | * @param Cell[] $data 188 | */ 189 | public function addColumnData($name, $data) 190 | { 191 | $exists = false; 192 | 193 | try { 194 | $this->searchAlias($name); 195 | 196 | $exists = true; 197 | } catch (\Exception $e) { 198 | $exists = false; 199 | } 200 | 201 | if ($exists) { 202 | // \\ 203 | throw new ABException('Column already in field list', 30); 204 | } 205 | if (!empty($this->getCount()) && count($data) != $this->getCount()) { 206 | // \\ 207 | throw new ABException('Row count is not matching for new data set.', 23); 208 | } 209 | $this->addAlias($name); 210 | 211 | if (count($this->aliases) == 1) { 212 | foreach ($data as $cell) { 213 | $row = $this->newRow(); 214 | $row->newCell($cell); 215 | } 216 | } else { 217 | foreach ($this->rows as $key => &$row) { 218 | $row->newCell($data[$key]); 219 | } 220 | } 221 | } 222 | 223 | /** 224 | * Creating a new empty column. 225 | * 226 | * @param string $name 227 | * @param mixed $defaultValue 228 | * 229 | * @return void 230 | */ 231 | public function newColumn($name, $defaultValue = null) 232 | { 233 | $this->aliases[] = $name; 234 | 235 | foreach ($this->rows as $row) { 236 | $row->newCell($defaultValue); 237 | } 238 | } 239 | 240 | /** 241 | * Returning the cell by row index and cell name or index. 242 | * 243 | * @param int|string|Column $column 244 | * @param int $rowIndex 245 | * 246 | * @return Cell 247 | */ 248 | public function getCell($column, $rowIndex) 249 | { 250 | $row = $this->getRow($rowIndex); 251 | 252 | if (Helper::isColumn($column)) { 253 | $column = $column->getTable()->getName().'.'.$column->getName(); 254 | } 255 | 256 | if (is_numeric($column)) { 257 | $index = $column; 258 | } else { 259 | $index = $this->searchAlias($column); 260 | } 261 | 262 | return $row->getCell($index); 263 | } 264 | 265 | /** 266 | * Searching for a alias and return the index of alias. 267 | * 268 | * @param string $alias 269 | * 270 | * @return int 271 | */ 272 | public function searchAlias($string) 273 | { 274 | $matchedAmb = []; 275 | 276 | $aliases = $this->aliases; 277 | 278 | foreach ($aliases as $key=> $alias) { 279 | $explodedAlias = explode('.', $alias); 280 | $explodedString = explode('.', $string); 281 | 282 | if (count($explodedString) == 2) { 283 | if (count($explodedAlias) == 2) { 284 | if ($alias == $string) { 285 | return $key; 286 | } 287 | } else { 288 | if ($alias == $explodedString[1]) { 289 | return $key; 290 | } 291 | } 292 | } else { 293 | if (count($explodedAlias) == 2) { 294 | if ($explodedAlias[1] == $string) { 295 | $matchedAmb[] = $key; 296 | } 297 | } else { 298 | if ($alias == $string) { 299 | return $key; 300 | } 301 | } 302 | } 303 | 304 | if (count($matchedAmb) > 1) { 305 | // \\ 306 | throw new Column("Column '$string' is ambigous. ", 29); 307 | } 308 | } 309 | 310 | if (count($matchedAmb) == 1) { 311 | return $matchedAmb[0]; 312 | } 313 | 314 | // \\ 315 | throw new ABException("Unknown column '$string' in field list.", 31); 316 | } 317 | 318 | /** 319 | * Setting the rows. 320 | * 321 | * @param Row[] $rows 322 | * 323 | * @return void 324 | */ 325 | public function __setRows($rows) 326 | { 327 | $this->rows = $rows; 328 | } 329 | 330 | /** 331 | * Deep cloning a dataset. 332 | * 333 | * @return self 334 | */ 335 | public function cloneMe() 336 | { 337 | $rows = $this->rows; 338 | 339 | $clonedMe = clone $this; 340 | 341 | $clonedRows = []; 342 | 343 | foreach ($rows as $row) { 344 | $clonedRow = clone $row; 345 | $clonedRow->setDataSet($clonedMe); 346 | $clonedRows[] = $clonedRow; 347 | } 348 | 349 | $clonedMe->__setRows($clonedRows); 350 | 351 | return $clonedMe; 352 | } 353 | 354 | /** 355 | * Globalizing the data set by prepending a name to all aliases. 356 | * 357 | * @param string $name 358 | * 359 | * @return bool 360 | */ 361 | public function globalizeMe($name) 362 | { 363 | if ($this->globalized) { 364 | return false; 365 | } 366 | 367 | $dataSetAliases = $this->getAliases(); 368 | 369 | foreach ($dataSetAliases as $dataSetAliase) { 370 | $this->renameAlias($dataSetAliase, $name.'.'.$dataSetAliase); 371 | } 372 | 373 | return true; 374 | } 375 | 376 | /** 377 | * Returning an value from dataset. 378 | * 379 | * @param mixed $var 380 | * 381 | * @return mixed 382 | */ 383 | public function getValue($var, $rowIndex) 384 | { 385 | if (Helper::isColumn($var)) { 386 | return $this->getCell($var, $rowIndex)->getValue(); 387 | } elseif (Helper::isFunction($var)) { 388 | return $var->setDataSet($this)->execute($rowIndex); 389 | } else { 390 | return $var; 391 | } 392 | } 393 | } 394 | -------------------------------------------------------------------------------- /logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 28 | 29 | 50 | 57 | 64 | 71 | 78 | 85 | 92 | 99 | 104 | 109 | 116 | 121 | 128 | 135 | 142 | 147 | 148 | 150 | 151 | 153 | image/svg+xml 154 | 156 | 157 | 158 | 159 | 160 | 165 | 170 | 175 | 180 | 187 | 194 | 199 | 204 | 210 | 216 | 222 | 228 | ArrayBase 243 | 244 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "f9c3c4215a012dc712e83afad6f64d85", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "doctrine/instantiator", 12 | "version": "dev-master", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/doctrine/instantiator.git", 16 | "reference": "8c8c1afee0f929f17528fe1721de5d58e15f71c7" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8c8c1afee0f929f17528fe1721de5d58e15f71c7", 21 | "reference": "8c8c1afee0f929f17528fe1721de5d58e15f71c7", 22 | "shasum": "" 23 | }, 24 | "require": { 25 | "php": "^7.1" 26 | }, 27 | "require-dev": { 28 | "doctrine/coding-standard": "^5.0", 29 | "ext-pdo": "*", 30 | "ext-phar": "*", 31 | "phpbench/phpbench": "^0.13", 32 | "phpstan/phpstan-shim": "^0.9.2", 33 | "phpunit/phpunit": "^7.0" 34 | }, 35 | "type": "library", 36 | "extra": { 37 | "branch-alias": { 38 | "dev-master": "1.2.x-dev" 39 | } 40 | }, 41 | "autoload": { 42 | "psr-4": { 43 | "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" 44 | } 45 | }, 46 | "notification-url": "https://packagist.org/downloads/", 47 | "license": [ 48 | "MIT" 49 | ], 50 | "authors": [ 51 | { 52 | "name": "Marco Pivetta", 53 | "email": "ocramius@gmail.com", 54 | "homepage": "http://ocramius.github.com/" 55 | } 56 | ], 57 | "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", 58 | "homepage": "https://www.doctrine-project.org/projects/instantiator.html", 59 | "keywords": [ 60 | "constructor", 61 | "instantiate" 62 | ], 63 | "time": "2018-10-15T11:30:00+00:00" 64 | }, 65 | { 66 | "name": "myclabs/deep-copy", 67 | "version": "1.x-dev", 68 | "source": { 69 | "type": "git", 70 | "url": "https://github.com/myclabs/DeepCopy.git", 71 | "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8" 72 | }, 73 | "dist": { 74 | "type": "zip", 75 | "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", 76 | "reference": "3e01bdad3e18354c3dce54466b7fbe33a9f9f7f8", 77 | "shasum": "" 78 | }, 79 | "require": { 80 | "php": "^7.1" 81 | }, 82 | "replace": { 83 | "myclabs/deep-copy": "self.version" 84 | }, 85 | "require-dev": { 86 | "doctrine/collections": "^1.0", 87 | "doctrine/common": "^2.6", 88 | "phpunit/phpunit": "^7.1" 89 | }, 90 | "type": "library", 91 | "autoload": { 92 | "psr-4": { 93 | "DeepCopy\\": "src/DeepCopy/" 94 | }, 95 | "files": [ 96 | "src/DeepCopy/deep_copy.php" 97 | ] 98 | }, 99 | "notification-url": "https://packagist.org/downloads/", 100 | "license": [ 101 | "MIT" 102 | ], 103 | "description": "Create deep copies (clones) of your objects", 104 | "keywords": [ 105 | "clone", 106 | "copy", 107 | "duplicate", 108 | "object", 109 | "object graph" 110 | ], 111 | "time": "2018-06-11T23:09:50+00:00" 112 | }, 113 | { 114 | "name": "phar-io/manifest", 115 | "version": "1.0.1", 116 | "source": { 117 | "type": "git", 118 | "url": "https://github.com/phar-io/manifest.git", 119 | "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" 120 | }, 121 | "dist": { 122 | "type": "zip", 123 | "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", 124 | "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", 125 | "shasum": "" 126 | }, 127 | "require": { 128 | "ext-dom": "*", 129 | "ext-phar": "*", 130 | "phar-io/version": "^1.0.1", 131 | "php": "^5.6 || ^7.0" 132 | }, 133 | "type": "library", 134 | "extra": { 135 | "branch-alias": { 136 | "dev-master": "1.0.x-dev" 137 | } 138 | }, 139 | "autoload": { 140 | "classmap": [ 141 | "src/" 142 | ] 143 | }, 144 | "notification-url": "https://packagist.org/downloads/", 145 | "license": [ 146 | "BSD-3-Clause" 147 | ], 148 | "authors": [ 149 | { 150 | "name": "Arne Blankerts", 151 | "email": "arne@blankerts.de", 152 | "role": "Developer" 153 | }, 154 | { 155 | "name": "Sebastian Heuer", 156 | "email": "sebastian@phpeople.de", 157 | "role": "Developer" 158 | }, 159 | { 160 | "name": "Sebastian Bergmann", 161 | "email": "sebastian@phpunit.de", 162 | "role": "Developer" 163 | } 164 | ], 165 | "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", 166 | "time": "2017-03-05T18:14:27+00:00" 167 | }, 168 | { 169 | "name": "phar-io/version", 170 | "version": "1.0.1", 171 | "source": { 172 | "type": "git", 173 | "url": "https://github.com/phar-io/version.git", 174 | "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" 175 | }, 176 | "dist": { 177 | "type": "zip", 178 | "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", 179 | "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", 180 | "shasum": "" 181 | }, 182 | "require": { 183 | "php": "^5.6 || ^7.0" 184 | }, 185 | "type": "library", 186 | "autoload": { 187 | "classmap": [ 188 | "src/" 189 | ] 190 | }, 191 | "notification-url": "https://packagist.org/downloads/", 192 | "license": [ 193 | "BSD-3-Clause" 194 | ], 195 | "authors": [ 196 | { 197 | "name": "Arne Blankerts", 198 | "email": "arne@blankerts.de", 199 | "role": "Developer" 200 | }, 201 | { 202 | "name": "Sebastian Heuer", 203 | "email": "sebastian@phpeople.de", 204 | "role": "Developer" 205 | }, 206 | { 207 | "name": "Sebastian Bergmann", 208 | "email": "sebastian@phpunit.de", 209 | "role": "Developer" 210 | } 211 | ], 212 | "description": "Library for handling version information and constraints", 213 | "time": "2017-03-05T17:38:23+00:00" 214 | }, 215 | { 216 | "name": "phpdocumentor/reflection-common", 217 | "version": "1.0.1", 218 | "source": { 219 | "type": "git", 220 | "url": "https://github.com/phpDocumentor/ReflectionCommon.git", 221 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" 222 | }, 223 | "dist": { 224 | "type": "zip", 225 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 226 | "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", 227 | "shasum": "" 228 | }, 229 | "require": { 230 | "php": ">=5.5" 231 | }, 232 | "require-dev": { 233 | "phpunit/phpunit": "^4.6" 234 | }, 235 | "type": "library", 236 | "extra": { 237 | "branch-alias": { 238 | "dev-master": "1.0.x-dev" 239 | } 240 | }, 241 | "autoload": { 242 | "psr-4": { 243 | "phpDocumentor\\Reflection\\": [ 244 | "src" 245 | ] 246 | } 247 | }, 248 | "notification-url": "https://packagist.org/downloads/", 249 | "license": [ 250 | "MIT" 251 | ], 252 | "authors": [ 253 | { 254 | "name": "Jaap van Otterdijk", 255 | "email": "opensource@ijaap.nl" 256 | } 257 | ], 258 | "description": "Common reflection classes used by phpdocumentor to reflect the code structure", 259 | "homepage": "http://www.phpdoc.org", 260 | "keywords": [ 261 | "FQSEN", 262 | "phpDocumentor", 263 | "phpdoc", 264 | "reflection", 265 | "static analysis" 266 | ], 267 | "time": "2017-09-11T18:02:19+00:00" 268 | }, 269 | { 270 | "name": "phpdocumentor/reflection-docblock", 271 | "version": "4.3.0", 272 | "source": { 273 | "type": "git", 274 | "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", 275 | "reference": "94fd0001232e47129dd3504189fa1c7225010d08" 276 | }, 277 | "dist": { 278 | "type": "zip", 279 | "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", 280 | "reference": "94fd0001232e47129dd3504189fa1c7225010d08", 281 | "shasum": "" 282 | }, 283 | "require": { 284 | "php": "^7.0", 285 | "phpdocumentor/reflection-common": "^1.0.0", 286 | "phpdocumentor/type-resolver": "^0.4.0", 287 | "webmozart/assert": "^1.0" 288 | }, 289 | "require-dev": { 290 | "doctrine/instantiator": "~1.0.5", 291 | "mockery/mockery": "^1.0", 292 | "phpunit/phpunit": "^6.4" 293 | }, 294 | "type": "library", 295 | "extra": { 296 | "branch-alias": { 297 | "dev-master": "4.x-dev" 298 | } 299 | }, 300 | "autoload": { 301 | "psr-4": { 302 | "phpDocumentor\\Reflection\\": [ 303 | "src/" 304 | ] 305 | } 306 | }, 307 | "notification-url": "https://packagist.org/downloads/", 308 | "license": [ 309 | "MIT" 310 | ], 311 | "authors": [ 312 | { 313 | "name": "Mike van Riel", 314 | "email": "me@mikevanriel.com" 315 | } 316 | ], 317 | "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", 318 | "time": "2017-11-30T07:14:17+00:00" 319 | }, 320 | { 321 | "name": "phpdocumentor/type-resolver", 322 | "version": "0.4.0", 323 | "source": { 324 | "type": "git", 325 | "url": "https://github.com/phpDocumentor/TypeResolver.git", 326 | "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" 327 | }, 328 | "dist": { 329 | "type": "zip", 330 | "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", 331 | "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", 332 | "shasum": "" 333 | }, 334 | "require": { 335 | "php": "^5.5 || ^7.0", 336 | "phpdocumentor/reflection-common": "^1.0" 337 | }, 338 | "require-dev": { 339 | "mockery/mockery": "^0.9.4", 340 | "phpunit/phpunit": "^5.2||^4.8.24" 341 | }, 342 | "type": "library", 343 | "extra": { 344 | "branch-alias": { 345 | "dev-master": "1.0.x-dev" 346 | } 347 | }, 348 | "autoload": { 349 | "psr-4": { 350 | "phpDocumentor\\Reflection\\": [ 351 | "src/" 352 | ] 353 | } 354 | }, 355 | "notification-url": "https://packagist.org/downloads/", 356 | "license": [ 357 | "MIT" 358 | ], 359 | "authors": [ 360 | { 361 | "name": "Mike van Riel", 362 | "email": "me@mikevanriel.com" 363 | } 364 | ], 365 | "time": "2017-07-14T14:27:02+00:00" 366 | }, 367 | { 368 | "name": "phpspec/prophecy", 369 | "version": "dev-master", 370 | "source": { 371 | "type": "git", 372 | "url": "https://github.com/phpspec/prophecy.git", 373 | "reference": "3660b2eed90abdf92ac2e9dae9a238d2701bfa77" 374 | }, 375 | "dist": { 376 | "type": "zip", 377 | "url": "https://api.github.com/repos/phpspec/prophecy/zipball/3660b2eed90abdf92ac2e9dae9a238d2701bfa77", 378 | "reference": "3660b2eed90abdf92ac2e9dae9a238d2701bfa77", 379 | "shasum": "" 380 | }, 381 | "require": { 382 | "doctrine/instantiator": "^1.0.2", 383 | "php": "^5.3|^7.0", 384 | "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", 385 | "sebastian/comparator": "^1.1|^2.0|^3.0", 386 | "sebastian/recursion-context": "^1.0|^2.0|^3.0" 387 | }, 388 | "require-dev": { 389 | "phpspec/phpspec": "^2.5|^3.2", 390 | "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" 391 | }, 392 | "type": "library", 393 | "extra": { 394 | "branch-alias": { 395 | "dev-master": "1.8.x-dev" 396 | } 397 | }, 398 | "autoload": { 399 | "psr-0": { 400 | "Prophecy\\": "src/" 401 | } 402 | }, 403 | "notification-url": "https://packagist.org/downloads/", 404 | "license": [ 405 | "MIT" 406 | ], 407 | "authors": [ 408 | { 409 | "name": "Konstantin Kudryashov", 410 | "email": "ever.zet@gmail.com", 411 | "homepage": "http://everzet.com" 412 | }, 413 | { 414 | "name": "Marcello Duarte", 415 | "email": "marcello.duarte@gmail.com" 416 | } 417 | ], 418 | "description": "Highly opinionated mocking framework for PHP 5.3+", 419 | "homepage": "https://github.com/phpspec/prophecy", 420 | "keywords": [ 421 | "Double", 422 | "Dummy", 423 | "fake", 424 | "mock", 425 | "spy", 426 | "stub" 427 | ], 428 | "time": "2018-11-04T18:50:11+00:00" 429 | }, 430 | { 431 | "name": "phpunit/php-code-coverage", 432 | "version": "6.0.5", 433 | "source": { 434 | "type": "git", 435 | "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 436 | "reference": "4cab20a326d14de7575a8e235c70d879b569a57a" 437 | }, 438 | "dist": { 439 | "type": "zip", 440 | "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4cab20a326d14de7575a8e235c70d879b569a57a", 441 | "reference": "4cab20a326d14de7575a8e235c70d879b569a57a", 442 | "shasum": "" 443 | }, 444 | "require": { 445 | "ext-dom": "*", 446 | "ext-xmlwriter": "*", 447 | "php": "^7.1", 448 | "phpunit/php-file-iterator": "^1.4.2", 449 | "phpunit/php-text-template": "^1.2.1", 450 | "phpunit/php-token-stream": "^3.0", 451 | "sebastian/code-unit-reverse-lookup": "^1.0.1", 452 | "sebastian/environment": "^3.1", 453 | "sebastian/version": "^2.0.1", 454 | "theseer/tokenizer": "^1.1" 455 | }, 456 | "require-dev": { 457 | "phpunit/phpunit": "^7.0" 458 | }, 459 | "suggest": { 460 | "ext-xdebug": "^2.6.0" 461 | }, 462 | "type": "library", 463 | "extra": { 464 | "branch-alias": { 465 | "dev-master": "6.0-dev" 466 | } 467 | }, 468 | "autoload": { 469 | "classmap": [ 470 | "src/" 471 | ] 472 | }, 473 | "notification-url": "https://packagist.org/downloads/", 474 | "license": [ 475 | "BSD-3-Clause" 476 | ], 477 | "authors": [ 478 | { 479 | "name": "Sebastian Bergmann", 480 | "email": "sebastian@phpunit.de", 481 | "role": "lead" 482 | } 483 | ], 484 | "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", 485 | "homepage": "https://github.com/sebastianbergmann/php-code-coverage", 486 | "keywords": [ 487 | "coverage", 488 | "testing", 489 | "xunit" 490 | ], 491 | "time": "2018-05-28T11:49:20+00:00" 492 | }, 493 | { 494 | "name": "phpunit/php-file-iterator", 495 | "version": "1.4.x-dev", 496 | "source": { 497 | "type": "git", 498 | "url": "https://github.com/sebastianbergmann/php-file-iterator.git", 499 | "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" 500 | }, 501 | "dist": { 502 | "type": "zip", 503 | "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", 504 | "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", 505 | "shasum": "" 506 | }, 507 | "require": { 508 | "php": ">=5.3.3" 509 | }, 510 | "type": "library", 511 | "extra": { 512 | "branch-alias": { 513 | "dev-master": "1.4.x-dev" 514 | } 515 | }, 516 | "autoload": { 517 | "classmap": [ 518 | "src/" 519 | ] 520 | }, 521 | "notification-url": "https://packagist.org/downloads/", 522 | "license": [ 523 | "BSD-3-Clause" 524 | ], 525 | "authors": [ 526 | { 527 | "name": "Sebastian Bergmann", 528 | "email": "sb@sebastian-bergmann.de", 529 | "role": "lead" 530 | } 531 | ], 532 | "description": "FilterIterator implementation that filters files based on a list of suffixes.", 533 | "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", 534 | "keywords": [ 535 | "filesystem", 536 | "iterator" 537 | ], 538 | "time": "2017-11-27T13:52:08+00:00" 539 | }, 540 | { 541 | "name": "phpunit/php-text-template", 542 | "version": "1.2.1", 543 | "source": { 544 | "type": "git", 545 | "url": "https://github.com/sebastianbergmann/php-text-template.git", 546 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" 547 | }, 548 | "dist": { 549 | "type": "zip", 550 | "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 551 | "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", 552 | "shasum": "" 553 | }, 554 | "require": { 555 | "php": ">=5.3.3" 556 | }, 557 | "type": "library", 558 | "autoload": { 559 | "classmap": [ 560 | "src/" 561 | ] 562 | }, 563 | "notification-url": "https://packagist.org/downloads/", 564 | "license": [ 565 | "BSD-3-Clause" 566 | ], 567 | "authors": [ 568 | { 569 | "name": "Sebastian Bergmann", 570 | "email": "sebastian@phpunit.de", 571 | "role": "lead" 572 | } 573 | ], 574 | "description": "Simple template engine.", 575 | "homepage": "https://github.com/sebastianbergmann/php-text-template/", 576 | "keywords": [ 577 | "template" 578 | ], 579 | "time": "2015-06-21T13:50:34+00:00" 580 | }, 581 | { 582 | "name": "phpunit/php-timer", 583 | "version": "dev-master", 584 | "source": { 585 | "type": "git", 586 | "url": "https://github.com/sebastianbergmann/php-timer.git", 587 | "reference": "9ef9968ba27999219d76ae3cef97aa0fa87bd90f" 588 | }, 589 | "dist": { 590 | "type": "zip", 591 | "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/9ef9968ba27999219d76ae3cef97aa0fa87bd90f", 592 | "reference": "9ef9968ba27999219d76ae3cef97aa0fa87bd90f", 593 | "shasum": "" 594 | }, 595 | "require": { 596 | "php": "^7.1" 597 | }, 598 | "require-dev": { 599 | "phpunit/phpunit": "^7.0" 600 | }, 601 | "type": "library", 602 | "extra": { 603 | "branch-alias": { 604 | "dev-master": "2.0-dev" 605 | } 606 | }, 607 | "autoload": { 608 | "classmap": [ 609 | "src/" 610 | ] 611 | }, 612 | "notification-url": "https://packagist.org/downloads/", 613 | "license": [ 614 | "BSD-3-Clause" 615 | ], 616 | "authors": [ 617 | { 618 | "name": "Sebastian Bergmann", 619 | "email": "sebastian@phpunit.de", 620 | "role": "lead" 621 | } 622 | ], 623 | "description": "Utility class for timing", 624 | "homepage": "https://github.com/sebastianbergmann/php-timer/", 625 | "keywords": [ 626 | "timer" 627 | ], 628 | "time": "2018-06-04T07:17:52+00:00" 629 | }, 630 | { 631 | "name": "phpunit/php-token-stream", 632 | "version": "dev-master", 633 | "source": { 634 | "type": "git", 635 | "url": "https://github.com/sebastianbergmann/php-token-stream.git", 636 | "reference": "6df086c042b6bb4fbcfcda15b8e52d5f8955aaee" 637 | }, 638 | "dist": { 639 | "type": "zip", 640 | "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/6df086c042b6bb4fbcfcda15b8e52d5f8955aaee", 641 | "reference": "6df086c042b6bb4fbcfcda15b8e52d5f8955aaee", 642 | "shasum": "" 643 | }, 644 | "require": { 645 | "ext-tokenizer": "*", 646 | "php": "^7.1" 647 | }, 648 | "require-dev": { 649 | "phpunit/phpunit": "^7.0" 650 | }, 651 | "type": "library", 652 | "extra": { 653 | "branch-alias": { 654 | "dev-master": "3.0-dev" 655 | } 656 | }, 657 | "autoload": { 658 | "classmap": [ 659 | "src/" 660 | ] 661 | }, 662 | "notification-url": "https://packagist.org/downloads/", 663 | "license": [ 664 | "BSD-3-Clause" 665 | ], 666 | "authors": [ 667 | { 668 | "name": "Sebastian Bergmann", 669 | "email": "sebastian@phpunit.de" 670 | } 671 | ], 672 | "description": "Wrapper around PHP's tokenizer extension.", 673 | "homepage": "https://github.com/sebastianbergmann/php-token-stream/", 674 | "keywords": [ 675 | "tokenizer" 676 | ], 677 | "time": "2018-10-30T07:50:55+00:00" 678 | }, 679 | { 680 | "name": "phpunit/phpunit", 681 | "version": "7.0.0", 682 | "source": { 683 | "type": "git", 684 | "url": "https://github.com/sebastianbergmann/phpunit.git", 685 | "reference": "9b3373439fdf2f3e9d1578f5e408a3a0d161c3bc" 686 | }, 687 | "dist": { 688 | "type": "zip", 689 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9b3373439fdf2f3e9d1578f5e408a3a0d161c3bc", 690 | "reference": "9b3373439fdf2f3e9d1578f5e408a3a0d161c3bc", 691 | "shasum": "" 692 | }, 693 | "require": { 694 | "ext-dom": "*", 695 | "ext-json": "*", 696 | "ext-libxml": "*", 697 | "ext-mbstring": "*", 698 | "ext-xml": "*", 699 | "myclabs/deep-copy": "^1.6.1", 700 | "phar-io/manifest": "^1.0.1", 701 | "phar-io/version": "^1.0", 702 | "php": "^7.1", 703 | "phpspec/prophecy": "^1.7", 704 | "phpunit/php-code-coverage": "^6.0", 705 | "phpunit/php-file-iterator": "^1.4.3", 706 | "phpunit/php-text-template": "^1.2.1", 707 | "phpunit/php-timer": "^2.0", 708 | "phpunit/phpunit-mock-objects": "^6.0", 709 | "sebastian/comparator": "^2.1", 710 | "sebastian/diff": "^3.0", 711 | "sebastian/environment": "^3.1", 712 | "sebastian/exporter": "^3.1", 713 | "sebastian/global-state": "^2.0", 714 | "sebastian/object-enumerator": "^3.0.3", 715 | "sebastian/resource-operations": "^1.0", 716 | "sebastian/version": "^2.0.1" 717 | }, 718 | "require-dev": { 719 | "ext-pdo": "*" 720 | }, 721 | "suggest": { 722 | "ext-xdebug": "*", 723 | "phpunit/php-invoker": "^2.0" 724 | }, 725 | "bin": [ 726 | "phpunit" 727 | ], 728 | "type": "library", 729 | "extra": { 730 | "branch-alias": { 731 | "dev-master": "7.0-dev" 732 | } 733 | }, 734 | "autoload": { 735 | "classmap": [ 736 | "src/" 737 | ] 738 | }, 739 | "notification-url": "https://packagist.org/downloads/", 740 | "license": [ 741 | "BSD-3-Clause" 742 | ], 743 | "authors": [ 744 | { 745 | "name": "Sebastian Bergmann", 746 | "email": "sebastian@phpunit.de", 747 | "role": "lead" 748 | } 749 | ], 750 | "description": "The PHP Unit Testing framework.", 751 | "homepage": "https://phpunit.de/", 752 | "keywords": [ 753 | "phpunit", 754 | "testing", 755 | "xunit" 756 | ], 757 | "time": "2018-02-02T05:04:08+00:00" 758 | }, 759 | { 760 | "name": "phpunit/phpunit-mock-objects", 761 | "version": "dev-master", 762 | "source": { 763 | "type": "git", 764 | "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 765 | "reference": "0dfddc236629eb7ead4df2dfa3d79d548e011a3b" 766 | }, 767 | "dist": { 768 | "type": "zip", 769 | "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/0dfddc236629eb7ead4df2dfa3d79d548e011a3b", 770 | "reference": "0dfddc236629eb7ead4df2dfa3d79d548e011a3b", 771 | "shasum": "" 772 | }, 773 | "require": { 774 | "doctrine/instantiator": "^1.0.5", 775 | "php": "^7.1", 776 | "phpunit/php-text-template": "^1.2.1", 777 | "sebastian/exporter": "^3.1" 778 | }, 779 | "require-dev": { 780 | "phpunit/phpunit": "^7.0" 781 | }, 782 | "suggest": { 783 | "ext-soap": "*" 784 | }, 785 | "type": "library", 786 | "extra": { 787 | "branch-alias": { 788 | "dev-master": "6.1-dev" 789 | } 790 | }, 791 | "autoload": { 792 | "classmap": [ 793 | "src/" 794 | ] 795 | }, 796 | "notification-url": "https://packagist.org/downloads/", 797 | "license": [ 798 | "BSD-3-Clause" 799 | ], 800 | "authors": [ 801 | { 802 | "name": "Sebastian Bergmann", 803 | "email": "sebastian@phpunit.de", 804 | "role": "lead" 805 | } 806 | ], 807 | "description": "Mock Object library for PHPUnit", 808 | "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", 809 | "keywords": [ 810 | "mock", 811 | "xunit" 812 | ], 813 | "time": "2018-09-09T05:49:38+00:00" 814 | }, 815 | { 816 | "name": "sebastian/code-unit-reverse-lookup", 817 | "version": "dev-master", 818 | "source": { 819 | "type": "git", 820 | "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", 821 | "reference": "22f5f5ff892d51035dd1fb4cd6b224a640ffb206" 822 | }, 823 | "dist": { 824 | "type": "zip", 825 | "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/22f5f5ff892d51035dd1fb4cd6b224a640ffb206", 826 | "reference": "22f5f5ff892d51035dd1fb4cd6b224a640ffb206", 827 | "shasum": "" 828 | }, 829 | "require": { 830 | "php": "^5.6 || ^7.0" 831 | }, 832 | "require-dev": { 833 | "phpunit/phpunit": "^5.7 || ^6.0" 834 | }, 835 | "type": "library", 836 | "extra": { 837 | "branch-alias": { 838 | "dev-master": "1.0.x-dev" 839 | } 840 | }, 841 | "autoload": { 842 | "classmap": [ 843 | "src/" 844 | ] 845 | }, 846 | "notification-url": "https://packagist.org/downloads/", 847 | "license": [ 848 | "BSD-3-Clause" 849 | ], 850 | "authors": [ 851 | { 852 | "name": "Sebastian Bergmann", 853 | "email": "sebastian@phpunit.de" 854 | } 855 | ], 856 | "description": "Looks up which function or method a line of code belongs to", 857 | "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", 858 | "time": "2018-05-15T05:52:48+00:00" 859 | }, 860 | { 861 | "name": "sebastian/comparator", 862 | "version": "2.1.3", 863 | "source": { 864 | "type": "git", 865 | "url": "https://github.com/sebastianbergmann/comparator.git", 866 | "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9" 867 | }, 868 | "dist": { 869 | "type": "zip", 870 | "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/34369daee48eafb2651bea869b4b15d75ccc35f9", 871 | "reference": "34369daee48eafb2651bea869b4b15d75ccc35f9", 872 | "shasum": "" 873 | }, 874 | "require": { 875 | "php": "^7.0", 876 | "sebastian/diff": "^2.0 || ^3.0", 877 | "sebastian/exporter": "^3.1" 878 | }, 879 | "require-dev": { 880 | "phpunit/phpunit": "^6.4" 881 | }, 882 | "type": "library", 883 | "extra": { 884 | "branch-alias": { 885 | "dev-master": "2.1.x-dev" 886 | } 887 | }, 888 | "autoload": { 889 | "classmap": [ 890 | "src/" 891 | ] 892 | }, 893 | "notification-url": "https://packagist.org/downloads/", 894 | "license": [ 895 | "BSD-3-Clause" 896 | ], 897 | "authors": [ 898 | { 899 | "name": "Jeff Welch", 900 | "email": "whatthejeff@gmail.com" 901 | }, 902 | { 903 | "name": "Volker Dusch", 904 | "email": "github@wallbash.com" 905 | }, 906 | { 907 | "name": "Bernhard Schussek", 908 | "email": "bschussek@2bepublished.at" 909 | }, 910 | { 911 | "name": "Sebastian Bergmann", 912 | "email": "sebastian@phpunit.de" 913 | } 914 | ], 915 | "description": "Provides the functionality to compare PHP values for equality", 916 | "homepage": "https://github.com/sebastianbergmann/comparator", 917 | "keywords": [ 918 | "comparator", 919 | "compare", 920 | "equality" 921 | ], 922 | "time": "2018-02-01T13:46:46+00:00" 923 | }, 924 | { 925 | "name": "sebastian/diff", 926 | "version": "dev-master", 927 | "source": { 928 | "type": "git", 929 | "url": "https://github.com/sebastianbergmann/diff.git", 930 | "reference": "6906fbe33455221909eab31d4b8b1517b94aba46" 931 | }, 932 | "dist": { 933 | "type": "zip", 934 | "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/6906fbe33455221909eab31d4b8b1517b94aba46", 935 | "reference": "6906fbe33455221909eab31d4b8b1517b94aba46", 936 | "shasum": "" 937 | }, 938 | "require": { 939 | "php": "^7.1" 940 | }, 941 | "require-dev": { 942 | "phpunit/phpunit": "^7.0", 943 | "symfony/process": "^2 || ^3.3 || ^4" 944 | }, 945 | "type": "library", 946 | "extra": { 947 | "branch-alias": { 948 | "dev-master": "3.0-dev" 949 | } 950 | }, 951 | "autoload": { 952 | "classmap": [ 953 | "src/" 954 | ] 955 | }, 956 | "notification-url": "https://packagist.org/downloads/", 957 | "license": [ 958 | "BSD-3-Clause" 959 | ], 960 | "authors": [ 961 | { 962 | "name": "Kore Nordmann", 963 | "email": "mail@kore-nordmann.de" 964 | }, 965 | { 966 | "name": "Sebastian Bergmann", 967 | "email": "sebastian@phpunit.de" 968 | } 969 | ], 970 | "description": "Diff implementation", 971 | "homepage": "https://github.com/sebastianbergmann/diff", 972 | "keywords": [ 973 | "diff", 974 | "udiff", 975 | "unidiff", 976 | "unified diff" 977 | ], 978 | "time": "2018-10-30T05:42:15+00:00" 979 | }, 980 | { 981 | "name": "sebastian/environment", 982 | "version": "3.1.0", 983 | "source": { 984 | "type": "git", 985 | "url": "https://github.com/sebastianbergmann/environment.git", 986 | "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" 987 | }, 988 | "dist": { 989 | "type": "zip", 990 | "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", 991 | "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", 992 | "shasum": "" 993 | }, 994 | "require": { 995 | "php": "^7.0" 996 | }, 997 | "require-dev": { 998 | "phpunit/phpunit": "^6.1" 999 | }, 1000 | "type": "library", 1001 | "extra": { 1002 | "branch-alias": { 1003 | "dev-master": "3.1.x-dev" 1004 | } 1005 | }, 1006 | "autoload": { 1007 | "classmap": [ 1008 | "src/" 1009 | ] 1010 | }, 1011 | "notification-url": "https://packagist.org/downloads/", 1012 | "license": [ 1013 | "BSD-3-Clause" 1014 | ], 1015 | "authors": [ 1016 | { 1017 | "name": "Sebastian Bergmann", 1018 | "email": "sebastian@phpunit.de" 1019 | } 1020 | ], 1021 | "description": "Provides functionality to handle HHVM/PHP environments", 1022 | "homepage": "http://www.github.com/sebastianbergmann/environment", 1023 | "keywords": [ 1024 | "Xdebug", 1025 | "environment", 1026 | "hhvm" 1027 | ], 1028 | "time": "2017-07-01T08:51:00+00:00" 1029 | }, 1030 | { 1031 | "name": "sebastian/exporter", 1032 | "version": "dev-master", 1033 | "source": { 1034 | "type": "git", 1035 | "url": "https://github.com/sebastianbergmann/exporter.git", 1036 | "reference": "c8c4f196e32858e4448bc285e542b61a4c40d9dc" 1037 | }, 1038 | "dist": { 1039 | "type": "zip", 1040 | "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c8c4f196e32858e4448bc285e542b61a4c40d9dc", 1041 | "reference": "c8c4f196e32858e4448bc285e542b61a4c40d9dc", 1042 | "shasum": "" 1043 | }, 1044 | "require": { 1045 | "php": "^7.0", 1046 | "sebastian/recursion-context": "^3.0" 1047 | }, 1048 | "require-dev": { 1049 | "ext-mbstring": "*", 1050 | "phpunit/phpunit": "^6.0" 1051 | }, 1052 | "type": "library", 1053 | "extra": { 1054 | "branch-alias": { 1055 | "dev-master": "3.1.x-dev" 1056 | } 1057 | }, 1058 | "autoload": { 1059 | "classmap": [ 1060 | "src/" 1061 | ] 1062 | }, 1063 | "notification-url": "https://packagist.org/downloads/", 1064 | "license": [ 1065 | "BSD-3-Clause" 1066 | ], 1067 | "authors": [ 1068 | { 1069 | "name": "Jeff Welch", 1070 | "email": "whatthejeff@gmail.com" 1071 | }, 1072 | { 1073 | "name": "Volker Dusch", 1074 | "email": "github@wallbash.com" 1075 | }, 1076 | { 1077 | "name": "Bernhard Schussek", 1078 | "email": "bschussek@2bepublished.at" 1079 | }, 1080 | { 1081 | "name": "Sebastian Bergmann", 1082 | "email": "sebastian@phpunit.de" 1083 | }, 1084 | { 1085 | "name": "Adam Harvey", 1086 | "email": "aharvey@php.net" 1087 | } 1088 | ], 1089 | "description": "Provides the functionality to export PHP variables for visualization", 1090 | "homepage": "http://www.github.com/sebastianbergmann/exporter", 1091 | "keywords": [ 1092 | "export", 1093 | "exporter" 1094 | ], 1095 | "time": "2018-06-28T14:22:04+00:00" 1096 | }, 1097 | { 1098 | "name": "sebastian/global-state", 1099 | "version": "dev-master", 1100 | "source": { 1101 | "type": "git", 1102 | "url": "https://github.com/sebastianbergmann/global-state.git", 1103 | "reference": "30367ea06c5cc3bf684457ac793fb2b863d783c6" 1104 | }, 1105 | "dist": { 1106 | "type": "zip", 1107 | "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/30367ea06c5cc3bf684457ac793fb2b863d783c6", 1108 | "reference": "30367ea06c5cc3bf684457ac793fb2b863d783c6", 1109 | "shasum": "" 1110 | }, 1111 | "require": { 1112 | "php": "^7.0" 1113 | }, 1114 | "require-dev": { 1115 | "phpunit/phpunit": "^6.0" 1116 | }, 1117 | "suggest": { 1118 | "ext-uopz": "*" 1119 | }, 1120 | "type": "library", 1121 | "extra": { 1122 | "branch-alias": { 1123 | "dev-master": "2.0-dev" 1124 | } 1125 | }, 1126 | "autoload": { 1127 | "classmap": [ 1128 | "src/" 1129 | ] 1130 | }, 1131 | "notification-url": "https://packagist.org/downloads/", 1132 | "license": [ 1133 | "BSD-3-Clause" 1134 | ], 1135 | "authors": [ 1136 | { 1137 | "name": "Sebastian Bergmann", 1138 | "email": "sebastian@phpunit.de" 1139 | } 1140 | ], 1141 | "description": "Snapshotting of global state", 1142 | "homepage": "http://www.github.com/sebastianbergmann/global-state", 1143 | "keywords": [ 1144 | "global state" 1145 | ], 1146 | "time": "2018-05-15T05:52:33+00:00" 1147 | }, 1148 | { 1149 | "name": "sebastian/object-enumerator", 1150 | "version": "dev-master", 1151 | "source": { 1152 | "type": "git", 1153 | "url": "https://github.com/sebastianbergmann/object-enumerator.git", 1154 | "reference": "e6be0a5481aff88f29262c331eab5b3ea939f55f" 1155 | }, 1156 | "dist": { 1157 | "type": "zip", 1158 | "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e6be0a5481aff88f29262c331eab5b3ea939f55f", 1159 | "reference": "e6be0a5481aff88f29262c331eab5b3ea939f55f", 1160 | "shasum": "" 1161 | }, 1162 | "require": { 1163 | "php": "^7.0", 1164 | "sebastian/object-reflector": "^1.1.1", 1165 | "sebastian/recursion-context": "^3.0" 1166 | }, 1167 | "require-dev": { 1168 | "phpunit/phpunit": "^6.0" 1169 | }, 1170 | "type": "library", 1171 | "extra": { 1172 | "branch-alias": { 1173 | "dev-master": "3.0.x-dev" 1174 | } 1175 | }, 1176 | "autoload": { 1177 | "classmap": [ 1178 | "src/" 1179 | ] 1180 | }, 1181 | "notification-url": "https://packagist.org/downloads/", 1182 | "license": [ 1183 | "BSD-3-Clause" 1184 | ], 1185 | "authors": [ 1186 | { 1187 | "name": "Sebastian Bergmann", 1188 | "email": "sebastian@phpunit.de" 1189 | } 1190 | ], 1191 | "description": "Traverses array structures and object graphs to enumerate all referenced objects", 1192 | "homepage": "https://github.com/sebastianbergmann/object-enumerator/", 1193 | "time": "2018-10-30T05:41:47+00:00" 1194 | }, 1195 | { 1196 | "name": "sebastian/object-reflector", 1197 | "version": "dev-master", 1198 | "source": { 1199 | "type": "git", 1200 | "url": "https://github.com/sebastianbergmann/object-reflector.git", 1201 | "reference": "7707193304715e3caddf28fc73c02c12ed6f350c" 1202 | }, 1203 | "dist": { 1204 | "type": "zip", 1205 | "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/7707193304715e3caddf28fc73c02c12ed6f350c", 1206 | "reference": "7707193304715e3caddf28fc73c02c12ed6f350c", 1207 | "shasum": "" 1208 | }, 1209 | "require": { 1210 | "php": "^7.0" 1211 | }, 1212 | "require-dev": { 1213 | "phpunit/phpunit": "^6.0" 1214 | }, 1215 | "type": "library", 1216 | "extra": { 1217 | "branch-alias": { 1218 | "dev-master": "1.1-dev" 1219 | } 1220 | }, 1221 | "autoload": { 1222 | "classmap": [ 1223 | "src/" 1224 | ] 1225 | }, 1226 | "notification-url": "https://packagist.org/downloads/", 1227 | "license": [ 1228 | "BSD-3-Clause" 1229 | ], 1230 | "authors": [ 1231 | { 1232 | "name": "Sebastian Bergmann", 1233 | "email": "sebastian@phpunit.de" 1234 | } 1235 | ], 1236 | "description": "Allows reflection of object attributes, including inherited and non-public ones", 1237 | "homepage": "https://github.com/sebastianbergmann/object-reflector/", 1238 | "time": "2018-05-15T05:50:44+00:00" 1239 | }, 1240 | { 1241 | "name": "sebastian/recursion-context", 1242 | "version": "dev-master", 1243 | "source": { 1244 | "type": "git", 1245 | "url": "https://github.com/sebastianbergmann/recursion-context.git", 1246 | "reference": "dbe1869c13935c6080c834fc61424834b9ad5907" 1247 | }, 1248 | "dist": { 1249 | "type": "zip", 1250 | "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/dbe1869c13935c6080c834fc61424834b9ad5907", 1251 | "reference": "dbe1869c13935c6080c834fc61424834b9ad5907", 1252 | "shasum": "" 1253 | }, 1254 | "require": { 1255 | "php": "^7.0" 1256 | }, 1257 | "require-dev": { 1258 | "phpunit/phpunit": "^6.0" 1259 | }, 1260 | "type": "library", 1261 | "extra": { 1262 | "branch-alias": { 1263 | "dev-master": "3.0.x-dev" 1264 | } 1265 | }, 1266 | "autoload": { 1267 | "classmap": [ 1268 | "src/" 1269 | ] 1270 | }, 1271 | "notification-url": "https://packagist.org/downloads/", 1272 | "license": [ 1273 | "BSD-3-Clause" 1274 | ], 1275 | "authors": [ 1276 | { 1277 | "name": "Jeff Welch", 1278 | "email": "whatthejeff@gmail.com" 1279 | }, 1280 | { 1281 | "name": "Sebastian Bergmann", 1282 | "email": "sebastian@phpunit.de" 1283 | }, 1284 | { 1285 | "name": "Adam Harvey", 1286 | "email": "aharvey@php.net" 1287 | } 1288 | ], 1289 | "description": "Provides functionality to recursively process PHP variables", 1290 | "homepage": "http://www.github.com/sebastianbergmann/recursion-context", 1291 | "time": "2018-05-15T05:52:05+00:00" 1292 | }, 1293 | { 1294 | "name": "sebastian/resource-operations", 1295 | "version": "1.0.0", 1296 | "source": { 1297 | "type": "git", 1298 | "url": "https://github.com/sebastianbergmann/resource-operations.git", 1299 | "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" 1300 | }, 1301 | "dist": { 1302 | "type": "zip", 1303 | "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", 1304 | "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", 1305 | "shasum": "" 1306 | }, 1307 | "require": { 1308 | "php": ">=5.6.0" 1309 | }, 1310 | "type": "library", 1311 | "extra": { 1312 | "branch-alias": { 1313 | "dev-master": "1.0.x-dev" 1314 | } 1315 | }, 1316 | "autoload": { 1317 | "classmap": [ 1318 | "src/" 1319 | ] 1320 | }, 1321 | "notification-url": "https://packagist.org/downloads/", 1322 | "license": [ 1323 | "BSD-3-Clause" 1324 | ], 1325 | "authors": [ 1326 | { 1327 | "name": "Sebastian Bergmann", 1328 | "email": "sebastian@phpunit.de" 1329 | } 1330 | ], 1331 | "description": "Provides a list of PHP built-in functions that operate on resources", 1332 | "homepage": "https://www.github.com/sebastianbergmann/resource-operations", 1333 | "time": "2015-07-28T20:34:47+00:00" 1334 | }, 1335 | { 1336 | "name": "sebastian/version", 1337 | "version": "2.0.1", 1338 | "source": { 1339 | "type": "git", 1340 | "url": "https://github.com/sebastianbergmann/version.git", 1341 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" 1342 | }, 1343 | "dist": { 1344 | "type": "zip", 1345 | "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", 1346 | "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", 1347 | "shasum": "" 1348 | }, 1349 | "require": { 1350 | "php": ">=5.6" 1351 | }, 1352 | "type": "library", 1353 | "extra": { 1354 | "branch-alias": { 1355 | "dev-master": "2.0.x-dev" 1356 | } 1357 | }, 1358 | "autoload": { 1359 | "classmap": [ 1360 | "src/" 1361 | ] 1362 | }, 1363 | "notification-url": "https://packagist.org/downloads/", 1364 | "license": [ 1365 | "BSD-3-Clause" 1366 | ], 1367 | "authors": [ 1368 | { 1369 | "name": "Sebastian Bergmann", 1370 | "email": "sebastian@phpunit.de", 1371 | "role": "lead" 1372 | } 1373 | ], 1374 | "description": "Library that helps with managing the version number of Git-hosted PHP projects", 1375 | "homepage": "https://github.com/sebastianbergmann/version", 1376 | "time": "2016-10-03T07:35:21+00:00" 1377 | }, 1378 | { 1379 | "name": "theseer/tokenizer", 1380 | "version": "1.1.0", 1381 | "source": { 1382 | "type": "git", 1383 | "url": "https://github.com/theseer/tokenizer.git", 1384 | "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" 1385 | }, 1386 | "dist": { 1387 | "type": "zip", 1388 | "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", 1389 | "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", 1390 | "shasum": "" 1391 | }, 1392 | "require": { 1393 | "ext-dom": "*", 1394 | "ext-tokenizer": "*", 1395 | "ext-xmlwriter": "*", 1396 | "php": "^7.0" 1397 | }, 1398 | "type": "library", 1399 | "autoload": { 1400 | "classmap": [ 1401 | "src/" 1402 | ] 1403 | }, 1404 | "notification-url": "https://packagist.org/downloads/", 1405 | "license": [ 1406 | "BSD-3-Clause" 1407 | ], 1408 | "authors": [ 1409 | { 1410 | "name": "Arne Blankerts", 1411 | "email": "arne@blankerts.de", 1412 | "role": "Developer" 1413 | } 1414 | ], 1415 | "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", 1416 | "time": "2017-04-07T12:08:54+00:00" 1417 | }, 1418 | { 1419 | "name": "webmozart/assert", 1420 | "version": "dev-master", 1421 | "source": { 1422 | "type": "git", 1423 | "url": "https://github.com/webmozart/assert.git", 1424 | "reference": "53927dddf3afa2088b355188e143bba42159bf5d" 1425 | }, 1426 | "dist": { 1427 | "type": "zip", 1428 | "url": "https://api.github.com/repos/webmozart/assert/zipball/53927dddf3afa2088b355188e143bba42159bf5d", 1429 | "reference": "53927dddf3afa2088b355188e143bba42159bf5d", 1430 | "shasum": "" 1431 | }, 1432 | "require": { 1433 | "php": "^5.3.3 || ^7.0" 1434 | }, 1435 | "require-dev": { 1436 | "phpunit/phpunit": "^4.6", 1437 | "sebastian/version": "^1.0.1" 1438 | }, 1439 | "type": "library", 1440 | "extra": { 1441 | "branch-alias": { 1442 | "dev-master": "1.3-dev" 1443 | } 1444 | }, 1445 | "autoload": { 1446 | "psr-4": { 1447 | "Webmozart\\Assert\\": "src/" 1448 | } 1449 | }, 1450 | "notification-url": "https://packagist.org/downloads/", 1451 | "license": [ 1452 | "MIT" 1453 | ], 1454 | "authors": [ 1455 | { 1456 | "name": "Bernhard Schussek", 1457 | "email": "bschussek@gmail.com" 1458 | } 1459 | ], 1460 | "description": "Assertions to validate method input/output with nice error messages.", 1461 | "keywords": [ 1462 | "assert", 1463 | "check", 1464 | "validate" 1465 | ], 1466 | "time": "2018-05-29T14:25:02+00:00" 1467 | } 1468 | ], 1469 | "aliases": [], 1470 | "minimum-stability": "dev", 1471 | "stability-flags": [], 1472 | "prefer-stable": false, 1473 | "prefer-lowest": false, 1474 | "platform": [], 1475 | "platform-dev": [] 1476 | } 1477 | --------------------------------------------------------------------------------