当前位置: 首页>>代码示例>>PHP>>正文


PHP MyClass类代码示例

本文整理汇总了PHP中MyClass的典型用法代码示例。如果您正苦于以下问题:PHP MyClass类的具体用法?PHP MyClass怎么用?PHP MyClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MyClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testHalfNegativeUneven

 public function testHalfNegativeUneven()
 {
     $c = new MyClass();
     $var1 = -5;
     $result = $c->half($var1);
     $expectedResult = -2.5;
     $this->assertEquals($expectedResult, $result, "The half of -5 should be -2.5");
 }
开发者ID:BrobakS,项目名称:phpTest,代码行数:8,代码来源:MyClassTest.php

示例2: foo

function foo()
{
    global $root;
    //if ($result)
    if ($row = $db->sql_fetchrow($result)) {
        include $root . 'test113c.php';
        $f = new MyClass();
        $f->bar();
    }
}
开发者ID:9Yg1rxeSeha90ZU1,项目名称:pixy,代码行数:10,代码来源:test113b.php

示例3: testBasic

 function testBasic()
 {
     $o = new MyClass();
     $o->prop1 = "hej";
     $o->prop2 = '';
     // verify empty props are not shown
     $o->prop3 = "hallå";
     $o->setPrivProp("bah");
     // verify private props are not shown
     $this->assertEquals("prop1: hej\n" . "prop3: hallå", \Core3\Helper\Object::describePropertiesWithValues($o));
 }
开发者ID:martinlindhe,项目名称:core3,代码行数:11,代码来源:ObjectTest.php

示例4: conditionallyPluralize

 public static function conditionallyPluralize($string, $count)
 {
     if (intval($count) !== 0) {
         return MyClass::pluralize($string);
     }
     return $string;
 }
开发者ID:carriercomm,项目名称:Sipen-CMS,代码行数:7,代码来源:inflect.class.php

示例5: printHello

 function printHello()
 {
     MyClass::printHello();
     print "MyClass2::printHello() " . $this->Hello;
     print "MyClass2::printHello() " . $this->Bar;
     print "MyClass2::printHello() " . $this->Foo;
 }
开发者ID:SandyS1,项目名称:presentations,代码行数:7,代码来源:privateprotected.php

示例6: csvHandler

 public function csvHandler(GearmanJob $job)
 {
     $mass = unserialize($job->workload());
     self::$count = count($mass[1]) - 1;
     usort($mass, array('MyClass', 'cmp'));
     $off = array_slice($mass, 0, 1000);
     self::$collection[] = $off;
 }
开发者ID:nycmic,项目名称:csv,代码行数:8,代码来源:myClass.php

示例7: printHello

 function printHello()
 {
     MyClass::printHello();
     print "MyClass2::printHello() " . $this->public;
     print "MyClass2::printHello() " . $this->protected;
     print "MyClass2::printHello() " . $this->protected2;
     /* Will result in a Fatal Error: */
     //print "MyClass2::printHello() " . $this->private; /* Fatal Error */
 }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:9,代码来源:test136.php

示例8: testMockingClassMethod

 public function testMockingClassMethod()
 {
     $this->initAspectMock();
     //$mock = \AspectMock\Test::double(MyClass::class, ['myClassMethod' => 'a']);
     $mock = \AspectMock\Test::double('MyClass', ['myClassMethod' => 'a']);
     //$mock = \AspectMock\Test::double('\MyClass', ['myClassMethod' => 'a']);
     $classMethodReturned = MyClass::myClassMethod();
     // Extra verification to see if the AspectMock double is actually being run yet:
     //$mock->verifyInvoked('myClassMethod');
     $this->assertEquals('a', $classMethodReturned);
 }
开发者ID:samsonasik,项目名称:AspectMock-test,代码行数:11,代码来源:MyClassTest.php

