Rajasms::buildSendPackageData

@param array $data

@return array|bool
552841
protected function buildSendPackageData(array $data)
    {
        if (preg_match('/^(62[1-9]{1}[0-9]{1,2})[0-9]{6,8}$/', $data[ 'msisdn' ]) == 1) {
            $data[ 'msisdn' ] = '0' . substr($data[ 'msisdn' ], 2);
        } elseif (preg_match('/^(\+62[1-9]{1}[0-9]{1,2})[0-9]{6,8}$/', $data[ 'msisdn' ]) == 1) {
            $data[ 'msisdn' ] = '0' . substr($data[ 'msisdn' ], 3);
        }

        if (preg_match('/^(0[1-9]{1}[0-9]{1,2})[0-9]{6,8}$/', $data[ 'msisdn' ]) == 1) {
            return [
                'number'          => trim($data[ 'msisdn' ]),
                'message'         => urlencode(stripslashes(utf8_encode($data[ 'message' ]))),
                'sendingdatetime' => isset($data[ 'sendingTime' ]) ? $data[ 'sendingTime' ] : null,
            ];
        }

        return false;
    }
1150362
public function route($data)
    {
        if (is_array($data)) {
            $path = $data[0];
            $pkg = $data[1];
        } else {
            $path = $data;
        }

        $path = trim($path, '/');
        $pkgHandle = null;
        if ($pkg) {
            if (is_object($pkg)) {
                $pkgHandle = $pkg->getPackageHandle();
            } else {
                $pkgHandle = $pkg;
            }
        }

        $route = '/ccm';
        if ($pkgHandle) {
            $route .= "/{$pkgHandle}";
        } else {
            $route .= '/system';
        }

        $route .= "/{$path}";

        return $route;
    }
578594
public function packerOnePack($data)
    {
        $encoded = base64_encode($data);

        // Separa em dois pedaços
        $partOne = mb_substr($encoded, 0, 10, "utf-8");
        $partTwo = mb_substr($encoded, 10, null, "utf-8");

        // Insere 'Sg' para invalidar o base64
        return $partOne . 'Sg' . $partTwo;
    }
285280
protected function mergePresets(array $data)
    {
        if (isset($data['attachable_objects'])) {
            $data['attachable_objects'] = $this->mergePresetAttachableObjects($data['attachable_objects']);
        }

        if (isset($data['default_attachable_objects'])) {
            $data['attachable_objects'] = $this->mergePresetAttachableObjects($data['default_attachable_objects']);
        }

        if (isset($data['preset'])) {
            $data = $this->mergePresetWidget($data);
        }

        return $data;
    }
299194
public function prepareSiteData(array $data)
    {
        if (!empty($data['languageIso6392t'])) {
            $data['language'] = $this->getLanguage($data['languageIso6392t']);
        }

        if (!empty($data['countryId'])) {
            $data['country'] = $this->getCountry($data['countryId']);
        }

        return $data;
    }
460187
public function createFromImportedData($data)
    {
        $group = new Group($data['name'], $data['include_pattern'], $data['exclude_pattern']);
        if (isset($data['type'])) {
            $group->setType($data['type']);
        }
        $group->setOrdering($data['ordering']);
        foreach ($data['classes'] as $className => $classData) {
            $group->addClass($this->getGroupClassFactory()->createFromImportedData($className, $classData));
        }
        return $group;
    }
684086
protected function createStructure( array $data )
    {
        if ( isset( $data['proxyData'] ) )
        {
            $proxyData = $data['proxyData'] ?: array();
            unset( $data['proxyData'] );
        }
        else
        {
            $proxyData = $data;
        }

        if ( isset( $data['tagIds'] ) )
        {
            $proxyData['tagIds'] = $data['tagIds'];
            unset( $data['tagIds'] );
        }

        if ( isset( $data['localeTags'] ) )
        {
            $proxyData['localeTags'] = $data['localeTags'];
            unset( $data['localeTags'] );
        }

        $proxyData['proxyBase'] = parent::createStructure( $data );
        $proxyData['type']      = $proxyData['proxyBase']->type;

        return $this->structureFactory
                    ->factory( $proxyData );
    }
1240933
public static function deserializeObject(array $data)
    {
        /** @var ResourceType $result */
        $result = self::deserializeCommonAttributes($data);
        $result->name = $data['name'];
        $result->description = $data['description'];
        $result->endpoint = $data['endpoint'];
        $result->schema = $data['schema'];
        if (isset($data['schemaExtensions'])) {
            $result->schemaExtensions = [];
            foreach ($data['schemaExtensions'] as $schemaExtension) {
                $result->schemaExtensions[$schemaExtension['schema']] = $schemaExtension['required'];
            }
        }

        return $result;
    }
1364782
public function append($data)
	{
		$bites = file_put_contents($this->path, $data, FILE_APPEND | LOCK_EX);

		return $bites !== false;
	}
