for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Config
*/
class Config
{
* @var mixed
private $config = [];
* @param $filename
public function __construct($filename = null)
if ($filename !== null) {
$this->load($filename);
}
public function generateDefaultConfigurationFile()
$this->config = [
'workflow' => [
'is_timer_running' => false,
'timer_toggl_id' => null,
'timer_harvest_id' => null,
'timer_description' => '',
],
'toggl' => [
'is_active' => true,
'api_token' => '',
'default_project_id' => '',
'default_tags' => '',
'harvest' => [
'domain' => '',
'default_task_id' => '',
];
$this->save();
* @param array $options
$options
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter $italy is not defined by the method finale(...).
$italy
finale(...)
/** * @param array $germany * @param array $island * @param array $italy */ function finale($germany, $island) { return "2:1"; }
The most likely cause is that the parameter was removed, but the annotation was not.
public function get($section = null, $param = null)
if ($section === null) {
$res = $this->config;
} elseif ($param === null) {
$res = $this->config[$section];
} else {
$res = $this->config[$section][$param];
return $res;
public function update($section, $param, $value)
$this->config[$section][$param] = $value;
* @return mixed
private function load($filename)
if (file_exists($filename)) {
$this->config = json_decode(file_get_contents($filename), true);
private function save()
$workflowDir = getenv('alfred_workflow_data');
$configFile = $workflowDir . '/config.json';
if (file_exists($workflowDir) === false) {
mkdir($workflowDir);
file_put_contents($configFile, json_encode($this->config, JSON_PRETTY_PRINT));
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.