2024-07-20 21:47:21 -04:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* @author Daniel J. Summers <daniel@bitbadger.solutions>
|
|
|
|
|
* @license MIT
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2024-06-08 23:58:45 +00:00
|
|
|
|
|
|
|
|
namespace BitBadger\PDODocument\Mapper;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A mapper that returns the integer value of the first item in the results
|
2024-09-27 02:15:00 +00:00
|
|
|
*
|
|
|
|
|
* @implements Mapper<int>
|
2024-06-08 23:58:45 +00:00
|
|
|
*/
|
|
|
|
|
class CountMapper implements Mapper
|
|
|
|
|
{
|
2024-07-20 21:47:21 -04:00
|
|
|
/** @inheritDoc */
|
2024-06-08 23:58:45 +00:00
|
|
|
public function map(array $result): int
|
|
|
|
|
{
|
|
|
|
|
return (int) $result[0];
|
|
|
|
|
}
|
|
|
|
|
}
|