public function test_array_flatten() { $this->assert_equals(array(), ActiveRecord\array_flatten(array())); $this->assert_equals(array(1), ActiveRecord\array_flatten(array(1))); $this->assert_equals(array(1), ActiveRecord\array_flatten(array(array(1)))); $this->assert_equals(array(1, 2), ActiveRecord\array_flatten(array(array(1, 2)))); $this->assert_equals(array(1, 2), ActiveRecord\array_flatten(array(array(1), 2))); $this->assert_equals(array(1, 2), ActiveRecord\array_flatten(array(1, array(2)))); $this->assert_equals(array(1, 2, 3), ActiveRecord\array_flatten(array(1, array(2), 3))); $this->assert_equals(array(1, 2, 3, 4), ActiveRecord\array_flatten(array(1, array(2, 3), 4))); }
private function prepareMailForROLAlert($rolproducts){ $products = \ActiveRecord\array_flatten($rolproducts); if (is_array($products)){ $products = implode("<br><br>", $products); } $message = "Dear Sir, ". "<br><br>"; $message .= "The stocks of the following products are in Re-order Level." . "<br><br><br>"; $message .= "Products :<br><br>" . $products . "<br><br>"; $message .= "Thanks." . "<br><br>"; $message .= "Portal Admin.". "<br><br>"; $subject = $this->rol_alert_mail_sub; $return = $this->pushToMailQueue($subject , $message); }