JBZoo\Utils\Arr::clean PHP Method

clean() public static method

Clean array by custom rule
public static clean ( array $haystack ) : array
$haystack array
return array
    public static function clean($haystack)
    {
        return array_filter($haystack);
    }

Usage Example

Example #1
0
 /**
  * @return bool
  * @throws \Exception
  */
 public function send()
 {
     // Simple cleanup
     $this->_headers = Arr::clean($this->_headers);
     $this->_atachments = Arr::clean($this->_atachments);
     if ($this->_validateMode !== self::VALIDATE_NO_CHECK) {
         if (!$this->_subject) {
             $this->_error('Subject is empty');
         }
         if (!$this->_body) {
             $this->_error('Body is empty');
         }
         if (count($this->_recipient) !== 2) {
             $this->_error('Recipient is empty');
         }
     }
     $result = false;
     try {
         if ($result = $this->_send()) {
             $this->clean();
         }
     } catch (\Exception $e) {
         $this->_error($e->getMessage());
     }
     return $result;
 }
All Usage Examples Of JBZoo\Utils\Arr::clean