]> Raphaƫl G. Git Repositories - packbundle/blobdiff - Util/ImageUtil.php
Php 8.x constructor style
[packbundle] / Util / ImageUtil.php
index d1b15cbd87c4f3a8bec10555d2a85a46244213aa..03b461623a65226fe1b98cf84a21182e1f3cee8d 100644 (file)
@@ -70,9 +70,9 @@ class ImageUtil {
        protected string $cache;
 
        /**
        protected string $cache;
 
        /**
-        * The public path
+        * The path
         */
         */
-       protected string $public;
+       protected string $path;
 
        /**
         * The RouterInterface instance
 
        /**
         * The RouterInterface instance
@@ -85,32 +85,60 @@ class ImageUtil {
        protected SluggerUtil $slugger;
 
        /**
        protected SluggerUtil $slugger;
 
        /**
-        * Creates a new map util
+        * The captcha background
+        */
+       public string $captchaBackground;
+
+       /**
+        * The captcha fill
+        */
+       public string $captchaFill;
+
+       /**
+        * The captcha font size
+        */
+       public int $captchaFontSize;
+
+       /**
+        * The captcha stroke
+        */
+       public string $captchaStroke;
+
+       /**
+        * The captcha stroke width
+        */
+       public int $captchaStrokeWidth;
+
+       /**
+        * Creates a new image util
         *
         * @param RouterInterface $router The RouterInterface instance
         * @param SluggerUtil $slugger The SluggerUtil instance
         *
         * @param RouterInterface $router The RouterInterface instance
         * @param SluggerUtil $slugger The SluggerUtil instance
+        * @param string $cache The cache directory
+        * @param string $path The public path
+        * @param string $prefix The prefix
         */
         */
-       function __construct(RouterInterface $router, SluggerUtil $slugger, string $cache = '../var/cache/image', string $public = './bundles/rapsyspack/image', $captchaBackground = self::captchaBackground, $captchaFill = self::captchaFill, $captchaFontSize = self::captchaFontSize, $captchaStroke = self::captchaStroke, $captchaStrokeWidth = self::captchaStrokeWidth) {
+       function __construct(RouterInterface $router, SluggerUtil $slugger, string $cache = '../var/cache', string $path = './bundles/rapsyspack', string $prefix = 'image', string $captchaBackground = self::captchaBackground, string $captchaFill = self::captchaFill, int $captchaFontSize = self::captchaFontSize, string $captchaStroke = self::captchaStroke, int $captchaStrokeWidth = self::captchaStrokeWidth) {
                //Set cache
                //Set cache
-               $this->cache = $cache;
+               $this->cache = $cache.'/'.$prefix;
 
 
-               //set captcha background
+               //Set captcha background
                $this->captchaBackground = $captchaBackground;
 
                $this->captchaBackground = $captchaBackground;
 
-               //set captcha fill
+               //Set captcha fill
                $this->captchaFill = $captchaFill;
 
                $this->captchaFill = $captchaFill;
 
-               //set captcha font size
+               //Set captcha font size
                $this->captchaFontSize = $captchaFontSize;
 
                $this->captchaFontSize = $captchaFontSize;
 
-               //set captcha stroke
+               //Set captcha stroke
                $this->captchaStroke = $captchaStroke;
 
                $this->captchaStroke = $captchaStroke;
 
-               //set captcha stroke width
+               //Set captcha stroke width
                $this->captchaStrokeWidth = $captchaStrokeWidth;
 
                $this->captchaStrokeWidth = $captchaStrokeWidth;
 
-               //Set public
-               $this->public = $public;
+               //Set path
+               $this->path = $path.'/'.$prefix;
 
                //Set router
                $this->router = $router;
 
                //Set router
                $this->router = $router;
@@ -202,7 +230,7 @@ class ImageUtil {
                $hash = array_reverse(str_split(strval($updated)));
 
                //Set dir
                $hash = array_reverse(str_split(strval($updated)));
 
                //Set dir
-               $dir = $this->public.'/'.$hash[0].'/'.$hash[1].'/'.$hash[2].'/'.$updated.'/'.$this->slugger->short($path);
+               $dir = $this->path.'/'.$hash[0].'/'.$hash[1].'/'.$hash[2].'/'.$updated.'/'.$this->slugger->short($path);
 
                //Set removes
                $removes = [];
 
                //Set removes
                $removes = [];