You are here

private function Matrix::getBottomCells 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::getBottomCells()

Get all not empty cells at bottom of one element.

Parameters

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

Return value

array Array of cells

1 call to Matrix::getBottomCells()
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 400

Class

Matrix
The matrix to handle the Business Rule flowchart.

Namespace

Drupal\business_rules\Util\Flowchart

Code

private function getBottomCells(Element $element) {
  $cell = $this
    ->getCellByElementUuid($element
    ->getUuid());
  $index_x = $cell['index_x'];
  $index_y = $cell['index_y'];
  $elements[] = $cell;
  for ($y = $index_y; $y < 100; $y++) {
    if (!is_null($this->matrix[$index_x][$y + 1])) {
      $elements[] = $this->matrix[$index_x][$y + 1];
    }
    else {
      return $elements;
    }
  }
  return $elements;
}