/**
  * Creates and returns a new Exception instance.
  *
  * @param string $message The message itself
  * @param string $key The key for I18N
  * @return Faett_Channel_Exceptions_ResourceNotFoundException
  */
 public static function create($message, $key = '')
 {
     // create a new message
     $e = new Faett_Channel_Exceptions_ResourceNotFoundException($message);
     // set the message key
     $e->_setKey($key);
     // return the message
     return $e;
 }
 /**
  * This method maps the requested resource to the Serializer
  * necessary for rendering the resource's representation.
  *
  * @param string $url Resource URL to map
  * @return array The mapping data
  */
 public function resolve($url)
 {
     // array for the URL parameters
     $params = array();
     // array for the mapped return values
     $queryParams = array(Faett_Channel_Helper_Data::TYPE => $this->_getDefaultType());
     // iterate over the REGEX's and try to map the data
     foreach ($this->_regex() as $regex) {
         if (preg_match($regex, $url, $params) > 0) {
             if (array_key_exists(Faett_Channel_Helper_Data::CONTENT_TYPE, $params)) {
                 $queryParams[Faett_Channel_Helper_Data::CONTENT_TYPE] = $this->_contentTypes[$params[Faett_Channel_Helper_Data::CONTENT_TYPE]];
             }
             if (array_key_exists(Faett_Channel_Helper_Data::ID, $params)) {
                 $queryParams[Faett_Channel_Helper_Data::ID] = $params[Faett_Channel_Helper_Data::ID];
             }
             if (array_key_exists(Faett_Channel_Helper_Data::VERSION, $params)) {
                 $queryParams[Faett_Channel_Helper_Data::VERSION] = $params[Faett_Channel_Helper_Data::VERSION];
             }
             if (array_key_exists(Faett_Channel_Helper_Data::TYPE, $params)) {
                 // initialize the type key
                 $typeKey = $params[Faett_Channel_Helper_Data::TYPE];
                 // check if a resource can be found (not for channel.xml)
                 if (array_key_exists(Faett_Channel_Helper_Data::RESOURCE, $params)) {
                     $typeKey = $params[Faett_Channel_Helper_Data::RESOURCE] . '/' . $typeKey;
                 }
                 // set the found type key
                 if ($this->_isType($typeKey)) {
                     $queryParams[Faett_Channel_Helper_Data::TYPE] = $typeKey;
                 }
             }
             // return the mapped values
             return $queryParams;
         }
     }
     // throw an exception, because resource can not be mapped
     throw Faett_Channel_Exceptions_ResourceNotFoundException::create('The requested URL ' . $url . ' was not found on this server', '300.error.no-url-resource-mapping');
 }