Example #1
0
 public function testImplementsCount()
 {
     $data = new Collection();
     $this->assertEquals(0, $data->count());
     $data->add('key', 'value');
     $this->assertEquals(1, count($data));
     $data->add('key', 'value2');
     $this->assertEquals(1, count($data));
     $data->add('key_2', 'value3');
     $this->assertEquals(2, count($data));
 }
Example #2
0
 /**
  * @deprecated Use $message->getHeader()->parseParams()
  * @codeCoverageIgnore
  */
 public function getTokenizedHeader($header, $token = ';')
 {
     Version::warn(__METHOD__ . ' is deprecated. Use $message->getHeader()->parseParams()');
     if ($this->hasHeader($header)) {
         $data = new Collection();
         foreach ($this->getHeader($header)->parseParams() as $values) {
             foreach ($values as $key => $value) {
                 if ($value === '') {
                     $data->set($data->count(), $key);
                 } else {
                     $data->add($key, $value);
                 }
             }
         }
         return $data;
     }
 }