本文整理汇总了PHP中Test::setName方法的典型用法代码示例。如果您正苦于以下问题:PHP Test::setName方法的具体用法?PHP Test::setName怎么用?PHP Test::setName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test
的用法示例。
在下文中一共展示了Test::setName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start_new_test
private function start_new_test($name)
{
$this->current_test = $this->getNewTestObject();
$this->current_test->setName($name);
$this->tests[] = $this->current_test;
return $this->current_test;
}
示例2: getName
{
$this->name = $name;
$this->test = $name;
return $this;
}
public function getName()
{
return $this->name;
}
public function getTest()
{
return $this->test;
}
}
$test = new Test(['a' => 'a', 'b' => 'b']);
$test->setName('ok');
$ser = serialize($test);
$unSer = unserialize($ser);
var_dump($unSer->getName());
// null
var_dump($unSer->getTest());
// ok
var_dump($unSer);
// php 7.0.3
/**
* D:\htdocs\array_object.php:36:null
*
* D:\htdocs\array_object.php:37:
* object(Test)[2]
* private 'name' => string 'ok' (length=2)
* private 'storage' (ArrayObject) =>
示例3: Test
<?php
include './GettersAndSetters.php';
class Test extends GettersAndSetters
{
/**
* @method String getName() return the value of attribute name
* @method $this setName($value) set the value in attribute name
*/
protected $name;
/**
* @method String getNameWithUnderscore() return the value of attribute name
* @method $this setNameWithUnderscore($value) set the value in attribute name
*/
protected $_nameWithUnderscore;
}
$test = new Test();
$test->setName("Name");
$test->setNameWithUnderscore("Name");
echo $test->getName();
echo "<br>";
echo $test->getNameWithUnderscore();
示例4: test
function test($name, callable $testCode)
{
$this->tests[] = $test = new Test();
$test->setName($name);
$test->setCode($testCode);
}