<commit_before><?php

namespace DDM\SmartyStreets;

class AddressCandidate
{
    protected $candidateIndex;
    protected $inputIndex;
    protected $inputId;

    protected $addressee;
    protected $deliveryLine1;
    protected $deliveryLine2;
    protected $lastLine;

    protected $deliveryPointBarcode;
    protected $components;
    protected $metadata;
    protected $analysis;

    /**
     * Sets properties using smartystreets response object
     *
     * Supported fields for $object
     * -
     * - inputId              = mixed
     * - inputIndex           = int
     * - candidateIndex       = int
     * - addressee            = string
     * - deliveryLine1        = string
     * - deliveryLine2        = string
     * - lastLine             = string
     * - deliveryPointBarcode = string
     * - components           = object
     * - metadata             = object
     * - analysis             = object
     *
     * @param object $object smartystreets response object
     */
    public function setFromObject($object)
    {
        $this->inputId              = isset($object->input_id) ? $object->input_id : null;
        $this->inputIndex           = $object->input_index;
        $this->candidateIndex       = $object->candidate_index;
        $this->addressee            = isset($object->addressee) ? $object->addressee : null;
        $this->deliveryLine1        = $object->delivery_line_1;
        $this->deliveryLine2        = isset($object->delivery_line_2) ? $object->delivery_line_2 : null;
        $this->lastLine             = $object->last_line;
        $this->deliveryPointBarcode = $object->delivery_point_barcode;
        $this->components           = $object->components;
        $this->metadata             = $object->metadata;
        $this->analysis             = $object->analysis;
    }

    /**
     * Convenience method for extracting both lat and lon
     * @return array
     */
    public function getLatAndLong()
    {
        return [
          'latitude'  => $this->getLatitude(),
          'longitude' => $this->getLongitude(),
        ];
    }

    /**
     * Getter for canditatIndex
     * @return int Posistion in smartystreets response
     */
    public function getCandidateIndex()
    {
        return $this->candidateIndex;
    }

    /**
     * Getter for inputIndex
     * @return int Input position
     */
    public function getInputIndex()
    {
        return $this->inputIndex;
    }

    /**
     * Getter for inputId
     * @return string input id passed to smartystreets
     */
    public function getInputId()
    {
        return $this->inputId;
    }
<commit_msg>Updates code to make it work with php 5.3<commit_after><?php

namespace DDM\SmartyStreets;

class AddressCandidate
{
    protected $candidateIndex;
    protected $inputIndex;
    protected $inputId;

    protected $addressee;
    protected $deliveryLine1;
    protected $deliveryLine2;
    protected $lastLine;

    protected $deliveryPointBarcode;
    protected $components;
    protected $metadata;
    protected $analysis;

    /**
     * Sets properties using smartystreets response object
     *
     * Supported fields for $object
     * -
     * - inputId              = mixed
     * - inputIndex           = int
     * - candidateIndex       = int
     * - addressee            = string
     * - deliveryLine1        = string
     * - deliveryLine2        = string
     * - lastLine             = string
     * - deliveryPointBarcode = string
     * - components           = object
     * - metadata             = object
     * - analysis             = object
     *
     * @param object $object smartystreets response object
     */
    public function setFromObject($object)
    {
        $this->inputId              = isset($object->input_id) ? $object->input_id : null;
        $this->inputIndex           = $object->input_index;
        $this->candidateIndex       = $object->candidate_index;
        $this->addressee            = isset($object->addressee) ? $object->addressee : null;
        $this->deliveryLine1        = $object->delivery_line_1;
        $this->deliveryLine2        = isset($object->delivery_line_2) ? $object->delivery_line_2 : null;
        $this->lastLine             = $object->last_line;
        $this->deliveryPointBarcode = $object->delivery_point_barcode;
        $this->components           = $object->components;
        $this->metadata             = $object->metadata;
        $this->analysis             = $object->analysis;
    }

    /**
     * Convenience method for extracting both lat and lon
     * @return array
     */
    public function getLatAndLong()
    {
        return array(
          'latitude'  => $this->getLatitude(),
          'longitude' => $this->getLongitude(),
        );
    }

    /**
     * Getter for canditatIndex
     * @return int Posistion in smartystreets response
     */
    public function getCandidateIndex()
    {
        return $this->candidateIndex;
    }

    /**
     * Getter for inputIndex
     * @return int Input position
     */
    public function getInputIndex()
    {
        return $this->inputIndex;
    }

    /**
     * Getter for inputId
     * @return string input id passed to smartystreets
     */
    public function getInputId()
    {
        return $this->inputId;
    }

{'fraction_non_alphanumeric': 0.10351305654705993, 'fraction_numerical': 0.0037572797294758596, 'mean_word_length': 1.8470588235294119, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 67, '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': '7625941', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1484, 'n_words': 319}