DataSift_Definition::getCreatedAt PHP Method

getCreatedAt() public method

Returns the date when the stream was first created. If the created at date has not yet been obtained it validates the definition first.
public getCreatedAt ( ) : integer
return integer The date as a unix timestamp.
    public function getCreatedAt()
    {
        if ($this->_csdl === false) {
            throw new DataSift_Exception_InvalidData('Created at date not available');
        }
        if ($this->_created_at === false) {
            // Catch any compilation errors so they don't pass up to the caller
            try {
                $this->validate();
            } catch (DataSift_Exception_CompileFailed $e) {
            }
        }
        return $this->_created_at;
    }

Usage Example

Esempio n. 1
0
 public function testGetCreatedAt()
 {
     $response = array('response_code' => 200, 'data' => array('created_at' => date('Y-m-d H:i:s', time()), 'dpu' => 10), 'rate_limit' => 200, 'rate_limit_remaining' => 150);
     DataSift_MockApiClient::setResponse($response);
     $def = new DataSift_Definition($this->user, testdata('definition'));
     $this->assertEquals(testdata('definition'), $def->get(), 'Definition string not set correctly');
     $this->assertEquals(strtotime($response['data']['created_at']), $def->getCreatedAt(), 'The created_at date is incorrect');
 }
All Usage Examples Of DataSift_Definition::getCreatedAt