Populates the object with the detail from the service

@param \stdClass $locationDetail The address detail i.e. which was retrieved from the API

@return boolean          True if successfully populated the detail and false otherwise
437556
private function populateDetail(\stdClass $locationDetail)
    {
        // The data from the API is returned under the `results` key
        if (!property_exists($locationDetail, 'results')) {
            $this->isValid = false;

            return false;
        }

        $this->latitude  = $locationDetail->results[0]->geometry->location->lat;
        $this->longitude = $locationDetail->results[0]->geometry->location->lng;

        foreach ($locationDetail->results[0]->address_components as $component) {
            if (in_array('street_number', $component->types)) {
                $this->streetNumber = $component->long_name;
            } elseif (in_array('locality', $component->types)) {
                $this->locality = $component->long_name;
                $this->shortLocality = $component->short_name;
            } elseif (in_array('postal_town', $component->types)) {
                $this->town = $component->long_name;
                $this->shortTown = $component->short_name;
            } elseif (in_array('administrative_area_level_2', $component->types)) {
                $this->country = $component->long_name;
                $this->shortCountry = $component->short_name;
            } elseif (in_array('country', $component->types)) {
                $this->country = $component->long_name;
                $this->shortCountry = $component->short_name;
            } elseif (in_array('administrative_area_level_1', $component->types)) {
                $this->district = $component->long_name;
                $this->shortDistrict = $component->short_name;
            } elseif (in_array('postal_code', $component->types)) {
                $this->postcode = $component->long_name;
            } elseif (in_array('route', $component->types)) {
                $this->streetAddress = $component->long_name;
                $this->shortStreetAddress = $component->short_name;
            } elseif (in_array('political', $component->types)) {
                $this->neighborhood = $component->long_name;
                $this->shortNeighborhood = $component->short_name;
            }
        }

        return true;
    }
922642
private function isClassCacheable($classDefinition)
    {
        if ($classDefinition instanceof ClassDefinition) {
            return true;
        }
        if ($classDefinition instanceof \ReflectionClass) {
            if ($classDefinition->isInternal() && $classDefinition->isInstantiable()) {
                $extension = $classDefinition->getExtension();
                switch ($extension->getName()) {
                    case 'Reflection':
                    case 'Core':
                    case 'SPL':
                        return true;
                }
            }
        }

        return false;
    }
90723
private function loadLocationFromModel($locationId = 0)
    {
        $locationId = $locationId ? : $this->model->selectedLocation;
        if ($locationId) {
            $locations = SuperCMSUser::getUserLocations()->filter(new Equals('LocationID', $locationId));
            if ($locations->count()) {
                return $locations[0];
            }
        }
        return false;
    }
313637
protected function setDetail($detail)
    {
        if (0 === strlen(trim($detail))) {
            throw new \InvalidArgumentException('Provided error message cannot be empty');
        }

        $this->detail = (string) $detail;
    }
1145860
private static function search($postType, array $details)
    {
        $s = isset($_GET['post_type']) ? $_GET['post_type'] : false;

        if($s === $postType && is_search())
        {
            self::loadController($details);
            exit;
        }
    }
1313160
private function prepareLocateDataObject()
    {
        $fragment = new CNabuPHPMethodBuilder(
            $this, 'locateDataObject', CNabuPHPMethodBuilder::METHOD_PROTECTED,
            false, false, false, true, 'bool'
        );
        $fragment->addComment("Locate a Data Object.");
        $fragment->addComment("@return bool Returns true if the Data Object found or false if not.");

        $fragment->addParam(
            'element', 'SimpleXMLElement', false, null, 'SimpleXMLElement', 'Element to locate the Data Object.'
        );
        $fragment->addParam(
            'data_parent', 'CNabuDataObject', true, null, 'CNabuDataObject', 'Data Parent object.'
        );

        $fragment->addFragment(array(
            '$retval = false;',
            '',
            "if (isset(\$element['GUID'])) {",
            "    \$guid = (string)\$element['GUID'];",
            "    if (!(\$this->nb_data_object instanceof $this->class_data_name)) {",
            "        \$this->nb_data_object = $this->class_data_name::findByHash(\$guid);",
            '    } else {',
            '        $this->nb_data_object = null;',
            '    }',
            '',
            "    if (!(\$this->nb_data_object instanceof $this->class_data_name)) {",
            "        \$this->nb_data_object = new $this->class_data_name();",
            "        \$this->nb_data_object->setHash(\$guid);",
            '    }',
            '    $retval = true;',
            '}',
            '',
            'return $retval;'
        ));

        $this->getDocument()->addUse('\nabu\data\CNabuDataObject');
        $this->getDocument()->addUse("\\$this->class_data_namespace\\$this->class_data_name");
        $this->getDocument()->addUse('\SimpleXMLElement');

        $this->addFragment($fragment);
    }
