Gc\Core\Object::hasData PHP Method

hasData() public method

If $key is empty, checks whether there's any data in the object Otherwise checks if the specified attribute is set.
public hasData ( string $key = '' ) : boolean
$key string Key
return boolean
    public function hasData($key = '')
    {
        if (empty($key) || !is_string($key)) {
            return !empty($this->data);
        }
        return array_key_exists($key, $this->data);
    }

Usage Example

Esempio n. 1
0
 /**
  * Test
  *
  * @return void
  */
 public function testHasFakeData()
 {
     $this->assertFalse($this->object->hasData(''));
 }