| Conditions | 3 |
| Paths | 3 |
| Total Lines | 22 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 35 | public function sharePB($sid, $uid) |
||
| 36 | { |
||
| 37 | $basic=DB::table($this->tableName)->where(['sid'=>$sid, 'uid'=>$uid])->first(); |
||
| 38 | $problem=DB::table("problem")->where(['pid'=>$basic["pid"]])->first(); |
||
| 39 | $compiler=DB::table("compiler")->where(['coid'=>$basic["coid"]])->first(); |
||
| 40 | if (empty($basic)) { |
||
| 41 | return []; |
||
| 42 | } |
||
| 43 | $pastebinModel=new PastebinModel(); |
||
| 44 | $ret=$pastebinModel->generate([ |
||
| 45 | "syntax"=>$compiler["lang"], |
||
| 46 | "expiration"=>0, |
||
| 47 | "content"=>$basic["solution"], |
||
| 48 | "title"=>$problem["pcode"]." - ".$basic["verdict"], |
||
| 49 | "uid"=>$uid |
||
| 50 | ]); |
||
| 51 | |||
| 52 | if (is_null($ret)) { |
||
| 53 | return []; |
||
| 54 | } else { |
||
| 55 | return [ |
||
| 56 | "code" => $ret |
||
| 57 | ]; |
||
| 61 |