diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..b7d41e8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +language: php +php: + - '5.3' + - '5.4' + - '5.5' + - '5.6' + - '7.0' + - '7.1' + - nightly + +before_script: + - curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar + - wget https://github.com/Icinga/icingaweb2/archive/v2.4.0.tar.gz + - tar xfz v2.4.0.tar.gz + - ln -s icingaweb2-2.4.0/library/Icinga + - ln -s icingaweb2-2.4.0/library/vendor/Zend + +script: + - php phpcs.phar --report=full --standard=PSR2 --extensions=php -w library/Businessprocess/ application/ configuration.php run.php test + - phpunit --testdox || phpunit --verbose diff --git a/application/controllers/ProcessController.php b/application/controllers/ProcessController.php index 421b298..dc2f2f7 100644 --- a/application/controllers/ProcessController.php +++ b/application/controllers/ProcessController.php @@ -143,7 +143,6 @@ class ProcessController extends Controller protected function prepareRenderer($bp, $node) { if ($this->renderer === null) { - if ($this->params->get('mode') === 'tree') { $renderer = new TreeRenderer($bp, $node); } else { diff --git a/application/forms/BpConfigForm.php b/application/forms/BpConfigForm.php index c485a57..386dcf1 100644 --- a/application/forms/BpConfigForm.php +++ b/application/forms/BpConfigForm.php @@ -177,7 +177,6 @@ class BpConfigForm extends QuickForm ) ); $this->setSuccessMessage(sprintf('Process %s has been created', $name)); - } else { $config = $this->config; $this->setSuccessMessage(sprintf('Process %s has been stored', $name)); diff --git a/application/forms/ProcessForm.php b/application/forms/ProcessForm.php index b3a5e7b..2a4fb8b 100644 --- a/application/forms/ProcessForm.php +++ b/application/forms/ProcessForm.php @@ -163,7 +163,6 @@ class ProcessForm extends QuickForm // TODO: rename if ($node = $this->node) { - if ($display !== $node->getDisplay()) { $modifications['display'] = $display; } @@ -184,8 +183,8 @@ class ProcessForm extends QuickForm 'alias' => $alias, ); } - if (! empty($modifications)) { + if (! empty($modifications)) { if ($this->node === null) { $changes->createNode($this->getValue('name'), $modifications); } else { diff --git a/library/Businessprocess/BpConfig.php b/library/Businessprocess/BpConfig.php index 767e820..9d9c343 100644 --- a/library/Businessprocess/BpConfig.php +++ b/library/Businessprocess/BpConfig.php @@ -629,7 +629,6 @@ class BpConfig $nodes = array(); foreach ($this->getBpNodes() as $name => $node) { - if ($node->hasParents()) { continue; } diff --git a/library/Businessprocess/Html/Attributes.php b/library/Businessprocess/Html/Attributes.php index 77099cc..1bfc91b 100644 --- a/library/Businessprocess/Html/Attributes.php +++ b/library/Businessprocess/Html/Attributes.php @@ -60,7 +60,6 @@ class Attributes } return $self; - } elseif ($attributes !== null) { throw new IcingaException( 'Attributes, Array or Null expected, got %s', diff --git a/library/Businessprocess/ImportedNode.php b/library/Businessprocess/ImportedNode.php index e21a169..79d956e 100644 --- a/library/Businessprocess/ImportedNode.php +++ b/library/Businessprocess/ImportedNode.php @@ -164,7 +164,6 @@ class ImportedNode extends Node 'child_names' => $bp->listRootNodes(), )); } catch (Exception $e) { - $this->createFailedNode($e); } } diff --git a/library/Businessprocess/Modification/NodeModifyAction.php b/library/Businessprocess/Modification/NodeModifyAction.php index 627f84b..8cb240e 100644 --- a/library/Businessprocess/Modification/NodeModifyAction.php +++ b/library/Businessprocess/Modification/NodeModifyAction.php @@ -26,7 +26,6 @@ class NodeModifyAction extends NodeAction public function setNodeProperties(Node $node, array $properties) { foreach (array_keys($properties) as $key) { - $this->properties[$key] = $properties[$key]; if (array_key_exists($key, $this->formerProperties)) { diff --git a/library/Businessprocess/Node.php b/library/Businessprocess/Node.php index f8a41f6..ba904af 100644 --- a/library/Businessprocess/Node.php +++ b/library/Businessprocess/Node.php @@ -332,7 +332,6 @@ abstract class Node // $path[] = $this->getName(); $paths[] = $path; } - } // TODO! -> for delete etc return $paths; diff --git a/library/Businessprocess/Renderer/TileRenderer/NodeTile.php b/library/Businessprocess/Renderer/TileRenderer/NodeTile.php index 95bc651..c982b39 100644 --- a/library/Businessprocess/Renderer/TileRenderer/NodeTile.php +++ b/library/Businessprocess/Renderer/TileRenderer/NodeTile.php @@ -227,7 +227,6 @@ class NodeTile extends BaseElement null, array('data-base-target' => '_next') )); - } elseif ($node instanceof HostNode) { $this->actions()->add(Link::create( Icon::create('host'), @@ -237,7 +236,6 @@ class NodeTile extends BaseElement )); } } - } protected function addActionLinks() diff --git a/library/Businessprocess/Simulation.php b/library/Businessprocess/Simulation.php index ede70d2..bdaf16f 100644 --- a/library/Businessprocess/Simulation.php +++ b/library/Businessprocess/Simulation.php @@ -97,13 +97,11 @@ class Simulation { $simulations = $this->simulations(); if (array_key_exists($node, $simulations)) { - unset($simulations[$node]); $this->setSimulations($simulations); return true; } else { - return false; } } diff --git a/library/Businessprocess/Storage/LegacyConfigRenderer.php b/library/Businessprocess/Storage/LegacyConfigRenderer.php index 6c3a7ba..c33265d 100644 --- a/library/Businessprocess/Storage/LegacyConfigRenderer.php +++ b/library/Businessprocess/Storage/LegacyConfigRenderer.php @@ -92,7 +92,6 @@ class LegacyConfigRenderer $name = $node->getName(); if (array_key_exists($name, $this->renderedNodes)) { - return ''; } else { $this->renderedNodes[$name] = true; @@ -183,10 +182,8 @@ class LegacyConfigRenderer $str = implode(' ' . $op . ' ', $children); if ((count($children) < 2) && $op !== '&') { - return $op . ' ' . $str; } else { - return $str; } } diff --git a/library/Businessprocess/Web/Component/Dashboard.php b/library/Businessprocess/Web/Component/Dashboard.php index 698daec..c33ec61 100644 --- a/library/Businessprocess/Web/Component/Dashboard.php +++ b/library/Businessprocess/Web/Component/Dashboard.php @@ -69,7 +69,6 @@ class Dashboard extends BaseElement array('class' => 'addnew') ) ); - } elseif (empty($processes)) { $this->addContent( Container::create() diff --git a/library/Businessprocess/Web/Form/QuickForm.php b/library/Businessprocess/Web/Form/QuickForm.php index c657745..43bc4ec 100644 --- a/library/Businessprocess/Web/Form/QuickForm.php +++ b/library/Businessprocess/Web/Form/QuickForm.php @@ -149,8 +149,8 @@ abstract class QuickForm extends QuickBaseForm 'Fieldset', ); } - return $this->addDisplayGroup($elements, $name, $options); + return $this->addDisplayGroup($elements, $name, $options); } protected function createIdElement()