count
Intervention/image
Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Counts all elements in an array or in a Countable object
Alias
sizeof
count
(
Countable
|array
$value
,
int $mode
=
COUNT_NORMAL
):
int
public function
countLines
()
{
return
count
(
explode
(
PHP_EOL
,
$this
->
text
));
}
}
src/Intervention/Image/AbstractFont.php
$points
=
$this
->
argument
(
0
)->
type
(
'array'
)->
required
()->
value
();
$callback
=
$this
->
argument
(
1
)->
type
(
'closure'
)->
value
();
$vertices_count
=
count
(
$points
);
if (
$vertices_count
%
2
!==
0
) {
src/Intervention/Image/Commands/PolygonCommand.php
{
$array
=
array_values
(
$array
);
if (
count
(
$array
) ==
4
) {
list(
$r
,
$g
,
$b
,
$a
) =
$array
;
src/Intervention/Image/Gd/Color.php
list(
$r
,
$g
,
$b
,
$a
) =
$array
;
$this
->
a
=
$this
->
alpha2gd
(
$a
);
} elseif (
count
(
$array
) ==
3
) {
list(
$r
,
$g
,
$b
) =
$array
;
src/Intervention/Image/Gd/Color.php
public function
applyToImage
(
Image $image
,
$x
=
0
,
$y
=
0
)
{
$background
= new
Color
(
$this
->
background
);
imagefilledpolygon
(
$image
->
getCore
(),
$this
->
points
,
intval
(
count
(
$this
->
points
) /
2
),
$background
->
getInt
());
if (
$this
->
hasBorder
()) {
$border_color
= new
Color
(
$this
->
border_color
);
src/Intervention/Image/Gd/Shapes/PolygonShape.php
if (
$this
->
hasBorder
()) {
$border_color
= new
Color
(
$this
->
border_color
);
imagesetthickness
(
$image
->
getCore
(),
$this
->
border_width
);
imagepolygon
(
$image
->
getCore
(),
$this
->
points
,
intval
(
count
(
$this
->
points
) /
2
),
$border_color
->
getInt
());
}
return
true
;
src/Intervention/Image/Gd/Shapes/PolygonShape.php
{
$array
=
array_values
(
$array
);
if (
count
(
$array
) ==
4
) {
list(
$r
,
$g
,
$b
,
$a
) =
$array
;
src/Intervention/Image/Imagick/Color.php
list(
$r
,
$g
,
$b
,
$a
) =
$array
;
} elseif (
count
(
$array
) ==
3
) {
list(
$r
,
$g
,
$b
) =
$array
;
src/Intervention/Image/Imagick/Color.php
$img
=
$this
->
manager
()->
make
(
'tests/images/exif.jpg'
);
$data
=
$img
->
exif
();
$this
->
assertInternalType
(
'array'
,
$data
);
$this
->
assertEquals
(
19
,
count
(
$data
));
}
public function
testExifReadKey
()
tests/GdSystemTest.php
$img
=
$this
->
manager
()->
make
(
'tests/images/exif.jpg'
);
$data
=
$img
->
exif
();
$this
->
assertInternalType
(
'array'
,
$data
);
$this
->
assertGreaterThanOrEqual
(
13
,
count
(
$data
));
}
public function
testExifReadKey
()
tests/ImagickSystemTest.php
$this
->
assertTrue
(
$result
);
$this
->
assertTrue
(
$command
->
hasOutput
());
$this
->
assertInternalType
(
'array'
,
$command
->
getOutput
());
$this
->
assertEquals
(
4
,
count
(
$command
->
getOutput
()));
}
public function
testGdWithFormat
()
tests/PickColorCommandTest.php
$this
->
assertTrue
(
$result
);
$this
->
assertTrue
(
$command
->
hasOutput
());
$this
->
assertInternalType
(
'array'
,
$command
->
getOutput
());
$this
->
assertEquals
(
4
,
count
(
$command
->
getOutput
()));
}
public function
testImagickWithFormat
()
tests/PickColorCommandTest.php