示例#1
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);
     }
 }
示例#2
0
文件: Paste.php 项目: 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);
     }
 }