original_string: public function getUnits($type = null)
      {
          if (!isset($type)) {
              return $this->units;
          }
  
          $filtered = array();
          foreach ($this->units as $key => $value) {
              if (isset($value['type']) && $value['type'] === $type) {
                  $filtered[$key] = $value;
              }
          }
  
          return $filtered;
      }
code: public function getUnits($type = null)
      {
          if (!isset($type)) {
              return $this->units;
          }
  
          $filtered = array();
          foreach ($this->units as $key => $value) {
              if (isset($value['type']) && $value['type'] === $type) {
                  $filtered[$key] = $value;
              }
          }
  
          return $filtered;
      }
code_tokens: public function getUnits ( $ type = null ) { if ( ! isset ( $ type ) ) { return $ this -> units ; } $ filtered = array ( ) ; foreach ( $ this -> units as $ key => $ value ) { if ( isset ( $ value [ 'type' ] ) && $ value [ 'type' ] === $ type ) { $ filtered [ $ key ] = $ value ; } } return $ filtered ; }
docstring: Returns an array of units
  @param null|string $type Filter by this type
  @return array
docstring_tokens: Returns an array of units