Deserializes data into a Message entity.

@param array   $data
@param Message $message
@param array   $options

@return Plugin
493655
public function deserialize($data, Message $message, array $options = [])
    {
        $this->sipe('object', 'setObject', $data, $message);
        $this->sipe('content', 'setContent', $data, $message);
        $currentUser = $this->tokenStorage->getToken()->getUser();

        if (isset($data['parent'])) {
            $parent = $this->om->getRepository(Message::class)->find($data['parent']['id']);
            $message->setParent($parent);
        }

        if ($currentUser instanceof User && in_array(Options::CRUD_CREATE, $options)) {
            $message->setSender($currentUser);
        }

        //build the "to" string here
        //; is the separator
        //{} for groups
        //[] for workspaces
        $receivers = [];

        if (isset($data['toGroups'])) {
            $receivers = array_merge(array_map(function ($group) {
                return '{'.$group['name'].'}';
            }, $data['toGroups']), $receivers);
        }

        if (isset($data['toUsers'])) {
            $receivers = array_merge(array_map(function ($user) {
                return $user['username'];
            }, $data['toUsers']), $receivers);
        }

        if (isset($data['toWorkspaces'])) {
            $receivers = array_merge(array_map(function ($workspace) {
                return '['.$workspace['code'].']';
            }, $data['toWorkspaces']), $receivers);
        }

        $receiversString = implode(';', $receivers);

        if ('' !== $receiversString && !$message->getTo()) {
            $message->setTo($receiversString);
        }

        return $message;
    }
1175819
public function outVerbose($message, $options = array())
    {
        
        common_Logger::i($message);
        if (isset($this->parameters['verbose']) && $this->parameters['verbose'] === true) {
        	$this->out($message, $options);
        }
        
    }
196517
public function deserialize(array $data, ResourceNode $resourceNode, array $options = [])
    {
        $this->sipe('name', 'setName', $data, $resourceNode);

        if (!in_array(Options::REFRESH_UUID, $options)) {
            $this->sipe('id', 'setUuid', $data, $resourceNode);
        }

        if (isset($data['meta']['workspace'])) {
            /** @var Workspace $workspace */
            $workspace = $this->om->getRepository(Workspace::class)->findOneBy(['uuid' => $data['meta']['workspace']['uuid']]);
            $resourceNode->setWorkspace($workspace);
        }

        if (isset($data['poster']) && isset($data['poster']['url'])) {
            $resourceNode->setPoster($data['poster']['url']);
        }

        if (isset($data['thumbnail']) && isset($data['thumbnail']['url'])) {
            $resourceNode->setThumbnail($data['thumbnail']['url']);
        }

        // meta
        if (empty($resourceNode->getResourceType())) {
            /** @var ResourceType $resourceType */
            $resourceType = $this->om
                ->getRepository('ClarolineCoreBundle:Resource\ResourceType')
                ->findOneBy(['name' => $data['meta']['type']]);

            $resourceNode->setResourceType($resourceType);
        }

        if (empty($resourceNode->getMimeType())) {
            if (isset($data['meta']) && !empty($data['meta']['mimeType'])) {
                $mimeType = $data['meta']['mimeType'];
            } else {
                $mimeType = 'custom/'.$resourceNode->getResourceType()->getName();
            }

            $resourceNode->setMimeType($mimeType);
        }

        if (isset($data['rights'])) {
            $this->deserializeRights($data['rights'], $resourceNode, $options);
        }

        $this->sipe('meta.published', 'setPublished', $data, $resourceNode);
        $this->sipe('meta.description', 'setDescription', $data, $resourceNode);
        $this->sipe('meta.license', 'setLicense', $data, $resourceNode);
        $this->sipe('meta.authors', 'setAuthor', $data, $resourceNode);
        $this->sipe('meta.commentsActivated', 'setCommentsActivated', $data, $resourceNode);

        // display
        $this->sipe('display.fullscreen', 'setFullscreen', $data, $resourceNode);
        $this->sipe('display.showIcon', 'setShowIcon', $data, $resourceNode);
        $this->sipe('display.closable', 'setClosable', $data, $resourceNode);
        $this->sipe('display.closeTarget', 'setCloseTarget', $data, $resourceNode);

        // restrictions
        $this->sipe('restrictions.code', 'setAccessCode', $data, $resourceNode);
        $this->sipe('restrictions.allowedIps', 'setAllowedIps', $data, $resourceNode);
        $this->sipe('restrictions.hidden', 'setHidden', $data, $resourceNode);

        if (isset($data['restrictions']['dates'])) {
            $dateRange = DateRangeNormalizer::denormalize($data['restrictions']['dates']);

            $resourceNode->setAccessibleFrom($dateRange[0]);
            $resourceNode->setAccessibleUntil($dateRange[1]);
        }
    }
347423
protected function prepareResult(&$data, array $options)
    {
        if (!empty($options['unserialize']) && !empty($data)) {
            foreach ((array) $options['unserialize'] as $field) {
                $data[$field] = empty($data[$field]) ? array() : unserialize($data[$field]);
            }
        }
    }
479694
public function make(array $data = null, array $options = null)
    {
        $data = $data ? $data : $this->getData();
        $this->setData($data);

        $options = $options ? $options : $this->getOptions();
        $options = array_replace_recursive($this->getDefaults(), $options);
        $this->setOptions($options);




        if ($this->isShowRowCheckbox()) {
            $this->addRowCheckbox();
        }

        if ($this->isShowRowIndex()) {
            $this->addRowIndex();
        }

        if ($this->isShowColSearch()) {
            $this->addColSearch();
        }

        $options = $this->getOptions();
        $data = $this->getData();

        $attributes = [];

        // Attributes for wrappers
        $attributes['table'] = $this->getAttributes('table', $options);
        $attributes['caption'] = $this->getAttributes('caption', $options);
        $attributes['colgroup'] = $this->getAttributes('colgroup', $options);
        $attributes['thead'] = $this->getAttributes('thead', $options);
        $attributes['tbody'] = $this->getAttributes('tbody', $options);
        $attributes['tfoot'] = $this->getAttributes('tfoot', $options);

        // caption
        $caption = isset($options['caption']['value']) ?
            $options['caption']['value'] : '';

        // colgroup data
        $cols = '';
            if (is_array($options['colgroup']) && $this->isShowColgroup()) {
            $colsData = isset($options['colgroup']['value']) ?
                $options['colgroup']['value'] : array_slice($data, 0, 1);
            $cols = $this->getColgroup($colsData, $options);
        }

        // thead data
        $thead_rows = '';
        if (is_array($options['thead']) && $this->isShowThead()) {
            $theadData = isset($options['thead']['value']) ?
                $options['thead']['value'] : array_slice($data, 0, 1);
            $theadData = is_callable($theadData) ? $theadData($data) : $theadData;
            $thead_rows = $this->getGrid($theadData, 'thead_tr', 'th',
                $options);
        }

        // tfoot data
        $tfoot_rows = '';
        if (is_array($options['tfoot']) && $this->isShowTfoot()) {
            $tfootData = isset($options['tfoot']['value']) ?
                $options['tfoot']['value'] : null;
            $tfootData = is_callable($tfootData) ? $tfootData($data) : $tfootData;
            $tfoot_rows = $this->getGrid($tfootData, 'tfoot_tr', 'tfoot_td',
                $options);
        }

        // tbody data
        $tbody_rows = $this->getGrid($data, 'tr', 'td', $options);

        // Render wrappers
        $caption = empty($caption) ?
            '' : sprintf($options['caption']['tag'], $attributes['caption'],
                $caption);

        $colgroup = empty($cols) ?
            '' : sprintf($options['colgroup']['tag'], $attributes['colgroup'],
                $cols);

        $thead = empty($thead_rows) ?
            '' : sprintf($options['thead']['tag'], $attributes['thead'],
                $thead_rows);

        $tbody = sprintf($options['tbody']['tag'], $attributes['tbody'],
            $tbody_rows);

        $tfoot = empty($tfoot_rows) ?
            '' : sprintf($options['tfoot']['tag'], $attributes['tfoot'],
                $tfoot_rows);

        $table = $caption .$colgroup . $thead . $tbody . $tfoot;

        return sprintf($options['table']['tag'], $attributes['table'], $table);
    }
998829
public function message($message, $options = null) {
		$options = $this->_mergeOptions($options);

		$this->set($message, $options);

		$this->_assertSessionStackSize($options);
	}
423823
public function deserialize($data, Message $message, array $options)
    {
        if (!in_array(Options::REFRESH_UUID, $options)) {
            $message->setUuid($data['id']);
        }

        $this->sipe('title', 'setTitle', $data, $message);
        $this->sipe('content', 'setContent', $data, $message);

        if (isset($data['workspace']['uuid'])) {
            $workspace = $this->workspaceRepo->findOneBy(['uuid' => $data['workspace']['uuid']]);

            if (!empty($workspace)) {
                $message->setWorkspace($workspace);
            }
        }

        return $message;
    }
1156299
public function notify(Message $message, $options = array())
    {
        $logger = $GLOBALS['logger'];
        $logger->debug(
            'Sending Mail ',
            array(
             $message->getRecipients(),
             $message->getBody(),
            )
        );
        $path    = 'notifications/mail/send';

        // Check for number of attachments at the top
        $attachments = $message->getAttachments();
        if (count($attachments) > self::MAX_ATTACHMENTS)
            throw new \InvalidArgumentException("Can only send maximum ".self::MAX_ATTACHMENTS." attachments in a single mail.");

        // The base request
        $request = $this->_remoteServer->post($path)
            ->setPostField('type', 'sms')
            ->setPostField('subject', $message->getSubject())
            ->setPostField('to', implode(';', $message->getRecipients()))
            ->setPostField('content', $message->getBody());

        // Add options if present
        if (isset($options['priority']))
            $request->setPostField('priority', $options['priority']);
        if (isset($options['priority']))
            $request->setPostField('format', $options['format']);

        if (!empty($attachments) && is_array($attachments)) {
            foreach($attachments as $idx=>$attachment) {
                if (!empty($attachment) && file_exists($attachment))
                    // TODO: Remove HACK - sending files as attach[0], attach[1], attach[2]
                    $request->addPostFile('attach['.$idx.']', $attachment);
            }
        } else
            // Force a multipart form data by attaching /dev/null
            $request->addPostFile('nullfile', '@/dev/null');

        //// Add the duplicate aggregator for attachments
        //$request->getQuery()->setAggregator(new \Guzzle\Http\QueryAggregator\DuplicateAggregator);

        // Send the remote request
        try {
            $response = $request->send();
            if ($response->getStatusCode() !== 200) {
                throw new MessagingException();
            }

            $rawResponse = $response->getBody('true');

            return $rawResponse;
        } catch (\Exception $e) {
            throw new MessagingException();
        }

    }
692320
public static function EncryptMessage ($message, $key, $options = []) {
		$options['module'] = \MCRYPT_MODE_ECB;
		return static::Encrypt($message, $key, $options);
	}
1059850
public function send($message, array $options = [])
    {
        $sms = new Message($options);
        $this->request('sms', $sms->getParams());
        $response = $this->getResponse();

        if ($response['error_code'] !== '000') {
            $this->errors[] = $response['error_code'];
            return false;
        }

        return true;
    }
976103
public function create($body, $options = array()) {
        $options = new Values($options);

        $data = Values::of(array(
            'Body' => $body,
            'From' => $options['from'],
            'Attributes' => $options['attributes'],
        ));

        $payload = $this->version->create(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new MessageInstance(
            $this->version,
            $payload,
            $this->solution['serviceSid'],
            $this->solution['channelSid']
        );
    }
598760
public function deserialize($data, PublicFile $file = null, array $options = [])
    {
        //this is currently done in FileUtilities
        if (isset($data['id'])) {
            return $this->utilities->getOneBy(['id' => $data['id']]);
        }
    }
249125
public static final function jsonEncode($data, array $options = null): array
    {
        $encoder = new JsonEncoder($options);

        return [$encoder->encode($data), $encoder->hasError()
            ? new EncoderException('JSON Error: '. $encoder->getError()) : null];
    }
787442
public function attachData($data, $name, array $options = [])
    {
        return $this->laravelMessage->attachData($data, $name, $options);
    }
971308
protected function encodeMessage($message, array $options = [])
    {
        $resolver = new OptionsResolver();
        $this->encoder->setDefaultOptions($resolver);
        $options = $resolver->resolve($options);

        return $this->encoder->encode($message, $this->compressor, $options);
    }
304452
public function deserialize($data, WorkspaceTeamParameters $parameters, array $options = [])
    {
        if (!in_array(Options::REFRESH_UUID, $options)) {
            $parameters->setUuid($data['id']);
        }

        $this->sipe('selfRegistration', 'setSelfRegistration', $data, $parameters);
        $this->sipe('selfUnregistration', 'setSelfUnregistration', $data, $parameters);
        $this->sipe('publicDirectory', 'setIsPublic', $data, $parameters);
        $this->sipe('deletableDirectory', 'setDirDeletable', $data, $parameters);
        $this->sipe('allowedTeams', 'setMaxTeams', $data, $parameters);

        if (isset($data['workspace']['uuid'])) {
            $workspace = $this->workspaceRepo->findOneBy(['uuid' => $data['workspace']['uuid']]);

            if ($workspace) {
                $parameters->setWorkspace($workspace);
            }
        }

        return $parameters;
    }
698789
public function publish(array $message, array $options = [])
    {
        if (!$this->em) {
            return '';
        }

        $doctrineMessage = new DoctrineMessage();
        $doctrineMessage->setQueue($this->name)
                ->setDelivered(false)
                ->setMessage($message)
                ->setLength(strlen(serialize($message)));

        $this->em->persist($doctrineMessage);
        $this->em->flush();

        return (string) $doctrineMessage->getId();
    }