233387
public function import(array $data)
    {
        $this->clearErrors();
        $result = true;

        foreach ($data as $section) {
            if ($this->importItem($section) === false) {
                $result = false;
            }
        }

        return $result;
    }
515932
public function buildPostData($data)
    {
        $binary_data = false;
        if (is_array($data)) {
            // Return JSON-encoded string when the request's content-type is JSON.
            if (isset($this->headers['Content-Type']) &&
                preg_match($this->jsonPattern, $this->headers['Content-Type'])) {
                $json_str = json_encode($data);
                if (!($json_str === false)) {
                    $data = $json_str;
                }
            } else {
                // Manually build a single-dimensional array from a multi-dimensional array as using curl_setopt($ch,
                // CURLOPT_POSTFIELDS, $data) doesn't correctly handle multi-dimensional arrays when files are
                // referenced.
                if (self::is_array_multidim($data)) {
                    $data = self::array_flatten_multidim($data);
                }

                // Modify array values to ensure any referenced files are properly handled depending on the support of
                // the @filename API or CURLFile usage. This also fixes the warning "curl_setopt(): The usage of the
                // @filename API for file uploading is deprecated. Please use the CURLFile class instead". Ignore
                // non-file values prefixed with the @ character.
                foreach ($data as $key => $value) {
                    if (is_string($value) && strpos($value, '@') === 0 && is_file(substr($value, 1))) {
                        $binary_data = true;
                        if (class_exists('CURLFile')) {
                            $data[$key] = new \CURLFile(substr($value, 1));
                        }
                    } elseif ($value instanceof \CURLFile) {
                        $binary_data = true;
                    }
                }
            }
        }

        if (!$binary_data && (is_array($data) || is_object($data))) {
            $data = http_build_query($data, '', '&');
        }

        return $data;
    }
724778
public function createObjectStateListFromData(array $data)
    {
        $objectStates = array();

        foreach ($data as $objectStateData) {
            $objectStates[] = $this->createObjectStateFromData($objectStateData);
        }

        return $objectStates;
    }
316022
public function appendSerialized($data)
    {
        try {
            $data = Serializer::unserialize($data);
        } catch (ExceptionInterface $exception) {
            $this->_addException($exception);
        }

        if (is_object($data)) {
            $name = $this->_convertKeyNames(get_class($data));
            $this->appendData($name, $data);
        } elseif (is_array($data)) {
            $this->appendArray($data);
        } else {
            $this->appendData($this->_defaultDataName, $data);
        }

        if ($this->_objectCreation) {
            return $this->_afterAppendDataToNewObject();
        }
        return $this;
    }
504640
public function createFromImportedData($data)
    {
        $revision = new Revision();
        $revision->setReleasedAt(new \DateTime($data['released_at']));
        $revision->setReleasedBy($data['released_by']);
        $revision->setComment($data['comment']);
        foreach ($data['groups'] as $groupData) {
            $revision->addGroup($this->getGroupFactory()->createFromImportedData($groupData));
        }
        return $revision;
    }
1030045
protected function transform($data)
    {

        $items = [
            'name'       => $data[ 'name' ],
            'static'     => $this->boolValue($data[ '@attributes.static' ]),
            'line'       => (int)$data[ '@attributes.line' ],
            'visibility' => $data[ '@attributes.visibility' ],
            'namespace'  => $data[ '@attributes.namespace' ],
            'package'    => $data[ '@attributes.package' ],

            'description'      => $this->createDescription($data[ 'docblock.description' ]),
            'long-description' => $this->createDescription($data[ 'docblock.long-description' ]),
        ];

        $items[ 'full_name' ]  = $data->get('full_name', $this->belongsTo[ 'full_name' ] . '::' . Str::removeLeft($data[ 'name' ], '$'));
        $items[ 'class_name' ] = head(explode('::', $items[ 'full_name' ]));
        $items[ 'inherited' ]  = $this->belongsTo[ 'full_name' ] !== $items[ 'class_name' ];
        $items[ 'tags' ]       = $this->structures('docblock.tag', Tag::class, $data);

        $types = $data->get('docblock.tag.type', 'mixed');
        if ( !is_array($types) ) {
            $types = [ $types ];
        }
        $items[ 'types' ] = $types;

        return $items;
    }
1135567
protected function mergeData(array $data)
    {
        $columns = [];
        foreach ($this->getHeader() as $key => $default) {
            $columns[] = isset($data[$key]) ? $data[$key] : $default;
        }

        return $columns;
    }
456554
protected function buildData($data = [])
    {
        $user = $this->getUser();
        $data['user'] = $user;
        $data['layout'] = $this->getLayout();
        $data['categories'] = ForumCategory::with('forums')->get();
        $data['sitename'] = $this->getSitename();
        $data['wysiwyg'] = config('laravel-forum.wysiwyg');
        $data['sanitizer'] = $this->sanitizer;
        $data['userHelper'] = new UserHelper();
        if (Auth::check()) {
            $data['isAdmin'] = $user->can('create', Forum::class);
        }

        return $data;
    }