You are here

private function Matrix::getLeftCells in Business Rules 2.x

Same name and namespace in other branches
  1. 8 src/Util/Flowchart/Matrix.php \Drupal\business_rules\Util\Flowchart\Matrix::getLeftCells()

Get all not empty cells at left of one element.

Parameters

\Drupal\business_rules\Util\Flowchart\Element $element: The element.

Return value

array Array of cells

1 call to Matrix::getLeftCells()
Matrix::shift in src/Util/Flowchart/Matrix.php
Shift cells that contains one element to bottom, left or right.

File

src/Util/Flowchart/Matrix.php, line 454

Class

Matrix
The matrix to handle the Business Rule flowchart.

Namespace

Drupal\business_rules\Util\Flowchart

Code

private function getLeftCells(Element $element) {
  $cell = $this
    ->getCellByElementUuid($element
    ->getUuid());
  $index_x = $cell['index_x'];
  $index_y = $cell['index_y'];
  $elements = [];
  for ($x = $index_x; $x >= 0; $x--) {
    if (!is_null($this->matrix[$x - 1])) {
      $elements[] = $this->matrix[$x - 1][$index_y];
    }
    else {
      return $elements;
    }
  }
  return $elements;
}