<commit_before><?php

namespace AppBundle\Service;

use AppBundle\Entity\Ndr\Ndr;

class NdrStatusService
{
    const STATE_NOT_STARTED = 'not-started';
    const STATE_INCOMPLETE = 'incomplete';
    const STATE_DONE = 'done';

    /** @var Ndr */
    private $ndr;

    public function __construct(Ndr $ndr)
    {
        $this->ndr = $ndr;
    }

    /** @return string */
    public function getVisitsCareState()
    {
        $visitsCare = $this->ndr->getVisitsCare();
        $answers = [
            $visitsCare->getDoYouLiveWithClient(),
            $visitsCare->getDoesClientHaveACarePlan(),
            $visitsCare->getWhoIsDoingTheCaring(),
            $visitsCare->getDoesClientHaveACarePlan()
        ];

        switch (count(array_filter($answers))) {
            case 0:
                return ['state' => self::STATE_NOT_STARTED, 'nOfRecords' => 0];
            case 4:
                return ['state' => self::STATE_DONE, 'nOfRecords' => 0];
            default:
                return ['state' => self::STATE_INCOMPLETE, 'nOfRecords' => 0];
        }
    }

    /**
     * @return string
     */
    public function getExpensesState()
    {
        $nOfExpenses = count($this->ndr->getExpenses());
        if ($nOfExpenses > 0 || $this->ndr->getPaidForAnything() === 'no') {
            return ['state' => self::STATE_DONE, 'nOfRecords' => $nOfExpenses];
        }

        return ['state' => self::STATE_NOT_STARTED, 'nOfRecords' => 0];
    }

    /**
     * @return string
     */
    public function getIncomeBenefitsState()
    {
        $stCount = count($this->ndr->getStateBenefitsPresent());
        $statePens = $this->ndr->getReceiveStatePension();
        $otherInc = $this->ndr->getReceiveOtherIncome();
        $compensDamag = $this->ndr->getExpectCompensationDamages();
        $ooCount = count($this->ndr->getOneOffPresent());

        if ($stCount === 0<commit_msg>DDPB-2165 Added last question to status check<commit_after><?php

namespace AppBundle\Service;

use AppBundle\Entity\Ndr\Ndr;
use AppBundle\Entity\Ndr\VisitsCare;

class NdrStatusService
{
    const STATE_NOT_STARTED = 'not-started';
    const STATE_INCOMPLETE = 'incomplete';
    const STATE_DONE = 'done';

    /** @var Ndr */
    private $ndr;

    public function __construct(Ndr $ndr)
    {
        $this->ndr = $ndr;
    }

    /** @return string */
    public function getVisitsCareState()
    {
        /** @var VisitsCare $visitsCare */
        $visitsCare = $this->ndr->getVisitsCare();
        $answers = [
            $visitsCare->getDoYouLiveWithClient(),
            $visitsCare->getDoesClientHaveACarePlan(),
            $visitsCare->getWhoIsDoingTheCaring(),
            $visitsCare->getDoesClientHaveACarePlan(),
            $visitsCare->getPlanMoveNewResidence()
        ];

        switch (count(array_filter($answers))) {
            case 0:
                return ['state' => self::STATE_NOT_STARTED, 'nOfRecords' => 0];
            case 5:
                return ['state' => self::STATE_DONE, 'nOfRecords' => 0];
            default:
                return ['state' => self::STATE_INCOMPLETE, 'nOfRecords' => 0];
        }
    }

    /**
     * @return string
     */
    public function getExpensesState()
    {
        $nOfExpenses = count($this->ndr->getExpenses());
        if ($nOfExpenses > 0 || $this->ndr->getPaidForAnything() === 'no') {
            return ['state' => self::STATE_DONE, 'nOfRecords' => $nOfExpenses];
        }

        return ['state' => self::STATE_NOT_STARTED, 'nOfRecords' => 0];
    }

    /**
     * @return string
     */
    public function getIncomeBenefitsState()
    {
        $stCount = count($this->ndr->getStateBenefitsPresent());
        $statePens = $this->ndr->getReceiveStatePension();
        $otherInc = $this->ndr->getReceiveOtherIncome();
        $compensDamag = $this->ndr->getExpectCompensationDamages();
        $ooCount = count($this->ndr->getOneOffPresent());

        if ($stCount === 0
{'fraction_non_alphanumeric': 0.1494949494949495, 'fraction_numerical': 0.005050505050505051, 'mean_word_length': 2.3970840480274442, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 68, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '921888', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1246, 'n_words': 211}