for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* HiAPI Yii2 base project for building API
*
* @link https://github.com/hiqdev/hiapi
* @package hiapi
* @license BSD-3-Clause
* @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
*/
namespace hiapi\components;
use hiqdev\yii\compat\yii;
abstract class AbstractTool extends \yii\base\Component
{
protected $base;
* @var array tool configuration
protected $data;
public function __construct($base, $data)
$this->base = $base;
$this->data = $data;
/// XXX WTF? $base->di becomes null after passing as argument
/// TODO fix!
if ($this->base->di === null) {
$this->base->di = yii::getContainer();
}
if ($this->base->dbc === null) {
$this->base->dbc = $this->base->di->get('dbc');
public function getBase()
return $this->base;
public function getDi()
return $this->base->di;
public function getDbc()
return $this->base->dbc;
public function getAccessId(): int
$id = $this->data['id'] ?? null;
return (int)$id;