Ejemplo n.º 1
0
 /**
  * Initialise a new request exception with a message.
  * @param \Crackle\Requests\GETRequest $request The request that failed.
  */
 public function __construct(GETRequest $request)
 {
     parent::__construct('Request to Pastebin failed: ' . $request->getError());
 }
Ejemplo n.º 2
0
 /**
  * Load the content of this paste.
  * @throws \Brush\Exceptions\RequestException If the request to Pastebin fails.
  */
 private final function loadContent()
 {
     $request = new GETRequest('http://pastebin.com/raw.php');
     $request->getParameters()->set('i', $this->getKey());
     try {
         $this->setContent($request->getResponse()->getBody());
     } catch (CrackleRequestException $e) {
         throw new RequestException($request);
     }
 }
Ejemplo n.º 3
0
Archivo: Paste.php Proyecto: gebn/brush
 /**
  * Retrieve the content of a public or unlisted paste.
  * @param \Brush\Pastes\Paste $paste The paste whose content to retrieve.
  * @return string The paste content.
  * @throws \Brush\Exceptions\RequestException If the request to Pastebin fails.
  */
 private static final function getPublicContent(Paste $paste)
 {
     assert($paste->getVisibility() === Visibility::VISIBILITY_PUBLIC || $paste->getVisibility() === Visibility::VISIBILITY_UNLISTED);
     $request = new GETRequest('http://pastebin.com/raw/' . $paste->getKey());
     try {
         return $request->getResponse()->getBody();
     } catch (CrackleRequestException $e) {
         throw new RequestException($request);
     }
 }