original_string: public function getCookies($format = self::COOKIES_FLAT)
      {
          if (!\in_array($format, [self::COOKIES_FLAT, self::COOKIES_ARRAY])) {
              throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', [self::COOKIES_FLAT, self::COOKIES_ARRAY])));
          }
  
          if (self::COOKIES_ARRAY === $format) {
              return $this->cookies;
          }
  
          $flattenedCookies = [];
          foreach ($this->cookies as $path) {
              foreach ($path as $cookies) {
                  foreach ($cookies as $cookie) {
                      $flattenedCookies[] = $cookie;
                  }
              }
          }
  
          return $flattenedCookies;
      }
code: public function getCookies($format = self::COOKIES_FLAT)
      {
          if (!\in_array($format, [self::COOKIES_FLAT, self::COOKIES_ARRAY])) {
              throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', [self::COOKIES_FLAT, self::COOKIES_ARRAY])));
          }
  
          if (self::COOKIES_ARRAY === $format) {
              return $this->cookies;
          }
  
          $flattenedCookies = [];
          foreach ($this->cookies as $path) {
              foreach ($path as $cookies) {
                  foreach ($cookies as $cookie) {
                      $flattenedCookies[] = $cookie;
                  }
              }
          }
  
          return $flattenedCookies;
      }
code_tokens: public function getCookies ( $ format = self :: COOKIES_FLAT ) { if ( ! \ in_array ( $ format , [ self :: COOKIES_FLAT , self :: COOKIES_ARRAY ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Format "%s" invalid (%s).' , $ format , implode ( ', ' , [ self :: COOKIES_FLAT , self :: COOKIES_ARRAY ] ) ) ) ; } if ( self :: COOKIES_ARRAY === $ format ) { return $ this -> cookies ; } $ flattenedCookies = [ ] ; foreach ( $ this -> cookies as $ path ) { foreach ( $ path as $ cookies ) { foreach ( $ cookies as $ cookie ) { $ flattenedCookies [ ] = $ cookie ; } } } return $ flattenedCookies ; }
docstring: Returns an array with all cookies.
  
  @param string $format
  
  @return Cookie[]
  
  @throws \InvalidArgumentException When the $format is invalid
docstring_tokens: Returns an array with all cookies .