original_string: protected function filterOutArrayValues($values = null, \Closure $filter = null, $preserveKeys = false)
      {
          $data = [];
  
          if (is_array($values) && count($values))
          {
              foreach ($values as $key => $value)
              {
                  $value = trim($value);
  
                  if (!empty($value))
                  {
                      if (is_callable($filter) && $filter($value))
                      {
                          $data[$key] = $value;
                      }
                  }
              }
  
              if (!$preserveKeys)
              {
                  $data = array_values($data);
              }
          }
  
          return $data;
      }
code: protected function filterOutArrayValues($values = null, \Closure $filter = null, $preserveKeys = false)
      {
          $data = [];
  
          if (is_array($values) && count($values))
          {
              foreach ($values as $key => $value)
              {
                  $value = trim($value);
  
                  if (!empty($value))
                  {
                      if (is_callable($filter) && $filter($value))
                      {
                          $data[$key] = $value;
                      }
                  }
              }
  
              if (!$preserveKeys)
              {
                  $data = array_values($data);
              }
          }
  
          return $data;
      }
code_tokens: protected function filterOutArrayValues ( $ values = null , \ Closure $ filter = null , $ preserveKeys = false ) { $ data = [ ] ; if ( is_array ( $ values ) && count ( $ values ) ) { foreach ( $ values as $ key => $ value ) { $ value = trim ( $ value ) ; if ( ! empty ( $ value ) ) { if ( is_callable ( $ filter ) && $ filter ( $ value ) ) { $ data [ $ key ] = $ value ; } } } if ( ! $ preserveKeys ) { $ data = array_values ( $ data ) ; } } return $ data ; }
docstring: Filters out array values by using a custom filter
  
  @param array|string|null $values
  @param callable|\Closure $filter
  @param bool              $preserveKeys
  
  @return array
docstring_tokens: Filters out array values by using a custom filter