Skip to content

Commit

Permalink
run php-cs-fixer
Browse files Browse the repository at this point in the history
  • Loading branch information
sualko committed Jul 26, 2017
1 parent d7fd8c7 commit d167561
Show file tree
Hide file tree
Showing 60 changed files with 2,334 additions and 2,137 deletions.
142 changes: 71 additions & 71 deletions lib/ContactsMenu/Providers/ChatProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,75 +11,75 @@
class ChatProvider implements IProvider
{

/** @var IActionFactory */
private $actionFactory;

/** @var IURLGenerator */
private $urlGenerator;

/** @var IL10N */
private $l10n;

/**
* @param IActionFactory $actionFactory
* @param IURLGenerator $urlGenerator
* @param IL10N $l10n
*/
public function __construct(IActionFactory $actionFactory, IURLGenerator $urlGenerator, IL10N $l10n)
{
$this->actionFactory = $actionFactory;
$this->urlGenerator = $urlGenerator;
$this->l10n = $l10n;
}

/**
* @param IEntry $entry
*/
public function process(IEntry $entry)
{
$uid = $entry->getProperty('UID');
$iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('ojsxc', 'actions/chat.svg'));
$localIm = null;

if (is_null($uid)) {
// Nothing to do
return;
}

if ($entry->getProperty('isLocalSystemBook') === true) {
// internal user

$config = \OC::$server->getConfig();
$serverType = $config->getAppValue('ojsxc', 'serverType', 'external');

if ($serverType === 'internal') {
$domain = \OC::$server->getRequest()->getServerHost();
} else {
$domain = trim($config->getAppValue('ojsxc', 'xmppDomain'));
}

if ($domain !== "") {
$localIm = $uid.'@'.$domain;
$chatUrl = 'xmpp:'.$localIm;

$action = $this->actionFactory->newLinkAction($iconUrl, $localIm, $chatUrl);
$entry->addAction($action);
}
}

$imProperties = $entry->getProperty('IMPP');

if (!is_null($imProperties)) {
foreach ($imProperties as $externalIm) {
if (!preg_match("/^[a-z0-9\.\-_]+@[a-z0-9\.\-_]+$/i", $externalIm) || $externalIm === $localIm) {
continue;
}

$chatUrl = 'xmpp:'.$externalIm;

$action = $this->actionFactory->newLinkAction($iconUrl, $externalIm, $chatUrl);
$entry->addAction($action);
}
}
}
/** @var IActionFactory */
private $actionFactory;

/** @var IURLGenerator */
private $urlGenerator;

/** @var IL10N */
private $l10n;

/**
* @param IActionFactory $actionFactory
* @param IURLGenerator $urlGenerator
* @param IL10N $l10n
*/
public function __construct(IActionFactory $actionFactory, IURLGenerator $urlGenerator, IL10N $l10n)
{
$this->actionFactory = $actionFactory;
$this->urlGenerator = $urlGenerator;
$this->l10n = $l10n;
}

/**
* @param IEntry $entry
*/
public function process(IEntry $entry)
{
$uid = $entry->getProperty('UID');
$iconUrl = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('ojsxc', 'actions/chat.svg'));
$localIm = null;

if (is_null($uid)) {
// Nothing to do
return;
}

if ($entry->getProperty('isLocalSystemBook') === true) {
// internal user

$config = \OC::$server->getConfig();
$serverType = $config->getAppValue('ojsxc', 'serverType', 'external');

if ($serverType === 'internal') {
$domain = \OC::$server->getRequest()->getServerHost();
} else {
$domain = trim($config->getAppValue('ojsxc', 'xmppDomain'));
}

if ($domain !== "") {
$localIm = $uid.'@'.$domain;
$chatUrl = 'xmpp:'.$localIm;

$action = $this->actionFactory->newLinkAction($iconUrl, $localIm, $chatUrl);
$entry->addAction($action);
}
}

$imProperties = $entry->getProperty('IMPP');

if (!is_null($imProperties)) {
foreach ($imProperties as $externalIm) {
if (!preg_match("/^[a-z0-9\.\-_]+@[a-z0-9\.\-_]+$/i", $externalIm) || $externalIm === $localIm) {
continue;
}

$chatUrl = 'xmpp:'.$externalIm;

$action = $this->actionFactory->newLinkAction($iconUrl, $externalIm, $chatUrl);
$entry->addAction($action);
}
}
}
}
Loading

0 comments on commit d167561

Please sign in to comment.