setNamespace() 공개 메소드

public setNamespace ( $namespace )
$namespace
예제 #1
0
파일: Texy.php 프로젝트: renyinew/images-1
 public static function register(\Texy $texy, ImagePipe $imagePipe)
 {
     $texy->addHandler("image", function (\TexyHandlerInvocation $invocation, \TexyImage $image, $link) use($imagePipe) {
         $arguments = Helpers::prepareMacroArguments($image->URL);
         try {
             $image->URL = $imagePipe->setNamespace($arguments["namespace"])->request($arguments["name"], $arguments["size"], $arguments["flags"], TRUE);
         } catch (FileNotFoundException $e) {
             $image->URL = $arguments["name"];
             if (!empty($arguments["size"])) {
                 list($image->width, $image->height) = explode("x", $arguments["size"]);
             }
         }
         return $invocation->proceed($image, $link);
     });
 }
예제 #2
0
파일: Texy.php 프로젝트: fvozar/images
 /**
  * @param \Texy|\Texy\Texy $texy
  * @param ImagePipe $imagePipe
  */
 public static function register($texy, ImagePipe $imagePipe)
 {
     if (!$texy instanceof \Texy && !$texy instanceof \Texy\Texy) {
         throw new \InvalidArgumentException('The $texy parameter is not instance of Texy or Texy\\Texy');
     }
     $texy->addHandler("image", function ($invocation, $image, $link) use($imagePipe) {
         if (!$invocation instanceof \TexyHandlerInvocation && !$invocation instanceof \Texy\HandlerInvocation) {
             throw new \InvalidArgumentException('The $invocation parameter is not instance of TexyHandlerInvocation or Texy\\HandlerInvocation');
         }
         if (!$image instanceof \TexyImage && !$image instanceof \Texy\Image) {
             throw new \InvalidArgumentException('The $image parameter is not instance of TexyImage or Texy\\Image');
         }
         $arguments = Helpers::prepareMacroArguments($image->URL);
         try {
             $image->URL = $imagePipe->setNamespace($arguments["namespace"])->request($arguments["name"], $arguments["size"], $arguments["flags"], TRUE);
         } catch (FileNotFoundException $e) {
             $image->URL = $arguments["name"];
             if (!empty($arguments["size"])) {
                 list($image->width, $image->height) = explode("x", $arguments["size"]);
             }
         }
         return $invocation->proceed($image, $link);
     });
 }