Ejemplo n.º 1
0
 public function testNormalize()
 {
     $testNames = ['statuses/user_timeline', '///statuses/user_timeline', '//statuses///user_timeline', '/statuses/user_timeline///', 'statuses/user_timeline//'];
     $expected = 'statuses-user_timeline';
     foreach ($testNames as $name) {
         $this->assertEquals($expected, Parser::normalize($name));
     }
 }
Ejemplo n.º 2
0
 /**
  * Starting from twitter endpoint return the related collection
  * It replaces "/" with "-" after removing trailing "/", for example:
  *
  * endpoint "statuses/user_timeline" corresponds to "statuses-user_timeline" collection
  *
  * @param string $endpoint [description]
  * @return \MongoDB\Collection
  */
 public function getCollection($endpoint)
 {
     $name = Parser::normalize($endpoint);
     return $this->getDb()->selectCollection($name);
 }