Generates LotDetail registry

@param Models\Title $title Contains data for the registry

@return string[]
775765
protected function generateLotDetail(Models\Title $title)
    {
        $result = [];

        $assignment = $title->assignment;
        $assignor_person = $assignment->assignor->person;
        $bank = $assignment->bank;
        $client = $title->client;
        $client_address = $client->address;
        $client_person = $client->person;
        $currency = $title->currency;
        $currency_code = $title->getCurrencyCode();
        $guarantor_person = $title->guarantor->person ?? null;
        $movement = $title->movement->code;

        $movement_mask = static::MOVEMENT_MASK[$movement] ?? null;

        /*
         * 'P' Segment
         */

        $format = '%03.3s%04.4s%01.1s%05.5s%-1.1s%-1.1s%02.2s%05.5s%-1.1s'
            . '%012.12s%-1.1s%-1.1s%020.20s%01.1s%01.1s%-1.1s%01.1s%-1.1s'
            . '%-15.15s%08.8s%015.15s%05.5s%-1.1s%02.2s%-1.1s%08.8s%01.1s'
            . '%08.8s%015.15s%01.1s%08.8s%015.15s%015.15s%015.15s%-25.25s'
            . '%01.1s%02.2s%01.1s%03.3s%02.2s%010.10s%-1.1s';

        $protest_code = $title->protest_code ?? 3;
        $protest_days = ($protest_code != 3 ? $title->protest_days ?? 0 : 0);

        $data = [
            $bank->code,
            $this->lot_count,
            '3',
            $this->current_lot,
            'P',
            '',
            $movement,
            '0', // $assignment->agency,
            '',
            '0', // $assignment->account,
            '',
            '',
            $title->our_number,
            $assignment->wallet->code,
            '1', // Title's Registration
            '1', // Document type
            '2', // Emission identifier
            '2', // Distribuition identifier
            $title->doc_number,
            static::date('dmY', $title->due),
            $currency->format($title->getActualValue(), 'nomask'),
            '0', // Charging agency
            '',  // Charging agency Check Digit
            $title->kind->code,
            $title->accept,
            static::date('dmY', $title->emission),
            $title->interest_type,
            static::date('dmY', $title->interest_date),
            $currency->format($title->interest_value, 'nomask'),
            $title->discount1_type,
            static::date('dmY', $title->discount1_date),
            $currency->format($title->discount1_value, 'nomask'),
            $currency->format($title->ioc_iof, 'nomask'),
            $currency->format($title->rebate, 'nomask'),
            $title->description,
            $protest_code,
            min($protest_days, 99),
            '1', // down/return code
            '0', // down/return due
            $currency_code->cnab240,
            '0', // Contract number
            '1', // Free use: it's defining partial payment isn't allowed
        ];

        $result[] = static::mask(
            vsprintf($format, static::normalize($data)),
            $movement_mask['P']
        );

        /*
         * 'Q' Segment
         */

        $format = '%03.3s%04.4s%01.1s%05.5s%-1.1s%-1.1s%02.2s%01.1s%015.15s'
            . '%-40.40s%-40.40s%-15.15s%08.8s%-15.15s%-2.2s%01.1s%015.15s'
            . '%-40.40s%03.3s%020.20s%-8.8s';

        $client_address_piece = implode(' ', [
            static::filter($client_address->place),
            $client_address->number,
            static::filter($client_address->detail)
        ]);

        $guarantor_document_type = ($guarantor_person !== null)
            ? $guarantor_person->getDocumentType()
            : '';

        $data = [
            $bank->code,
            $this->lot_count,
            '3',
            $this->current_lot,
            'Q',
            '',
            $movement,
            $client_person->getDocumentType(),
            $client_person->document,
            Utils::cleanSpaces($client_person->name),
            Utils::cleanSpaces($client_address_piece),
            static::filter($client_address->neighborhood),
            $client_address->zipcode,
            $client_address->county->name,
            $client_address->county->state->code,
            $guarantor_document_type,
            $guarantor_person->document ?? '',
            $guarantor_person->name ?? '',
            '0', // Corresponding bank
            '0', // "Our number" at corresponding bank
            '',
        ];

        $result[] = static::mask(
            vsprintf($format, static::normalize($data)),
            $movement_mask['Q']
        );

        /*
         * 'R' Segment
         */

        if ($title->discount2_type || $title->discount3_type
            || $title->fine_type
            || in_array($movement, ['07', '08', '14', '15', '16'])
        ) {
            $format = '%03.3s%04.4s%01.1s%05.5s%-1.1s%-1.1s%02.2s%01.1s%08.8s'
                . '%015.15s%01.1s%08.8s%015.15s%01.1s%08.8s%015.15s%-10.10s'
                . '%-40.40s%-40.40s%-20.20s%08.8s%03.3s%05.5s%-1.1s%012.12s'
                . '%-1.1s%-1.1s%01.1s%-9.9s';

            $data = [
                $bank->code,
                $this->lot_count,
                '3',
                $this->current_lot,
                'R',
                '',
                $movement,
                $title->discount2_type,
                static::date('dmY', $title->discount2_date),
                $currency->format($title->discount2_value, 'nomask'),
                $title->discount3_type,
                static::date('dmY', $title->discount3_date),
                $currency->format($title->discount3_value, 'nomask'),
                $title->fine_type,
                static::date('dmY', $title->fine_date),
                $currency->format($title->fine_value, 'nomask'),
                '', // information to client
                '', // message 3
                '', // message 4
                '',
                '0', // client occurence_code
                '0', // debit bank_code
                '0', // debit agency
                '0', // debit agency_cd
                '0', // debit account
                '',  // debit account_cd
                '',  // debit agency_account_cd
                '0', // debit emission_identification
                '',
            ];

            $result[] = static::mask(
                vsprintf($format, static::normalize($data)),
                $movement_mask['R']
            );
        }

        return array_filter($result, 'strlen');
    }
