Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.CrontabDocument.php
Go to the documentation of this file.
1 <?php
2 namespace Dcp;
3 
5 {
6  public function __toString()
7  {
8  $previousElement = null;
9  /* Coalesce empty text elements */
10  $elements = array_filter($this->childs, function ($currentElement) use (&$previousElement)
11  {
12  if ($previousElement !== null && is_a($previousElement, '\Dcp\CrontabTextElement') && is_a($currentElement, '\Dcp\CrontabTextElement')) {
13  if (strlen((string)$previousElement) <= 0 && strlen((string)$currentElement) <= 0) {
14  return false;
15  }
16  }
17  $previousElement = $currentElement;
18  return true;
19  });
20  return join("\n", $elements) . "\n";
21  }
22 }
← centre documentaire © anakeen