示例9: actionDefault

 function actionDefault()
 {
     // Create new instance of MyClass and execute test()
     $my = new MyClass();
     $res = $my->test();
     // Check for errors
     while ($err = YDError::catchError($res)) {
         YDDebugUtil::dump($err, '$err');
         $err->level;
         // 3
         $err->name;
         // fatal
         $err->message;
         // We couldn't do something
         $err->file;
         // ..../MyClass.php
         $err->line;
         // x
     }
     // We can also set automatic reporting
     YDError::reporting(YD_ERROR_FATAL);
     // display fatals, warnings and notices
     YDError::reporting(YD_ERROR_WARNING);
     // display warnings and notices
     YDError::reporting(YD_ERROR_NOTICE);
     // display notices
     YDError::reporting(YD_ERROR_NONE);
     // don't display errors
     // We can get the last errors array
     $errors = YDError::getAll();
     YDDebugUtil::dump($errors, '$errors');
     // Or we could dump the error
     if ($err = YDError::catchError($res)) {
         $err->dump();
     }
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:36,代码来源:error.php

示例10: h

        echo '<p>渡されたデータはnullでした。</p>';
        return;
    }
    // 渡されたデータの内容を表示する
    echo '<p>渡されたデータ内容を表示する:</p>';
    echo '<ul>';
    echo '<li>id: ' . h($data->id) . '</li>';
    echo '<li>text: ' . h($data->text) . '</li>';
    echo '</ul>';
}
// MyData型のオブジェクトを生成する
$data = new MyData();
$data->id = 1;
$data->text = '今日は雨が降っています。';
// MyClassのインスタンスを作成し、MyData型のオブジェクトをセットする
$myclass = new MyClass();
$myclass->setData($data);
// show_data_details()関数に、MyData型のオブジェクトを渡す
echo '<p>show_data_details()関数に$dataを渡した場合:</p>';
show_data_details($data);
// show_data_details()関数に、nullを渡す
echo '<p>show_data_details()関数にnullを渡した場合:</p>';
show_data_details(null);
function h($string)
{
    return htmlspecialchars($string, ENT_QUOTES, 'UTF-8');
}
?>
</div>
</body>
</html>
开发者ID:sxyr318,项目名称:study_php,代码行数:31,代码来源:164_type_hinting.php

示例11: MyProtected

    protected function MyProtected()
    {
    }
    // Объявление закрытого метода
    private function MyPrivate()
    {
    }
    // Это общедоступный метод
    function Foo()
    {
        $this->MyPublic();
        $this->MyProtected();
        $this->MyPrivate();
    }
}
$myclass = new MyClass();
$myclass->MyPublic();
// Работает
//$myclass->MyProtected(); // Неисправимая ошибка
// $myclass->MyPrivate(); // Неисправимая ошибка
$myclass->Foo();
// Работает общий, защищенный и закрытый
/**
 * Определение MyClass2
 */
class MyClass2 extends MyClass
{
    // Это общедоступный метод
    function Foo2()
    {
        $this->MyPublic();
开发者ID:AntonBeletsky,项目名称:LearnPHPdocs,代码行数:31,代码来源:Visibility.php

示例12: loadCode

<?php

class MyClass
{
    public static function loadCode($p)
    {
        return include $p;
    }
}
MyClass::loadCode('file-which-does-not-exist-on-purpose.php');
开发者ID:badlamer,项目名称:hhvm,代码行数:10,代码来源:bug43958.php

示例13: error_reporting

Aliasing on conflicting method should not cover up conflict.
--FILE--
<?php 
error_reporting(E_ALL);
trait Hello
{
    public function sayHello()
    {
        echo 'Hello';
    }
}
trait World
{
    public function sayHello()
    {
        echo ' World!';
    }
}
class MyClass
{
    use Hello, World {
        sayHello as sayWorld;
    }
}
$o = new MyClass();
$o->sayHello();
$o->sayWorld();
?>
--EXPECTF--

Fatal error: Trait method 'sayHello' has not been applied, because there are collision in 'World' and 'Hello' traits on MyClass in %s on line %d, position %d
开发者ID:lihuibin,项目名称:jphp,代码行数:31,代码来源:language011.php

示例14: doWork

<?php

require '../vendor/autoload.php';
class MyClass
{
    use \atk4\core\HookTrait;
    public function doWork()
    {
        $this->hook('beforeWork');
        echo "Doing work\n";
        $this->hook('afterWork');
    }
}
$c = new MyClass();
$c->addHook('afterWork', function () {
    echo "HOOKed on work\n";
});
$c->doWork();
开发者ID:atk4,项目名称:core,代码行数:18,代码来源:test2.php

示例15: MyClass

<?php

require 'MyClass.php';
$myClass = new MyClass();
echo $myClass->hello();
开发者ID:goCavs,项目名称:MyPHPEvaluation,代码行数:5,代码来源:index.php


注:本文中的MyClass类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。