870738
public function set_title($title) {
        $xpath = new \DOMXpath($this);
        $general = $xpath->query(CC::lom_general_xpath)->item(0);
        $new_title = $this->add_child_ns(CC::LOMIMSCC_NS, $general, 'title');
        $new_string = $this->add_child_ns(CC::LOMIMSCC_NS, $new_title, 'string', $title, array("language" => "en-US"));
    }
386012
protected function detectAssignment(Registry $title)
    {
        return Models\Assignment::getInstance([
            'bank' => $this->bank->id,
            'agency' => $title->assignment_agency,
            'account' => $title->assignment_account,
            'cnab' => (string) $this->cnab,
        ]);
    }
505287
public function setTitle($title) {
		if (is_array($title) && empty($title)) {
			$this->title = new \stdClass;
		} else {
			$this->title = $title;
		}

		return $this;
	}
1252724
private function getUndeleteToken( Title $title ) {
		$response = $this->api->postRequest(
			new SimpleRequest(
				'query', [
				'list' => 'deletedrevs',
				'titles' => $title->getTitle(),
				'drprop' => 'token',
			]
			)
		);
		if ( array_key_exists( 'token', $response['query']['deletedrevs'][0] ) ) {
			return $response['query']['deletedrevs'][0]['token'];
		} else {
			throw new OutOfBoundsException(
				'Could not get page undelete token from list=deletedrevs query'
			);
		}
	}
1264477
private function getUndeleteParams( Title $title, $extraParams ) {
		$params = [];

		$params['title'] = $title->getTitle();
		$params['token'] = $this->getUndeleteToken( $title );

		return array_merge( $extraParams, $params );
	}
813765
protected function getUnifiedTitle($title)
    {
        $title = mb_strtolower($title, 'utf8');
        $title = preg_replace('/\W+/u', ' ', $title);

        return trim($title);
    }
