public function __construct(Factory $factory, array $urlParameters = null) { $this->_factory = $factory; $url = ltrim($this->_url, '/'); // prepare uri if ($urlParameters) { $url = array($url, $urlParameters); } else { // check if placeholders exists if (strpos($url, '{')) { throw new Exception('Url parameters not specified'); } } // create request $this->_request = $factory->getConnection()->createRequest($this->_requestMethod, $url); // add behaviors $this->attachBehaviors($this->behaviors()); // do post-init tasks $this->init(); }