irishdan /
ResponsiveImageBundle
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace IrishDan\ResponsiveImageBundle\Tests\Entity; |
||
| 4 | |||
| 5 | use IrishDan\ResponsiveImageBundle\ResponsiveImageInterface; |
||
| 6 | use Symfony\Component\HttpFoundation\File\UploadedFile; |
||
| 7 | use Doctrine\ORM\Mapping as ORM; |
||
| 8 | use Symfony\Component\Validator\Constraints as Assert; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @ORM\Entity(repositoryClass="IrishDan\ResponsiveImageBundle\Repository\ImageRepository") |
||
| 12 | * @ORM\Table(name="image") |
||
| 13 | * @ORM\HasLifecycleCallbacks() |
||
| 14 | */ |
||
| 15 | class TestImage implements ResponsiveImageInterface |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @ORM\Column(name="id", type="integer") |
||
| 19 | * @ORM\Id |
||
| 20 | * @ORM\GeneratedValue(strategy="AUTO") |
||
| 21 | */ |
||
| 22 | private $id = 1; |
||
| 23 | /** |
||
| 24 | * @ORM\Column(name="title", type="string", length=255) |
||
| 25 | */ |
||
| 26 | private $title = 'Test image'; |
||
| 27 | /** |
||
| 28 | * @ORM\Column(name="path", type="string", length=255, unique=true) |
||
| 29 | */ |
||
| 30 | private $path = 'dummy.jpg'; |
||
| 31 | /** |
||
| 32 | * @ORM\Column(name="alt", type="string", length=255, nullable=true) |
||
| 33 | */ |
||
| 34 | private $alt = 'Test image alt text'; |
||
| 35 | /** |
||
| 36 | * @ORM\Column(name="width", type="integer", nullable=true) |
||
| 37 | */ |
||
| 38 | private $width = 1000; |
||
| 39 | /** |
||
| 40 | * @ORM\Column(name="height", type="integer", nullable=true) |
||
| 41 | */ |
||
| 42 | private $height = 1600; |
||
| 43 | /** |
||
| 44 | * @Assert\File(maxSize="6000000") |
||
| 45 | */ |
||
| 46 | private $file; |
||
| 47 | /** |
||
| 48 | * @ORM\Column(name="crop_coordinations", type="string", nullable=true) |
||
| 49 | */ |
||
| 50 | private $cropCoordinates = '200, 3, 800, 1400:310, 145, 750, 617'; |
||
| 51 | private $src; |
||
| 52 | |||
| 53 | public function getId() |
||
| 54 | { |
||
| 55 | return $this->id; |
||
| 56 | } |
||
| 57 | |||
| 58 | public function getPath() |
||
| 59 | { |
||
| 60 | return $this->path; |
||
| 61 | } |
||
| 62 | |||
| 63 | public function setPath($path) |
||
| 64 | { |
||
| 65 | $this->path = $path; |
||
| 66 | } |
||
| 67 | |||
| 68 | public function getTitle() |
||
| 69 | { |
||
| 70 | return $this->title; |
||
| 71 | } |
||
| 72 | |||
| 73 | public function setTitle($title) |
||
| 74 | { |
||
| 75 | $this->title = $title; |
||
| 76 | } |
||
| 77 | |||
| 78 | public function getStyleData() |
||
| 79 | { |
||
| 80 | return $this->style; |
||
|
0 ignored issues
–
show
|
|||
| 81 | } |
||
| 82 | |||
| 83 | public function setStyle($style) |
||
| 84 | { |
||
| 85 | $this->style = $style; |
||
| 86 | } |
||
| 87 | |||
| 88 | public function getAlt() |
||
| 89 | { |
||
| 90 | return $this->alt; |
||
| 91 | } |
||
| 92 | |||
| 93 | public function setAlt($alt) |
||
| 94 | { |
||
| 95 | $this->alt = $alt; |
||
| 96 | } |
||
| 97 | |||
| 98 | public function getPicture() |
||
| 99 | { |
||
| 100 | return $this->picture; |
||
|
0 ignored issues
–
show
The property
picture does not exist. Did you maybe forget to declare it?
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code: class MyClass { }
$x = new MyClass();
$x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: class MyClass {
public $foo;
}
$x = new MyClass();
$x->foo = true;
Loading history...
|
|||
| 101 | } |
||
| 102 | |||
| 103 | public function setPicture($picture) |
||
| 104 | { |
||
| 105 | $this->picture = $picture; |
||
| 106 | } |
||
| 107 | |||
| 108 | public function getWidth() |
||
| 109 | { |
||
| 110 | return $this->width; |
||
| 111 | } |
||
| 112 | |||
| 113 | public function setWidth($width) |
||
| 114 | { |
||
| 115 | $this->width = $width; |
||
| 116 | } |
||
| 117 | |||
| 118 | public function getHeight() |
||
| 119 | { |
||
| 120 | return $this->height; |
||
| 121 | } |
||
| 122 | |||
| 123 | public function setHeight($height) |
||
| 124 | { |
||
| 125 | $this->height = $height; |
||
| 126 | } |
||
| 127 | |||
| 128 | public function getCropCoordinates() |
||
| 129 | { |
||
| 130 | return $this->cropCoordinates; |
||
| 131 | } |
||
| 132 | |||
| 133 | public function setCropCoordinates($cords) |
||
| 134 | { |
||
| 135 | $this->cropCoordinates = $cords; |
||
| 136 | } |
||
| 137 | |||
| 138 | public function setFile(UploadedFile $file) |
||
| 139 | { |
||
| 140 | $this->file = $file; |
||
| 141 | } |
||
| 142 | |||
| 143 | public function getFile() |
||
| 144 | { |
||
| 145 | return $this->file; |
||
| 146 | } |
||
| 147 | |||
| 148 | public function setSrc($src) |
||
| 149 | { |
||
| 150 | $this->src = $src; |
||
| 151 | } |
||
| 152 | |||
| 153 | public function getSrc() |
||
| 154 | { |
||
| 155 | return $this->src; |
||
| 156 | } |
||
| 157 | } |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: