/**
  * @param string $message
  * @return bool
  */
 public function consume($message)
 {
     $emailTo = $message['to'];
     $body = $message['body'];
     $emailFrom = $this->configProvider->getConfig()['defaultEmail'];
     $nameFrom = $this->configProvider->getConfig()['defaultName'];
     $this->sender->send($emailTo, 'someSubject', $body, $nameFrom, $emailFrom, $body);
 }
Пример #2
0
 /**
  * Unset config instance from the singleton, so next time the config will be get, it will be recreated from
  * current (and possibly adjusted to our needs) environment variables.
  */
 public static function unsetConfigInstance()
 {
     $configProviderSingleton = ConfigProvider::getInstance();
     $reflection = new \ReflectionClass($configProviderSingleton);
     $instance = $reflection->getProperty('config');
     $instance->setAccessible(true);
     $instance->setValue($configProviderSingleton, null);
     $instance->setAccessible(false);
 }
Пример #3
0
 /**
  * Method to determine if the logged-in user has already voted for this article.
  *
  * @return bool True if they have voted already, false otherwise
  *
  * @since 1.0
  *
  * @throws Alpha\Exception\AlphaException
  */
 public function checkUserVoted()
 {
     $config = ConfigProvider::getInstance();
     $sessionProvider = $config->get('session.provider.name');
     $session = SessionProviderFactory::getInstance($sessionProvider);
     // just going to return true if nobody is logged in
     if ($session->get('currentUser') == null) {
         return true;
     }
     $userID = $session->get('currentUser')->getID();
     $vote = new ArticleVote();
     $sqlQuery = 'SELECT COUNT(*) AS usersVote FROM ' . $vote->getTableName() . " WHERE articleOID='" . $this->OID . "' AND personOID='" . $userID . "';";
     $result = $this->query($sqlQuery);
     if (!isset($result[0])) {
         throw new AlphaException('Failed to check if the current user voted for the article [' . $this->OID . '], query [' . $sqlQuery . ']');
         return false;
     }
     $row = $result[0];
     if ($row['usersVote'] == '0') {
         return false;
     } else {
         return true;
     }
 }
 /**
  * Return configuration for zend-mvc applications.
  *
  * @return array
  */
 public function getConfig()
 {
     $provider = new ConfigProvider();
     return ['service_manager' => $provider->getDependencyConfig()];
 }
Пример #5
0
 /**
  * Provide default configuration.
  *
  * @param return array
  */
 public function getConfig()
 {
     $provider = new ConfigProvider();
     return ['controller_plugins' => $provider->getPluginConfig(), 'service_manager' => $provider->getDependencyConfig(), 'console' => ['router' => ['routes' => []]]];
 }
Пример #6
0
 /**
  * Provide application configuration.
  *
  * @return array
  */
 public function getConfig()
 {
     $provider = new ConfigProvider();
     return $provider->getConfig();
 }
Пример #7
0
 /**
  * Provide default router configuration.
  *
  * @return array
  */
 public function getConfig()
 {
     $provider = new ConfigProvider();
     return ['service_manager' => $provider->getDependencyConfig(), 'route_manager' => $provider->getRouteManagerConfig(), 'router' => ['routes' => []]];
 }
Пример #8
0
 /**
  * Provide configuration for an application integrating PamiModule.
  *
  * @return array
  */
 public function getConfig()
 {
     $provider = new ConfigProvider();
     return ['pami_module' => ['connection' => [], 'client' => []], 'pami_module_factories' => ['connection' => Service\ConnectionFactory::class, 'client' => Service\ClientFactory::class], 'service_manager' => $provider->getDependencyConfig()];
 }
Пример #9
0
<?php

//debug
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
//end debug
require 'configProvider.php';
$cfg = new ConfigProvider();
$cfg->printConfig();
echo "<br>";
echo $cfg->getCfg("conf1");
Пример #10
0
 /**
  * @return array
  */
 public function getConfig()
 {
     $provider = new ConfigProvider();
     return ['textstorage' => $provider->getTextStorageConfig(), 'service_manager' => $provider->getDependencyConfig()];
 }
Пример #11
0
 /**
  * Return zend-i18n configuration for zend-mvc application.
  *
  * @return array
  */
 public function getConfig()
 {
     $provider = new ConfigProvider();
     return ['filters' => $provider->getFilterConfig(), 'service_manager' => $provider->getDependencyConfig(), 'validators' => $provider->getValidatorConfig(), 'view_helpers' => $provider->getViewHelperConfig()];
 }
Пример #12
0
 /**
  * @param ConfigProvider $provider
  *
  * @return $this
  */
 public function addProvider(ConfigProvider $provider)
 {
     $this->providers[$provider->getScope()] = $provider;
     return $this;
 }