/**
  * @covers StringUtils::arrayToString
  */
 public function testArrayToStringEndSeparator()
 {
     $data = array("Benjamin", "Sidiki", "Leyla", 23, 24, "Malek");
     $actual = \StringUtils::arrayToString($data, ':', true);
     $excepted = "Benjamin:Sidiki:Leyla:23:24:Malek:";
     $this->assertEquals($excepted, $actual);
 }
 public function __toString()
 {
     $html = "<div class='crumbs'>";
     $cumbsTxt = StringUtils::arrayToString($this->items, " &rarr; ");
     $html .= $cumbsTxt;
     $html .= "</div>";
     return $html;
 }
Exemple #3
0
 private function setOnClick()
 {
     // Avoid setting the 'onclick' attribute if it's not needed
     if (!$this->onclickNeeded) {
         return;
     }
     $params = array($this->href);
     if ($this->target) {
         $params[] = $this->target;
     }
     // Surround params with single quotes
     $params = array_map(function ($str) {
         return "'" . $str . "'";
     }, $params);
     $paramListString = implode(', ', $params);
     $jsFunctionName = $this->submit ? 'button_submit' : 'button_click';
     $onclick = "{$jsFunctionName}({$paramListString}); return false";
     $this->onclick[] = $onclick;
     $onclickStr = StringUtils::arrayToString($this->onclick, "; ", true);
     parent::set("onclick", $onclickStr);
 }
Exemple #4
0
 public function getOnUnloadValue()
 {
     $text = StringUtils::arrayToString($this->onunload, ";", true);
     return $text;
 }