1320766
protected function extractTitles()
    {
        $result = [];

        foreach ($this->registries[1] as $id => $title) {
            $data = [
                'assignment' => $this->detectAssignment($title)->id ?? null,
                'our_number' => (int) $title->our_number,
                'value' => (float) ($title->value / 100.0),
                'tax' => (float) ($title->tax / 100.0),
                'value_received' => (float) ($title->value_received / 100.0),
                'due' => static::parseDate($title->due),
                'occurrence' => $this->occurrence($title) ?? $title->occurrence,
                'occurrence_date' => static::parseDate($title->occurrence_date),
            ];
            $data['id'] = static::detectTitle($data);
            $result[] = $data;
        }

        return $result;
    }
962850
public static function panel($title, $description)
    {
        $argCount = func_num_args();
        $args = func_get_args();

        $sections = array();
        for ($i = 2; $i < $argCount; ++$i) {
            $sections[$args[$i]['id']] = $args[$i];
        }

        return array(
            'title'       => $title,
            'description' => $description,
            'sections'    => $sections
        );
    }
487787
private function gedcomHead(): array
    {
        $title   = '';
        $version = '';
        $source  = '';

        $head = GedcomRecord::getInstance('HEAD', $this->tree);

        if ($head instanceof GedcomRecord) {
            $sour = $head->facts(['SOUR'])->first();

            if ($sour instanceof Fact) {
                $source  = $sour->value();
                $title   = $sour->attribute('NAME');
                $version = $sour->attribute('VERS');
            }
        }

        return [
            $title,
            $version,
            $source,
        ];
    }
720983
protected function getTitleString($titles, $count)
    {
        $limit      = $this->getLimit();
        $okCount    = count($titles);
        $missing    = $count - $okCount;
        $andCount   = max([0, $okCount - $limit]) + $missing;

        if (!$okCount) {
            list($singular, $plural) = $this->getTypeLabelVariations($count);
            return $this->formatPlural($count, $singular, $plural);
        }
        if ($count < 2) {
            return reset($titles);
        }
        if ($okCount === 2 && !$andCount) {
            return $this->t("@name1 and @name2", array_combine(['@name1', '@name2'], $titles));
        }

        if ($limit < $okCount) {
            $titles = array_slice($titles, 0, $limit);
        }

        $ret = implode(", ", $titles);

        if ($andCount) {
            $ret .= ' ' . $this->formatPlural($andCount, "and @count more", "and @count more");
        }

        return $ret;
    }
880199
public function listGroupItem($title, $options = [])
    {
        $class = 'list-group-item';
        if (isset($options['active']) && $options['active']) {
            $class = "$class active";
        }
        $defaults = [
            'class' => $class,
        ];
        $text = $this->_generateListGroupText($title);
        $options = array_merge($defaults, $options);
        return $this->div('list-group-item', $text, $options);
    }
297125
protected function add(Models\Title $title)
    {
        $this->registry_count++;
        $this->registries[] = $this->generateTransaction($title);
    }
3417
public function title($title = null)
    {
        if ($title === null) {
            return $this->_title;
        }
        $this->_title = $title;

        return $this;
    }
1169226
public function title($title = null)
    {
        if (is_null($title)) {
            return $this->title;
        }

        $this->title = $title;

        return $this;
    }
300227
public static function getByTitle($title): Sources
    {
        $sourceData = self::findFirstByTitle($title);

        if (!$sourceData) {
            throw new \Exception(_('Importing site is not currently supported.'));
        }

        return $sourceData;
    }
416251
public function title(string $title = null): Htmlable
    {
        $page = Paginator::resolveCurrentPage();

        $data = [
            'site' => ['name' => $this->site],
            'page' => ['title' => $title, 'number' => $page],
        ];

        $data['site']['name'] = $this->getHtmlTitleFormatForSite($data);

        $output = $this->getHtmlTitleFormatForPage($data);

        return $this->html->create('title', trim($output));
    }