31953
public function isSecondaryLocal()
    {
        if (!$this->isSecondary()) {
            return false;
        }

        $hashKey        = $this->getHashKey()->getPropertyMetadata()->name;
        $hashKeyPrimary = $this->class->getIndex()->getHashKey()->getPropertyMetadata()->name;

        return $hashKey === $hashKeyPrimary;
    }
1254857
public function createOffsitePurchase(array $paymentDetails)
    {

        $paymentDetails['TxType'] = static::OPERATION_PAYMENT;

        $query = http_build_query($paymentDetails);

        $request = new Request(
            'post',
            $this->getOffsiteResource(),
            $this->getGatewayHost()
        );

        $request->setContent($query);

        return $this->doRequest($request);
    }
801838
public function setItemsDetail($detail = true, $primary_where_column = null)
	{
		if ($this->isSortable()) {
			throw new DataGridException('You can not use both sortable datagrid and items detail.');
		}

		$this->items_detail = new Column\ItemDetail(
			$this,
			$primary_where_column ?: $this->primary_key
		);

		if (is_string($detail)) {
			/**
			 * Item detail will be in separate template
			 */
			$this->items_detail->setType('template');
			$this->items_detail->setTemplate($detail);

		} elseif (is_callable($detail)) {
			/**
			 * Item detail will be rendered via custom callback renderer
			 */
			$this->items_detail->setType('renderer');
			$this->items_detail->setRenderer($detail);

		} elseif ($detail === true) {
			/**
			 * Item detail will be rendered probably via block #detail
			 */
			$this->items_detail->setType('block');

		} else {
			throw new DataGridException(
				'::setItemsDetail() can be called either with no parameters or with parameter = template path or callable renderer.'
			);
		}

		return $this->items_detail;
	}
925355
public function populate(\stdClass $data)
    {
        $this->CodEmpresa = $data->codEmpresa;
        $this->CodIntegracaoContaCorrente = $data->codIntegracaoContaCorrente;
        $this->CodTipoMovto = $data->codTipoMovto;
        $this->DatMovimento = $data->datMovimento;
        $this->VlrMovimento = $data->vlrMovimento;
        $this->DscComplemento = $data->dscComplemento;
        $this->CodIntegracaoTipoMovtoCc = $data->codIntegracaoTipoMovtoCc;
        $this->CodIntegracaoMovtoCc = $data->codIntegracaoMovtoCc;
        $this->CodIntegracaoFilial = $data->codIntegracaoFilial;
    }
1365982
protected function collectInformation(Request $request, $locationId)
    {
        $isValid = false;

        $location = $this->container
            ->get('ezpublish.api.service.location')
            ->loadLocation($locationId);

        /** @var \Netgen\Bundle\InformationCollectionBundle\Form\Builder\FormBuilder $formBuilder */
        $formBuilder = $this->container
            ->get('netgen_information_collection.form.builder');

        $form = $formBuilder->createFormForLocation($location)
            ->getForm();

        /** @var CaptchaValueInterface $captcha */
        $captcha = $this->container
            ->get('netgen_information_collection.factory.captcha')
            ->getCaptcha($location);

        $form->handleRequest($request);
        $validCaptcha = $captcha->isValid($request);
        $formSubmitted = $form->isSubmitted();

        if ($formSubmitted && $form->isValid() && $validCaptcha) {
            $isValid = true;
            $event = new InformationCollected($form->getData());

            /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */
            $dispatcher = $this->container
                ->get('event_dispatcher');

            $dispatcher->dispatch(Events::INFORMATION_COLLECTED, $event);
        }

        if (true === $formSubmitted && false === $validCaptcha) {
            $form->addError(new FormError($this->container->get('translator')->trans('form.errors.captcha_failed', array(), 'netgen_information_collection_form_messages')));
        }

        return array(
            'is_valid' => $isValid,
            'form' => $form->createView(),
            'collected_fields' => $form->getData()->payload->getCollectedFields(),
        );
    }
