protected function ApiTestAbstract::readProperty in TMGMT Translator Smartling 8.2
Same name in this branch
- 8.2 api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::readProperty()
- 8.2 vendor/smartling/api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::readProperty()
Same name and namespace in other branches
- 8.4 vendor/smartling/api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::readProperty()
- 8.3 vendor/smartling/api-sdk-php/tests/unit/ApiTestAbstract.php \Smartling\Tests\Unit\ApiTestAbstract::readProperty()
Reads protected or private property of given object.
Parameters
BaseApiAbstract $object: Object with protected or private property.
string $propertyName: Name of the property to access.
Return value
mixed Value of read property.
File
- api-sdk-php/
tests/ unit/ ApiTestAbstract.php, line 173
Class
- ApiTestAbstract
- Class ApiTestAbstract @package Smartling\Tests
Namespace
Smartling\Tests\UnitCode
protected function readProperty($object, $propertyName) {
$reflection = new \ReflectionClass(get_class($object));
$property = $reflection
->getProperty($propertyName);
$property
->setAccessible(true);
return $property
->getValue($object);
}