public function getInUseMessage()
 {
     $applications = PhabricatorApplication::getAllApplications();
     $applications = mpull($applications, null, 'getPHID');
     $application = idx($applications, $this->getApplicationPHID());
     if ($application) {
         $message = pht('The address %s is configured to be used by the %s Application.', $this->getAddress(), $application->getName());
     } else {
         $message = pht('The address %s is configured to be used by an application.', $this->getAddress());
     }
     return $message;
 }
 private function getQuicksandURIPatternBlacklist()
 {
     $applications = PhabricatorApplication::getAllApplications();
     $blacklist = array();
     foreach ($applications as $application) {
         $blacklist[] = $application->getQuicksandURIPatternBlacklist();
     }
     return array_mergev($blacklist);
 }
 public function loadPage()
 {
     $apps = PhabricatorApplication::getAllApplications();
     if ($this->classes) {
         $classes = array_fuse($this->classes);
         foreach ($apps as $key => $app) {
             if (empty($classes[get_class($app)])) {
                 unset($apps[$key]);
             }
         }
     }
     if ($this->phids) {
         $phids = array_fuse($this->phids);
         foreach ($apps as $key => $app) {
             if (empty($phids[$app->getPHID()])) {
                 unset($apps[$key]);
             }
         }
     }
     if (strlen($this->nameContains)) {
         foreach ($apps as $key => $app) {
             if (stripos($app->getName(), $this->nameContains) === false) {
                 unset($apps[$key]);
             }
         }
     }
     if ($this->installed !== null) {
         foreach ($apps as $key => $app) {
             if ($app->isInstalled() != $this->installed) {
                 unset($apps[$key]);
             }
         }
     }
     if ($this->beta !== null) {
         foreach ($apps as $key => $app) {
             if ($app->isBeta() != $this->beta) {
                 unset($apps[$key]);
             }
         }
     }
     if ($this->firstParty !== null) {
         foreach ($apps as $key => $app) {
             if ($app->isFirstParty() != $this->firstParty) {
                 unset($apps[$key]);
             }
         }
     }
     if ($this->unlisted !== null) {
         foreach ($apps as $key => $app) {
             if ($app->isUnlisted() != $this->unlisted) {
                 unset($apps[$key]);
             }
         }
     }
     if ($this->launchable !== null) {
         foreach ($apps as $key => $app) {
             if ($app->isLaunchable() != $this->launchable) {
                 unset($apps[$key]);
             }
         }
     }
     switch ($this->order) {
         case self::ORDER_NAME:
             $apps = msort($apps, 'getName');
             break;
         case self::ORDER_APPLICATION:
             $apps = $apps;
             break;
         default:
             throw new Exception(pht('Unknown order "%s"!', $this->order));
     }
     return $apps;
 }
 private static function getDefaultObjectTypePolicyMap()
 {
     static $map;
     if ($map === null) {
         $map = array();
         $apps = PhabricatorApplication::getAllApplications();
         foreach ($apps as $app) {
             $map += $app->getDefaultObjectTypePolicyMap();
         }
     }
     return $map;
 }
 public static function getByClass($class_name)
 {
     $selected = null;
     $applications = PhabricatorApplication::getAllApplications();
     foreach ($applications as $application) {
         if (get_class($application) == $class_name) {
             $selected = $application;
             break;
         }
     }
     if (!$selected) {
         throw new Exception("No application '{$class_name}'!");
     }
     return $selected;
 }
 public function testApplicationsInstalled()
 {
     $all = PhabricatorApplication::getAllApplications();
     $installed = PhabricatorApplication::getAllInstalledApplications();
     $this->assertEqual(count($all), count($installed), 'In test cases, all applications should default to installed.');
 }
 public function testGetAllApplications()
 {
     PhabricatorApplication::getAllApplications();
     $this->assertTrue(true);
 }