Please change both lines to simply:

```php
$countResult = current($countResult) ?: 0;