コード例 #1
0
ファイル: Injector.php プロジェクト: realweb-team/pstub
 /**
  * Replace all stubs in method's body
  *
  * @param string $body
  * @return string|boolean - new body, or false, if no replacement was needed
  */
 private function replaceWithStubsIn($body)
 {
     $stubsList = $this->stub->getStubsList();
     $classes = array_keys($stubsList);
     $stubs = array_values($stubsList);
     $needReplacement = false;
     foreach ($classes as $stubbedClass) {
         if (strpos($body, $stubbedClass) !== false) {
             $needReplacement = true;
             break;
         }
     }
     if (!$needReplacement) {
         return false;
     }
     $newBody = str_replace($classes, $stubs, $body);
     return $newBody;
 }
コード例 #2
0
ファイル: Stub.php プロジェクト: realweb-team/pstub
 /**
  * Set default stub suffix to be used in all stubs
  *
  * @param string $suffix
  */
 public static function setDefaultStubSuffix($suffix)
 {
     self::$defaultStubSuffix = $suffix;
 }