Issues (42)

libraries/MessagePart.php (1 issue)

1
<?php
2
declare(strict_types=1);
3
4
defined('BASEPATH') OR exit('No direct script access allowed');
5
6
class MessagePart
7
{
8
  /**
9
   * [protected description]
10
   * @var [type]
11
   */
12
  protected $part;
13
  /**
14
   * [__construct description]
15
   * @date  2019-11-23
16
   * @param [type]     $part [description]
17
   */
18
  function __construct($part)
19
  {
20
    $this->part = $part;
21
  }
22
  /**
23
   * [__get description]
24
   * @date   2019-11-23
25
   * @param  string     $key [description]
26
   * @return [type]          [description]
27
   */
28
  public function __get(string $key):string
29
  {
30
    return $this->part->{$key};
31
  }
32
  /**
33
   * [header description]
34
   * @date   2019-11-22
35
   * @param  string      $key [description]
36
   * @return string|null      [description]
37
   */
38
  public function header(string $key):?string
39
  {
40
    foreach ($this->part->headers as $header) {
41
      if ($header->name == $key) {
42
        return $header->value;
43
      }
44
    }
45
    return null;
46
  }
47
  /**
48
   * [getSize description]
49
   * @date   2019-11-23
50
   * @return int        [description]
51
   */
52
  public function getSize():int
53
  {
54
    return $this->part->body->size;
55
  }
56
  /**
57
   * [body description]
58
   * @date   2019-11-23
59
   * @param  integer    $partId [description]
60
   * @return [type]             [description]
61
   */
62
  public function body(int $partId=0)
0 ignored issues
show
The parameter $partId is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

62
  public function body(/** @scrutinizer ignore-unused */ int $partId=0)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
63
  {
64
    return base64url_decode($this->part->body->data);
65
  }
66
}
67
?>
68