Piwik\Plugins\Goals\API::getGoal PHP Метод

getGoal() публичный Метод

Return a single goal.
public getGoal ( integer $idSite, integer $idGoal ) : array
$idSite integer
$idGoal integer
Результат array An array of goal attributes.
    public function getGoal($idSite, $idGoal)
    {
        Piwik::checkUserHasViewAccess($idSite);
        $goal = $this->getModel()->getActiveGoal($idSite, $idGoal);
        if (!empty($goal)) {
            return $this->formatGoal($goal);
        }
    }

Usage Example

Пример #1
0
 public function test_getGoal_shouldReturnExistingGoal()
 {
     $idGoal = $this->createAnyGoal();
     $this->assertSame(1, $idGoal);
     $goal = $this->api->getGoal($this->idSite, $idGoal);
     $this->assertEquals(array('idsite' => '1', 'idgoal' => '1', 'name' => 'MyName1', 'match_attribute' => 'event_action', 'pattern' => 'test', 'pattern_type' => 'exact', 'case_sensitive' => '0', 'allow_multiple' => '0', 'revenue' => '0', 'deleted' => '0'), $goal);
 }