Passed
Push — master ( fe9c2a...0022e8 )
by John
06:26
created
app/Jobs/GeneratePDF.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 {
21 21
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels, Trackable;
22 22
 
23
-    public $tries = 1;
23
+    public $tries=1;
24 24
     protected $cid;
25 25
     protected $config;
26 26
 
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
     public function __construct($cid, $config)
34 34
     {
35 35
         $this->prepareStatus();
36
-        $this->cid = $cid;
37
-        $default = [
36
+        $this->cid=$cid;
37
+        $default=[
38 38
             'cover' => false,
39 39
             'advice' => false,
40 40
         ];
41
-        $this->config = array_merge($default, $config);
41
+        $this->config=array_merge($default, $config);
42 42
     }
43 43
 
44 44
     /**
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function handle()
50 50
     {
51
-        $cid = $this->cid;
52
-        $config = $this->config;
53
-        $accessToken = Str::random(32);
51
+        $cid=$this->cid;
52
+        $config=$this->config;
53
+        $accessToken=Str::random(32);
54 54
 
55 55
         Cache::tags(['contest', 'pdfViewAccess', $cid])->put($accessToken, $config);
56 56
 
@@ -58,23 +58,23 @@  discard block
 block discarded – undo
58 58
             mkdir(storage_path("app/contest/pdf/"), 0777, true);
59 59
         }
60 60
 
61
-        $record = Contest::find($cid);
61
+        $record=Contest::find($cid);
62 62
 
63
-        $puppeteer = new Puppeteer;
64
-        $browser = $puppeteer->launch([
63
+        $puppeteer=new Puppeteer;
64
+        $browser=$puppeteer->launch([
65 65
             'args' => ['--no-sandbox', '--disable-setuid-sandbox'],
66 66
         ]);
67 67
 
68
-        $page = $browser->newPage();
68
+        $page=$browser->newPage();
69 69
 
70
-        $response = $page->goto(route('contest.board.admin.pdf.view', [
70
+        $response=$page->goto(route('contest.board.admin.pdf.view', [
71 71
             'cid' => $cid,
72 72
             'accessToken' => $accessToken,
73 73
         ]), [
74 74
             'waitUntil' => 'networkidle0'
75 75
         ]);
76 76
 
77
-        if($response->status() != '200') {
77
+        if ($response->status()!='200') {
78 78
             throw new Exception('Cannot Access PDF Generated View Stream');
79 79
         }
80 80
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             'timeout' => 120000
83 83
         ]);
84 84
 
85
-        if($config['renderer'] == 'blink') {
85
+        if ($config['renderer']=='blink') {
86 86
             $page->pdf([
87 87
                 'format' => 'A4',
88 88
                 'path' => storage_path("app/contest/pdf/$cid.pdf"),
@@ -91,12 +91,12 @@  discard block
 block discarded – undo
91 91
 
92 92
             $browser->close();
93 93
 
94
-            $record->pdf = 1;
94
+            $record->pdf=1;
95 95
             $record->save();
96 96
             return;
97 97
         }
98 98
 
99
-        $parsedHTML = $page->content();
99
+        $parsedHTML=$page->content();
100 100
 
101 101
         $browser->close();
102 102
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
             'BaseURL' => route('contest.detail', ['cid' => $cid]),
118 118
         ])->save(storage_path("app/contest/pdf/$cid.pdf"));
119 119
 
120
-        $record->pdf = 1;
120
+        $record->pdf=1;
121 121
         $record->save();
122 122
     }
123 123
 
Please login to merge, or discard this patch.