569662
private function loadLocationMapByIdList(array $locationIdList)
    {
        if (method_exists($this->locationHandler, 'loadList')) {
            return $this->locationHandler->loadList($locationIdList);
        }

        $locationList = [];

        foreach ($locationIdList as $locationId) {
            try {
                $locationList[$locationId] = $this->locationHandler->load($locationId);
            } catch (NotFoundException $e) {
                // do nothing
            }
        }

        return $locationList;
    }
600856
public function populate(\stdClass $data)
    {
        $this->CodEmpresa = $data->codEmpresa;
        $this->NumCnpj = $data->numCnpj;
        $this->RazaoSocial = $data->razaoSocial;
        $this->NomFantasia = $data->nomFantasia;
        $this->NumInscricaoEstadual = (isset($data->numInscricaoEstadual)) ? $data->numInscricaoEstadual : null;
        $this->NumInscricaoMunicipal = (isset($data->numInscricaoMunicipal)) ? $data->numInscricaoMunicipal : null;
        $this->NomLogradouro = (isset($data->nomLogradouro)) ? $data->nomLogradouro : null;
        $this->NumLogradouro = (isset($data->numLogradouro)) ? $data->numLogradouro : null;
        $this->DscComplemento = (isset($data->dscComplemento)) ? $data->dscComplemento : null;
        $this->NomBairro = (isset($data->nomBairro)) ? $data->nomBairro : null;
        $this->NomLocalidade = (isset($data->nomLocalidade)) ? $data->nomLocalidade : null;
        $this->SglPais = (isset($data->sglPais)) ? $data->sglPais : null;
        $this->SglUF = (isset($data->sglUf)) ? $data->sglUf : null;
        $this->NumCep = (isset($data->numCep)) ? $data->numCep : null;
        $this->NumDDD = (isset($data->numDdd)) ? $data->numDdd : null;
        $this->NumTelefone = (isset($data->numTelefone)) ? $data->numTelefone : null;
        $this->DscEmail = (isset($data->dscEmail)) ? $data->dscEmail : null;

        if (isset($data->dadosBancarios)) {
            $this->DadosBancarios = new Banco(
                $data->dadosBancarios->nomFavorecido,
                $data->dadosBancarios->numCpfCnpjFavorecido,
                $data->dadosBancarios->numBanco,
                $data->dadosBancarios->numAgencia,
                $data->dadosBancarios->numContaCorrente,
                $data->dadosBancarios->numDigitoContaCorrente
            );
        }
    }
589926
private function prepareDetailsForAPI(array $details)
    {
        foreach ($details as $key => &$detailValues) {
            if (is_array($detailValues)) {
                $this->prepareDetailsForAPI($detailValues);
            }

            if ('contactSource_id' === $key) {
                // Don't include this as it should be included in parent as contactId
                unset($details[$key]);
                continue;
            }

            if (strstr($key, '_')) {
                $newKey           = lcfirst(str_replace('_', '', ucwords($key, '_')));
                $details[$newKey] = $details[$key];
                unset($details[$key]);
            }
        }

        return $details;
    }
415425
protected function setDetailsAttr(DetailArray $value = null, $isDirty = true)
    {
        if (!is_null($value)) {
            $this->details = $value;
            $this->setDirtyState($isDirty, 'details');
        }
    }
1251913
public function addOrderDetail(array $newOrderDetail)
    {
        $orderDetail = new OrderDetail();
        if ($newOrderDetail) {
            foreach ($newOrderDetail as $k => $v) {
                if (array_key_exists($k, $orderDetail) && (strlen($v))) {
                    $orderDetail->$k = $v;
                }
            }
        }
        $this->orderDetails[] = new \SoapVar($orderDetail, SOAP_ENC_OBJECT, self::SOAP_ORDERDETAIL, self::PAYLINE_NAMESPACE);
    }
1322880
protected function _fetch()
    {
        if ($this->_select === NULL) {
            return false;
        }

        $this->_data = $this->_select->fetchAllAsItems();

        return true;
    }