2012-09-26 3 views
-1

가능한 모든 답변을 확인했지만 미안하지만 해결할 수 없습니다. 나는 특성이 비 정적 만드는 시도했지만 코드 패드 라인에 오류를 보여줍니다PHP 구문 오류 : 예기치 않은 T_PAAMAYIM_NEKUDOTAYIM on Line 78

$task = new sfCacheClearTask($sfContext::getInstance()->getEventDispatcher(), new sfFormatter()); 

http://codepad.org/zcqrkVoY

의 PL 해결하는 데 도움이 참조하십시오. 감사합니다

class doSokiJobTask extends sfBaseTask { 

    CONST STATUS_PENDING = 0; 
    CONST STATUS_DONE = 1; 
    CONST STATUS_IN_PROGRESS = 2; 
    CONST STATUS_FAILED = 3; 
    CONST STATUS_CANCELLED = 4; 

    CONST TIME_TO_DIE = 60; 

    public $context = null; 
    public $job_name = null; 
    public $done = null; 
    public $status = null; 
    public $start = 0; 

    protected function setJobName($name) { 
     $this->job_name = strtolower($name); 
    } 

    protected function configure() { 
     $this->addArguments(array(
       //new sfCommandArgument('build', sfCommandArgument::REQUIRED, ''), 
     )); 

     $this->addOptions(array(
      new sfCommandOption('env', null, sfCommandOption::PARAMETER_OPTIONAL, 'Env to use', 'dev'), 
      new sfCommandOption('application', null, sfCommandOption::PARAMETER_OPTIONAL, 'Env to use', 'frontend'), 
      new sfCommandOption('job-type', null, sfCommandOption::PARAMETER_REQUIRED, 'Job to be executed', 'job'), 
      new sfCommandOption('daemon', null, sfCommandOption::PARAMETER_REQUIRED, 'Daemon running the job', 0), 
     )); 

     $this->namespace = 'soki'; 
     $this->name = 'job'; 
     $this->briefDescription = 'Lets you run jobs in the background'; 
     $this->detailedDescription = <<<EOF 
The [setup|INFO] task helps run jobs in the background. 
Call it with: 

    [php symfony setup|INFO] 
EOF; 
//$this->filesystem = new sfFilesystem(null, $this->formatter); 
    } 

    protected function execute($arguments = array(), $options = array()) { 
     $this->start = $ts_start = microtime(true); 
     $options['quiet'] = 'true'; 
     $configuration = ProjectConfiguration::getApplicationConfiguration($options['application'], $options['env'], true); 
     new sfDatabaseManager($configuration); 
     $sfContext = sfContext::createInstance($configuration); 
     $this->context = $sfContext; 
     $this->setJobName($options['job-type']); 
     if (true) { 
      $file_logger = new sfFileLogger($this->dispatcher, array('file' => $this->configuration->getRootDir() . '/log/jobs.log')); 
      $this->dispatcher->connect('command.log', array($file_logger, 'listenToLogEvent')); 
     } 

     try { 
      if (!$this->job_name) 
       $this->logSection('INVALID', 'Job Type could not be identified', null, 'ERROR'); 

      switch ($this->job_name) { 
       case 'clear-cache': 
        $task = new sfCacheClearTask($sfContext::getInstance()->getEventDispatcher(), new sfFormatter()); 
        $task->run(array(), array('env' => $options['env'], 'app' => $options['application'])); 
        $this->done = true; 
        break; 
       case 'send-email': 
        $task = new sfProjectSendEmailsTask($sfContext::getInstance()->getEventDispatcher(), new sfFormatter()); 
        $task->run(array(), array('env' => $options['env'], 'application' => $options['application'], 
         'message-limit' => sfConfig::get('sf_spool_message_limit', 25))); 
        $this->done = true; 
        break; 
       case 'chmod': 
        if (!chmod(sfConfig::get('sf_root_dir') . "/data_society", 0755)) 
         throw new Exception('CHMOD failed on ' . sfConfig::get('sf_root_dir') . "/data_society"); 
        $this->done = true; 
        break; 
       case 'disable-install': 
        $this->done = Application::secureSokiInstaller(true); 
        sokiUtil::clearCacheAsync(); 
        break; 
       /* case 'enable-install': 
        Application::secureSokiInstaller(false); 
        sokiUtil::clearCacheAsync(); 
        break; */ 
       case 'job': 
        $this->executeJob($arguments, $options); 
        break; 
       default: 
        $this->logSection('UNKNOWN', 'Job Type could not be identified', null, 'ERROR'); 
        break; 
      } 
      $ts_end = microtime(true); 
      $this->logSection($this->job_name, ($this->done ? 'DONE' : 'FAILED') . ' in ' . round($ts_end - $ts_start) . 's @ ' . $options['env'] . '/' . $options['application'], null, 'INFO'); 
     } catch (Exception $e) { 
      $this->logSection($this->job_name, $e->getMessage(), null, 'ERROR'); 
      throw $e; 
     } 
    } 

답변

5

당신은 인스턴스를 통해을 클래스를 통해 정적 방법, 예를 들어 ClassName::methodName()를 호출하지 $instance::methodName()