@ -0,0 +1,12 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					function format_bytes($bytes, $is_drive_size = true, $beforeunit = '', $afterunit = '') | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						$btype = ($is_drive_size === true) ? 1000 : 1024; | 
				
			||||
 | 
					    $labels = array('B','KB','MB','GB','TB'); | 
				
			||||
 | 
					    for($x = 0; $bytes >= $btype && $x < (count($labels) - 1); $bytes /= $btype, $x++); // use 1000 rather than 1024 to simulate HD size not real size | 
				
			||||
 | 
					    if($labels[$x] == "TB") return(round($bytes, 3).$beforeunit.$labels[$x].$afterunit); | 
				
			||||
 | 
					    elseif($labels[$x] == "GB") return(round($bytes, 2).$beforeunit.$labels[$x].$afterunit); | 
				
			||||
 | 
					    elseif($labels[$x] == "MB") return(round($bytes, 2).$beforeunit.$labels[$x].$afterunit); | 
				
			||||
 | 
					    else return(round($bytes, 0).$beforeunit.$labels[$x].$afterunit); | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,11 @@ | 
				
			|||||
 | 
					<?php namespace App\SupportedApps\Contracts; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					interface Livestats { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function configDetails(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function testConfig(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function executeConfig(); | 
				
			||||
 | 
					     | 
				
			||||
 | 
					} | 
				
			||||
@ -1,16 +1,70 @@ | 
				
			|||||
<?php namespace App\SupportedApps; | 
					<?php namespace App\SupportedApps; | 
				
			||||
 | 
					
 | 
				
			||||
class Pihole implements Contracts\Applications { | 
					use GuzzleHttp\Exception\GuzzleException; | 
				
			||||
 | 
					use GuzzleHttp\Client; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class Pihole implements Contracts\Applications, Contracts\Livestats { | 
				
			||||
    public function defaultColour() | 
					    public function defaultColour() | 
				
			||||
    { | 
					    { | 
				
			||||
        return '#222'; | 
					        return '#352222'; | 
				
			||||
    } | 
					    } | 
				
			||||
    public function icon() | 
					    public function icon() | 
				
			||||
    { | 
					    { | 
				
			||||
        return 'supportedapps/pihole.png'; | 
					        return 'supportedapps/pihole.png'; | 
				
			||||
    } | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
    public function configDetails() | 
					    public function configDetails() | 
				
			||||
    { | 
					    { | 
				
			||||
        return null; | 
					        return 'pihole'; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function testConfig() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $res = $this->buildRequest(); | 
				
			||||
 | 
					        switch($res->getStatusCode()) { | 
				
			||||
 | 
					            case 200: | 
				
			||||
 | 
					                echo 'Successfully connected to the API'; | 
				
			||||
 | 
					                break; | 
				
			||||
 | 
					            case 401: | 
				
			||||
 | 
					                echo 'Failed: Invalid credentials'; | 
				
			||||
 | 
					                break; | 
				
			||||
 | 
					            case 404: | 
				
			||||
 | 
					                echo 'Failed: Please make sure your URL is correct and that there is a trailing slash'; | 
				
			||||
 | 
					                break; | 
				
			||||
 | 
					            default: | 
				
			||||
 | 
					                echo 'Something went wrong... Code: '.$res->getStatusCode(); | 
				
			||||
 | 
					                break; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function executeConfig() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $output = ''; | 
				
			||||
 | 
					        $res = $this->buildRequest(); | 
				
			||||
 | 
					        $data = json_decode($res->getBody()); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					            $output = ' | 
				
			||||
 | 
					            <ul class="livestats"> | 
				
			||||
 | 
					                <li><span class="title">Domains<br />Blocked</span><strong>'.$data->domains_being_blocked.'</strong></li> | 
				
			||||
 | 
					                <li><span class="title">Blocked<br />Today</span><strong>'.$data->ads_blocked_today.'</span></strong></li> | 
				
			||||
 | 
					            </ul> | 
				
			||||
 | 
					            '; | 
				
			||||
 | 
					        return $output; | 
				
			||||
    } | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function buildRequest() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $config = $this->config; | 
				
			||||
 | 
					        $url = $config->url; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $api_url = $url.'admin/api.php'; | 
				
			||||
 | 
					        //die( $api_url.' --- '); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $client = new Client(['http_errors' => false]); | 
				
			||||
 | 
					        $res = $client->request('GET', $api_url); | 
				
			||||
 | 
					        return $res; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
} | 
					} | 
				
			||||
@ -0,0 +1,82 @@ | 
				
			|||||
 | 
					<?php namespace App\SupportedApps; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use GuzzleHttp\Exception\GuzzleException; | 
				
			||||
 | 
					use GuzzleHttp\Client; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class Sabnzbd implements Contracts\Applications, Contracts\Livestats { | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public $config; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function defaultColour() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        return '#3e3924'; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					    public function icon() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        return 'supportedapps/sabnzbd.png'; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					    public function configDetails() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        return 'sabnzbd'; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					    public function testConfig() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $res = $this->buildRequest('queue'); | 
				
			||||
 | 
					        switch($res->getStatusCode()) { | 
				
			||||
 | 
					            case 200: | 
				
			||||
 | 
					                $data = json_decode($res->getBody()); | 
				
			||||
 | 
					                if(isset($data->error) && !empty($data->error)) { | 
				
			||||
 | 
					                    echo 'Failed: '.$data->error; | 
				
			||||
 | 
					                } else { | 
				
			||||
 | 
					                    echo 'Successfully connected to the API'; | 
				
			||||
 | 
					                } | 
				
			||||
 | 
					                break; | 
				
			||||
 | 
					            case 401: | 
				
			||||
 | 
					                echo 'Failed: Invalid credentials'; | 
				
			||||
 | 
					                break; | 
				
			||||
 | 
					            case 404: | 
				
			||||
 | 
					                echo 'Failed: Please make sure your URL is correct and that there is a trailing slash'; | 
				
			||||
 | 
					                break; | 
				
			||||
 | 
					            default: | 
				
			||||
 | 
					                echo 'Something went wrong... Code: '.$res->getStatusCode(); | 
				
			||||
 | 
					                break; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					    public function executeConfig() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $output = ''; | 
				
			||||
 | 
					        $res = $this->buildRequest('queue'); | 
				
			||||
 | 
					        $data = json_decode($res->getBody()); | 
				
			||||
 | 
					        //$data->result->RemainingSizeMB = '10000000'; | 
				
			||||
 | 
					        //$data->result->DownloadRate = '100000000'; | 
				
			||||
 | 
					        $size = $data->queue->mbleft; | 
				
			||||
 | 
					        $rate = $data->queue->kbpersec; | 
				
			||||
 | 
					        $queue_size = format_bytes($size*1000*1000, false, ' <span>', '</span>'); | 
				
			||||
 | 
					        $current_speed = format_bytes($rate*1000, false, ' <span>'); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        if($size > 0 || $rate > 0) { | 
				
			||||
 | 
					            $output = ' | 
				
			||||
 | 
					            <ul class="livestats"> | 
				
			||||
 | 
					                <li><span class="title">Queue</span><strong>'.$queue_size.'</strong></li> | 
				
			||||
 | 
					                <li><span class="title">Speed</span><strong>'.$current_speed.'/s</span></strong></li> | 
				
			||||
 | 
					            </ul> | 
				
			||||
 | 
					            '; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        return $output; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					    public function buildRequest($endpoint) | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $config = $this->config; | 
				
			||||
 | 
					        $url = $config->url; | 
				
			||||
 | 
					        $apikey = $config->apikey; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $api_url = $url.'api?output=json&apikey='.$apikey.'&mode='.$endpoint; | 
				
			||||
 | 
					        //die( $api_url.' --- '); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $client = new Client(['http_errors' => false]); | 
				
			||||
 | 
					        $res = $client->request('GET', $api_url); | 
				
			||||
 | 
					        return $res; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					    | 
				
			||||
 | 
					} | 
				
			||||
| 
		 After Width: | Height: | Size: 11 KiB  | 
| 
		 After Width: | Height: | Size: 14 KiB  | 
| 
		 After Width: | Height: | Size: 2.1 KiB  | 
| 
		 After Width: | Height: | Size: 2.5 KiB  | 
| 
		 After Width: | Height: | Size: 5.1 KiB  | 
| 
		 After Width: | Height: | Size: 7.1 KiB  | 
| 
		 After Width: | Height: | Size: 8.6 KiB  | 
| 
		 After Width: | Height: | Size: 9.1 KiB  | 
| 
		 After Width: | Height: | Size: 11 KiB  | 
| 
		 After Width: | Height: | Size: 12 KiB  | 
| 
		 After Width: | Height: | Size: 15 KiB  | 
| 
		 After Width: | Height: | Size: 3.0 KiB  | 
| 
		 After Width: | Height: | Size: 3.1 KiB  | 
| 
		 After Width: | Height: | Size: 5.1 KiB  | 
| 
		 After Width: | Height: | Size: 5.4 KiB  | 
| 
		 After Width: | Height: | Size: 15 KiB  | 
| 
		 After Width: | Height: | Size: 15 KiB  | 
@ -0,0 +1,2 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<browserconfig><msapplication><tile><square70x70logo src="/ms-icon-70x70.png"/><square150x150logo src="/ms-icon-150x150.png"/><square310x310logo src="/ms-icon-310x310.png"/><TileColor>#ffffff</TileColor></tile></msapplication></browserconfig> | 
				
			||||
| 
		 After Width: | Height: | Size: 1.3 KiB  | 
| 
		 After Width: | Height: | Size: 1.9 KiB  | 
| 
		 After Width: | Height: | Size: 7.1 KiB  | 
| 
		 Before Width: | Height: | Size: 0 B After Width: | Height: | Size: 1.1 KiB  | 
| 
		 After Width: | Height: | Size: 5.2 KiB  | 
@ -0,0 +1,41 @@ | 
				
			|||||
 | 
					{ | 
				
			||||
 | 
					 "name": "App", | 
				
			||||
 | 
					 "icons": [ | 
				
			||||
 | 
					  { | 
				
			||||
 | 
					   "src": "\/android-icon-36x36.png", | 
				
			||||
 | 
					   "sizes": "36x36", | 
				
			||||
 | 
					   "type": "image\/png", | 
				
			||||
 | 
					   "density": "0.75" | 
				
			||||
 | 
					  }, | 
				
			||||
 | 
					  { | 
				
			||||
 | 
					   "src": "\/android-icon-48x48.png", | 
				
			||||
 | 
					   "sizes": "48x48", | 
				
			||||
 | 
					   "type": "image\/png", | 
				
			||||
 | 
					   "density": "1.0" | 
				
			||||
 | 
					  }, | 
				
			||||
 | 
					  { | 
				
			||||
 | 
					   "src": "\/android-icon-72x72.png", | 
				
			||||
 | 
					   "sizes": "72x72", | 
				
			||||
 | 
					   "type": "image\/png", | 
				
			||||
 | 
					   "density": "1.5" | 
				
			||||
 | 
					  }, | 
				
			||||
 | 
					  { | 
				
			||||
 | 
					   "src": "\/android-icon-96x96.png", | 
				
			||||
 | 
					   "sizes": "96x96", | 
				
			||||
 | 
					   "type": "image\/png", | 
				
			||||
 | 
					   "density": "2.0" | 
				
			||||
 | 
					  }, | 
				
			||||
 | 
					  { | 
				
			||||
 | 
					   "src": "\/android-icon-144x144.png", | 
				
			||||
 | 
					   "sizes": "144x144", | 
				
			||||
 | 
					   "type": "image\/png", | 
				
			||||
 | 
					   "density": "3.0" | 
				
			||||
 | 
					  }, | 
				
			||||
 | 
					  { | 
				
			||||
 | 
					   "src": "\/android-icon-192x192.png", | 
				
			||||
 | 
					   "sizes": "192x192", | 
				
			||||
 | 
					   "type": "image\/png", | 
				
			||||
 | 
					   "density": "4.0" | 
				
			||||
 | 
					  } | 
				
			||||
 | 
					 ] | 
				
			||||
 | 
					} | 
				
			||||
@ -1,4 +1,4 @@ | 
				
			|||||
{ | 
					{ | 
				
			||||
    "/css/app.css": "/css/app.css?id=4f5b9f5ba0f1f57405c8", | 
					    "/css/app.css": "/css/app.css?id=414b5bf109854d80b269", | 
				
			||||
    "/js/app.js": "/js/app.js?id=559585a774e3f088503a" | 
					    "/js/app.js": "/js/app.js?id=b38be2e595ece6fcef81" | 
				
			||||
} | 
					} | 
				
			||||
| 
		 After Width: | Height: | Size: 11 KiB  | 
| 
		 After Width: | Height: | Size: 12 KiB  | 
| 
		 After Width: | Height: | Size: 31 KiB  | 
| 
		 After Width: | Height: | Size: 5.0 KiB  | 
@ -0,0 +1,78 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					return [ | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    /* | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | App Language Lines | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    */ | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'settings.system' => 'Sistem', | 
				
			||||
 | 
					    'settings.appearance' => 'Görünüm', | 
				
			||||
 | 
					    'settings.miscellaneous' => 'Çeşitli', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'settings.version' => 'Versiyon', | 
				
			||||
 | 
					    'settings.background_image' => 'Arkaplan Resmi', | 
				
			||||
 | 
					    'settings.homepage_search' => 'Anasayfa Arama', | 
				
			||||
 | 
					    'settings.search_provider' => 'Arama Motoru', | 
				
			||||
 | 
					    'settings.language' => 'Dil', | 
				
			||||
 | 
					    'settings.reset' => 'Varsayılana Geri Dön', | 
				
			||||
 | 
					    'settings.remove' => 'Sil', | 
				
			||||
 | 
					    'settings.search' => 'ara', | 
				
			||||
 | 
					    'settings.no_items' => 'Öğe bulunamadı', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'settings.label' => 'Etiket',     | 
				
			||||
 | 
					    'settings.value' => 'Değer',     | 
				
			||||
 | 
					    'settings.edit' => 'Düzenle',     | 
				
			||||
 | 
					    'settings.view' => 'Görüntüle',     | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'options.none' => '- ayarlanmadı -', | 
				
			||||
 | 
					    'options.google' => 'Google', | 
				
			||||
 | 
					    'options.ddg' => 'DuckDuckGo', | 
				
			||||
 | 
					    'options.bing' => 'Bing', | 
				
			||||
 | 
					    'options.yes' => 'Evet', | 
				
			||||
 | 
					    'options.no' => 'Hayır', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'buttons.save' => 'Kaydet', | 
				
			||||
 | 
					    'buttons.cancel' => 'İptal', | 
				
			||||
 | 
					    'buttons.add' => 'Ekle', | 
				
			||||
 | 
					    'buttons.upload' => 'Dosya yükle', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'dash.pin_item' => 'Ana panele iğnele', | 
				
			||||
 | 
					    'dash.no_apps' => 'Ana panele iğneli öğeler, :link1 or :link2', | 
				
			||||
 | 
					    'dash.link1' => 'Yeni uygulama ekle', | 
				
			||||
 | 
					    'dash.link2' => 'Ana panele iğnele', | 
				
			||||
 | 
					    'dash.pinned_items' => 'İğnelenen öğeler', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'apps.app_list' => 'Uygulama listesi', | 
				
			||||
 | 
					    'apps.view_trash' => 'Çöpü görüntüle', | 
				
			||||
 | 
					    'apps.add_application' => 'Uygulama ekle', | 
				
			||||
 | 
					    'apps.application_name' => 'Uygulama adı', | 
				
			||||
 | 
					    'apps.colour' => 'Renk', | 
				
			||||
 | 
					    'apps.icon' => 'İkon', | 
				
			||||
 | 
					    'apps.pinned' => 'İğneli', | 
				
			||||
 | 
					    'apps.title' => 'Başlık', | 
				
			||||
 | 
					    'apps.hex' => 'Hex değeri', | 
				
			||||
 | 
					    'apps.username' => 'Kullanıcı adı', | 
				
			||||
 | 
					    'apps.password' => 'Şifre', | 
				
			||||
 | 
					    'apps.config' => 'Yapılandırma', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'url' => 'Adres', | 
				
			||||
 | 
					    'title' => 'Başlık', | 
				
			||||
 | 
					    'delete' => 'Sil',     | 
				
			||||
 | 
					    'optional' => 'İsteğe bağlı',     | 
				
			||||
 | 
					    'restore' => 'Eski haline getir',     | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'alert.success.item_created' => 'Öğe yaratıldı', | 
				
			||||
 | 
					    'alert.success.item_updated' => 'Öğe güncellendi', | 
				
			||||
 | 
					    'alert.success.item_deleted' => 'Öğe silindi', | 
				
			||||
 | 
					    'alert.success.item_restored' => 'Öğe eski haline getirildi', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'alert.success.setting_updated' => 'Ayarlama kaydedildi', | 
				
			||||
 | 
					    'alert.error.not_exist' => 'Böyle bir seçenek yok.', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					     | 
				
			||||
 | 
					]; | 
				
			||||
@ -0,0 +1,19 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					return [ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /* | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | Authentication Language Lines | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    | The following language lines are used during authentication for various | 
				
			||||
 | 
					    | messages that we need to display to the user. You are free to modify | 
				
			||||
 | 
					    | these language lines according to your application's requirements. | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    */ | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'failed' => 'Kimlik bilgileri doğru değil.', | 
				
			||||
 | 
					    'throttle' => 'Çok fazla girişim. :seconds saniye sonra tekrar deneyin.', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					]; | 
				
			||||
@ -0,0 +1,19 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					return [ | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    /* | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | Pagination Language Lines | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    | The following language lines are used by the paginator library to build | 
				
			||||
 | 
					    | the simple pagination links. You are free to change them to anything | 
				
			||||
 | 
					    | you want to customize your views to better match your application. | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    */ | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'previous' => '« Önceki', | 
				
			||||
 | 
					    'next' => 'Sonraki »', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					]; | 
				
			||||
@ -0,0 +1,22 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					return [ | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    /* | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | Password Reset Language Lines | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    | The following language lines are the default lines which match reasons | 
				
			||||
 | 
					    | that are given by the password broker for a password update attempt | 
				
			||||
 | 
					    | has failed, such as for an invalid token or invalid new password. | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    */ | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'password' => 'Şifre en az altı karakter olmalı ve onaylamasına uymalıdır.', | 
				
			||||
 | 
					    'reset' => 'Şifreniz sıfırlandı!', | 
				
			||||
 | 
					    'sent' => 'Şifre sıfırlama bağlantısı eposta adresinize yollandı!', | 
				
			||||
 | 
					    'token' => 'Şifre sıfırlama simgesi geçerli değil.', | 
				
			||||
 | 
					    'user' => "Adresle ilişkili kullanıcı adı bulunamadı.", | 
				
			||||
 | 
					     | 
				
			||||
 | 
					]; | 
				
			||||
@ -0,0 +1,121 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					return [ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /* | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | Validation Language Lines | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    | The following language lines contain the default error messages used by | 
				
			||||
 | 
					    | the validator class. Some of these rules have multiple versions such | 
				
			||||
 | 
					    | as the size rules. Feel free to tweak each of these messages here. | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    */ | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'accepted'             => ':attribute kabul edilmelidir.', | 
				
			||||
 | 
					    'active_url'           => ':attribute geçerli bir adres değil.', | 
				
			||||
 | 
					    'after'                => ':attribute :date tarihinden sonra olmalıdır.', | 
				
			||||
 | 
					    'after_or_equal'       => ':attribute :date ile aynı veya daha sonra tarihte olmalıdır.', | 
				
			||||
 | 
					    'alpha'                => ':attribute sadece harf içerebilir.', | 
				
			||||
 | 
					    'alpha_dash'           => ':attribute sadece harf, rakam, veya tire içerebilir.', | 
				
			||||
 | 
					    'alpha_num'            => ':attribute sadece harf ve rakam içerebilir.', | 
				
			||||
 | 
					    'array'                => ':attribute dizi olmalıdır.', | 
				
			||||
 | 
					    'before'               => ':attribute :date tarihinden önce olmalıdır.', | 
				
			||||
 | 
					    'before_or_equal'      => ':attribute :date ile aynı ya da daha önce tarihte olmalıdır.', | 
				
			||||
 | 
					    'between'              => [ | 
				
			||||
 | 
					        'numeric' => ':attribute :min ile :max arasında olmalıdır.', | 
				
			||||
 | 
					        'file'    => ':attribute :min ile :max kilobayt arasında olmalıdır.', | 
				
			||||
 | 
					        'string'  => ':attribute :min ile :max arasında karakter içermelidir.', | 
				
			||||
 | 
					        'array'   => ':attribute :min ile :max arasi öğe içermelidir.', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'boolean'              => ':attribute alanı doğru ya da yanlış olmalıdır.', | 
				
			||||
 | 
					    'confirmed'            => ':attribute onaylamasına uymuyor.', | 
				
			||||
 | 
					    'date'                 => ':attribute geçerli bir tarih değil.', | 
				
			||||
 | 
					    'date_format'          => ':attribute :format düzenine uymuyor.', | 
				
			||||
 | 
					    'different'            => ':attribute ve :other farklı olmalı.', | 
				
			||||
 | 
					    'digits'               => ':attribute :digits haneli olmalıdır.', | 
				
			||||
 | 
					    'digits_between'       => ':attribute :min ile :max arası haneli olmalıdır.', | 
				
			||||
 | 
					    'dimensions'           => ':attribute resim boyutları geçersiz.', | 
				
			||||
 | 
					    'distinct'             => ':attribute alan değeri zaten mevcut.', | 
				
			||||
 | 
					    'email'                => ':attribute geçerli bir eposta adresi olmalıdır.', | 
				
			||||
 | 
					    'exists'               => 'Seçili :attribute geçersiz.', | 
				
			||||
 | 
					    'file'                 => ':attribute dosya olmalıdır.', | 
				
			||||
 | 
					    'filled'               => ':attribute alanı değer içermelidir.', | 
				
			||||
 | 
					    'image'                => ':attribute resim olmalıdır.', | 
				
			||||
 | 
					    'in'                   => 'Seçili :attribute geçersiz.', | 
				
			||||
 | 
					    'in_array'             => ':attribute :other içinde bulunmalıdır.', | 
				
			||||
 | 
					    'integer'              => ':attribute tamsayı olmalıdır.', | 
				
			||||
 | 
					    'ip'                   => ':attribute geçerli IP adresi olmalıdır.', | 
				
			||||
 | 
					    'ipv4'                 => ':attribute geçerli IPv4 adresi olmalıdır.', | 
				
			||||
 | 
					    'ipv6'                 => ':attribute geçerli IPv6 adresi olmalıdır.', | 
				
			||||
 | 
					    'json'                 => ':attribute geçerli JSON dizesi olmalıdır.', | 
				
			||||
 | 
					    'max'                  => [ | 
				
			||||
 | 
					        'numeric' => ':attribute :max sayısından küçük olmalıdır.', | 
				
			||||
 | 
					        'file'    => ':attribute :max kilobayttan küçük olmalıdır.', | 
				
			||||
 | 
					        'string'  => ':attribute :max haneden az olmalıdır.', | 
				
			||||
 | 
					        'array'   => ':attribute :max öğeden az içermelidir.', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'mimes'                => 'Geçerli :attribute dosya tipi: :values.', | 
				
			||||
 | 
					    'mimetypes'            => 'Geçerli :attribute dosya tipi: :values.', | 
				
			||||
 | 
					    'min'                  => [ | 
				
			||||
 | 
					        'numeric' => ':attribute en az :min olmalıdır.', | 
				
			||||
 | 
					        'file'    => ':attribute en az :min kilobayt olmalıdır.', | 
				
			||||
 | 
					        'string'  => ':attribute en az :min haneli olmalıdır.', | 
				
			||||
 | 
					        'array'   => ':attribute en az :min öğe içermelidir.', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'not_in'               => 'Seçili :attribute geçersiz.', | 
				
			||||
 | 
					    'numeric'              => ':attribute sayı olmalıdır.', | 
				
			||||
 | 
					    'present'              => ':attribute alanı dolu olmalı.', | 
				
			||||
 | 
					    'regex'                => ':attribute düzeni geçersiz.', | 
				
			||||
 | 
					    'required'             => ':attribute alanı gereklidir.', | 
				
			||||
 | 
					    'required_if'          => ':other :value ise :attribute alanı gereklidir.', | 
				
			||||
 | 
					    'required_unless'      => ':other :values içinde değilse :attribute alanı gereklidir.', | 
				
			||||
 | 
					    'required_with'        => ':values dolu ise :attribute alanı gereklidir.', | 
				
			||||
 | 
					    'required_with_all'    => ':values dolu ise :attribute alanı gereklidir.', | 
				
			||||
 | 
					    'required_without'     => ':values boş ise :attribute alanı gereklidir.', | 
				
			||||
 | 
					    'required_without_all' => ':values değerlerinin tamamı boş ise :attribute alanı gereklidir.', | 
				
			||||
 | 
					    'same'                 => ':attribute ve :other aynı olmalı.', | 
				
			||||
 | 
					    'size'                 => [ | 
				
			||||
 | 
					        'numeric' => ':attribute :size olmalıdır.', | 
				
			||||
 | 
					        'file'    => ':attribute :size kilobayt olmalıdır.', | 
				
			||||
 | 
					        'string'  => ':attribute :size haneli olmalıdır.', | 
				
			||||
 | 
					        'array'   => ':attribute :size öğe içermelidir.', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'string'               => ':attribute dize olmalıdır.', | 
				
			||||
 | 
					    'timezone'             => ':attribute geçerli bir zaman dilimi olmalıdır.', | 
				
			||||
 | 
					    'unique'               => ':attribute zaten kullanımda.', | 
				
			||||
 | 
					    'uploaded'             => ':attribute yüklenemedi.', | 
				
			||||
 | 
					    'url'                  => ':attribute düzeni geçersiz.', | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    /* | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | Custom Validation Language Lines | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    | Here you may specify custom validation messages for attributes using the | 
				
			||||
 | 
					    | convention "attribute.rule" to name the lines. This makes it quick to | 
				
			||||
 | 
					    | specify a specific custom language line for a given attribute rule. | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    */ | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'custom' => [ | 
				
			||||
 | 
					        'attribute-name' => [ | 
				
			||||
 | 
					            'rule-name' => 'custom-message', | 
				
			||||
 | 
					        ], | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    /* | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | Custom Validation Attributes | 
				
			||||
 | 
					    |-------------------------------------------------------------------------- | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    | The following language lines are used to swap attribute place-holders | 
				
			||||
 | 
					    | with something more reader friendly such as E-Mail Address instead | 
				
			||||
 | 
					    | of "email". This simply helps us make messages a little cleaner. | 
				
			||||
 | 
					    | | 
				
			||||
 | 
					    */ | 
				
			||||
 | 
					     | 
				
			||||
 | 
					    'attributes' => [], | 
				
			||||
 | 
					     | 
				
			||||
 | 
					]; | 
				
			||||
@ -1,12 +1,15 @@ | 
				
			|||||
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }})</h2> | 
					<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }})</h2> | 
				
			||||
<div class="items"> | 
					<div class="items"> | 
				
			||||
    <input type="hidden" name="config[type]" value="\App\SupportedApps\Nzbget" /> | 
					    <input type="hidden" data-config="type" class="config-item" name="config[type]" value="\App\SupportedApps\Nzbget" /> | 
				
			||||
    <div class="input"> | 
					    <div class="input"> | 
				
			||||
        <label>{{ __('app.apps.username') }}</label> | 
					        <label>{{ __('app.apps.username') }}</label> | 
				
			||||
        {!! Form::text('config[username]', null, array('placeholder' => __('app.apps.username'), 'class' => 'form-control')) !!} | 
					        {!! Form::text('config[username]', null, array('placeholder' => __('app.apps.username'), 'data-config' => 'username', 'class' => 'form-control config-item')) !!} | 
				
			||||
    </div> | 
					    </div> | 
				
			||||
    <div class="input"> | 
					    <div class="input"> | 
				
			||||
        <label>{{ __('app.apps.password') }}</label> | 
					        <label>{{ __('app.apps.password') }}</label> | 
				
			||||
        {!! Form::text('config[password]', null, array('placeholder' =>  __('app.apps.password'), 'class' => 'form-control')) !!} | 
					        {!! Form::text('config[password]', null, array('placeholder' =>  __('app.apps.password'), 'data-config' => 'password', 'class' => 'form-control config-item')) !!} | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					    <div class="input"> | 
				
			||||
 | 
					        <button style="margin-top: 32px;" class="btn test" id="test_config">Test</button> | 
				
			||||
    </div> | 
					    </div> | 
				
			||||
</div> | 
					</div> | 
				
			||||
@ -0,0 +1,21 @@ | 
				
			|||||
 | 
					<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }})</h2> | 
				
			||||
 | 
					<div class="items"> | 
				
			||||
 | 
					    <input type="hidden" data-config="type" class="config-item" name="config[type]" value="\App\SupportedApps\Pihole" /> | 
				
			||||
 | 
					    <input type="hidden" data-config="dataonly" class="config-item" name="config[dataonly]" value="1" /> | 
				
			||||
 | 
					    <div class="input"> | 
				
			||||
 | 
					        <label>{{ __('app.apps.enable') }}</label> | 
				
			||||
 | 
					        {!! Form::hidden('config[enabled]', '0') !!} | 
				
			||||
 | 
					        <label class="switch"> | 
				
			||||
 | 
					            <?php | 
				
			||||
 | 
					            $checked = false; | 
				
			||||
 | 
					            if(isset($item->config->enabled) && (bool)$item->config->enabled === true) $checked = true; | 
				
			||||
 | 
					            $set_checked = ($checked) ? ' checked="checked"' : ''; | 
				
			||||
 | 
					            ?> | 
				
			||||
 | 
					            <input type="checkbox" name="config[enabled]" value="1"<?php echo $set_checked;?> /> | 
				
			||||
 | 
					            <span class="slider round"></span> | 
				
			||||
 | 
					        </label> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					    <div class="input"> | 
				
			||||
 | 
					        <button style="margin-top: 32px;" class="btn test" id="test_config">Test</button> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</div> | 
				
			||||
@ -0,0 +1,11 @@ | 
				
			|||||
 | 
					<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }})</h2> | 
				
			||||
 | 
					<div class="items"> | 
				
			||||
 | 
					    <input type="hidden" data-config="type" class="config-item" name="config[type]" value="\App\SupportedApps\Sabnzbd" /> | 
				
			||||
 | 
					    <div class="input"> | 
				
			||||
 | 
					        <label>{{ __('app.apps.apikey') }}</label> | 
				
			||||
 | 
					        {!! Form::text('config[apikey]', null, array('placeholder' => __('app.apps.apikey'), 'data-config' => 'apikey', 'class' => 'form-control config-item')) !!} | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					    <div class="input"> | 
				
			||||
 | 
					        <button style="margin-top: 32px;" class="btn test" id="test_config">Test</button> | 
				
			||||
 | 
					    </div> | 
				
			||||
 | 
					</div> | 
				
			||||
| 
		 After Width: | Height: | Size: 3.8 KiB  | 
@ -0,0 +1,5 @@ | 
				
			|||||
 | 
					phpunit.xml | 
				
			||||
 | 
					composer.lock | 
				
			||||
 | 
					build | 
				
			||||
 | 
					vendor | 
				
			||||
 | 
					coverage.clover | 
				
			||||
@ -0,0 +1,46 @@ | 
				
			|||||
 | 
					before_commands: | 
				
			||||
 | 
					    - "composer install --prefer-source" | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					tools: | 
				
			||||
 | 
					    external_code_coverage: | 
				
			||||
 | 
					        timeout: 600 | 
				
			||||
 | 
					    php_code_coverage: | 
				
			||||
 | 
					        enabled: true | 
				
			||||
 | 
					        test_command: ./vendor/bin/phpunit | 
				
			||||
 | 
					    php_code_sniffer: | 
				
			||||
 | 
					        enabled: true | 
				
			||||
 | 
					        config: | 
				
			||||
 | 
					            standard: PSR2 | 
				
			||||
 | 
					        filter: | 
				
			||||
 | 
					            paths: ["src/*", "tests/*"] | 
				
			||||
 | 
					    php_cpd: | 
				
			||||
 | 
					        enabled: true | 
				
			||||
 | 
					        excluded_dirs: ["build/*", "tests", "vendor"] | 
				
			||||
 | 
					    php_cs_fixer: | 
				
			||||
 | 
					        enabled: true | 
				
			||||
 | 
					        config: | 
				
			||||
 | 
					            level: all | 
				
			||||
 | 
					        filter: | 
				
			||||
 | 
					            paths: ["src/*", "tests/*"] | 
				
			||||
 | 
					    php_loc: | 
				
			||||
 | 
					        enabled: true | 
				
			||||
 | 
					        excluded_dirs: ["build", "tests", "vendor"] | 
				
			||||
 | 
					    php_mess_detector: | 
				
			||||
 | 
					        enabled: true | 
				
			||||
 | 
					        config: | 
				
			||||
 | 
					            ruleset: phpmd.xml.dist | 
				
			||||
 | 
					            design_rules: { eval_expression: false } | 
				
			||||
 | 
					        filter: | 
				
			||||
 | 
					            paths: ["src/*"] | 
				
			||||
 | 
					    php_pdepend: | 
				
			||||
 | 
					        enabled: true | 
				
			||||
 | 
					        excluded_dirs: ["build", "tests", "vendor"] | 
				
			||||
 | 
					    php_analyzer: | 
				
			||||
 | 
					        enabled: true | 
				
			||||
 | 
					        filter: | 
				
			||||
 | 
					            paths: ["src/*", "tests/*"] | 
				
			||||
 | 
					    php_hhvm: | 
				
			||||
 | 
					        enabled: true | 
				
			||||
 | 
					        filter: | 
				
			||||
 | 
					            paths: ["src/*", "tests/*"] | 
				
			||||
 | 
					    sensiolabs_security_checker: true | 
				
			||||
@ -0,0 +1,14 @@ | 
				
			|||||
 | 
					#!/bin/sh | 
				
			||||
 | 
					set -x | 
				
			||||
 | 
					if [ "$TRAVIS_PHP_VERSION" = 'hhvm' ] || [ "$TRAVIS_PHP_VERSION" = 'hhvm-nightly' ] ; then | 
				
			||||
 | 
					    curl -sS https://getcomposer.org/installer > composer-installer.php | 
				
			||||
 | 
					    hhvm composer-installer.php | 
				
			||||
 | 
					    hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 composer.phar update --prefer-source | 
				
			||||
 | 
					elif [ "$TRAVIS_PHP_VERSION" = '5.3.3' ] ; then | 
				
			||||
 | 
					    composer self-update | 
				
			||||
 | 
					    composer update --prefer-source --no-dev | 
				
			||||
 | 
					    composer dump-autoload | 
				
			||||
 | 
					else | 
				
			||||
 | 
					    composer self-update | 
				
			||||
 | 
					    composer update --prefer-source | 
				
			||||
 | 
					fi | 
				
			||||
@ -0,0 +1,22 @@ | 
				
			|||||
 | 
					language: php | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					php: | 
				
			||||
 | 
					  - 5.3.3 | 
				
			||||
 | 
					  - 5.3 | 
				
			||||
 | 
					  - 5.4 | 
				
			||||
 | 
					  - 5.5 | 
				
			||||
 | 
					  - 5.6 | 
				
			||||
 | 
					  - hhvm | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					before_script: | 
				
			||||
 | 
					  - ./.travis.install.sh | 
				
			||||
 | 
					  - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then PHPUNIT_FLAGS="--coverage-clover coverage.clover"; else PHPUNIT_FLAGS=""; fi | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					script: | 
				
			||||
 | 
					  - if [ $TRAVIS_PHP_VERSION = '5.3.3' ]; then phpunit; fi | 
				
			||||
 | 
					  - if [ $TRAVIS_PHP_VERSION != '5.3.3' ]; then ./vendor/bin/phpunit $PHPUNIT_FLAGS; fi | 
				
			||||
 | 
					  - if [ $TRAVIS_PHP_VERSION != '5.3.3' ]; then ./vendor/bin/phpcs --standard=PSR2 ./src/ ./tests/; fi | 
				
			||||
 | 
					  - if [[ $TRAVIS_PHP_VERSION != '5.3.3' && $TRAVIS_PHP_VERSION != '5.4.29' && $TRAVIS_PHP_VERSION != '5.5.13' ]]; then php -n ./vendor/bin/athletic -p ./tests/DoctrineTest/InstantiatorPerformance/ -f GroupedFormatter; fi | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					after_script: | 
				
			||||
 | 
					  - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then wget https://scrutinizer-ci.com/ocular.phar; php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi | 
				
			||||
@ -0,0 +1,27 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="UTF-8" ?> | 
				
			||||
 | 
					<ruleset | 
				
			||||
 | 
					    name="Instantiator rules" | 
				
			||||
 | 
					    xmlns="http://pmd.sf.net/ruleset/1.0.0" | 
				
			||||
 | 
					    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | 
				
			||||
 | 
					    xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" | 
				
			||||
 | 
					    xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd" | 
				
			||||
 | 
					> | 
				
			||||
 | 
					    <rule ref="rulesets/cleancode.xml"> | 
				
			||||
 | 
					        <!-- static access is used for caching purposes --> | 
				
			||||
 | 
					        <exclude name="StaticAccess"/> | 
				
			||||
 | 
					    </rule> | 
				
			||||
 | 
					    <rule ref="rulesets/codesize.xml"/> | 
				
			||||
 | 
					    <rule ref="rulesets/controversial.xml"/> | 
				
			||||
 | 
					    <rule ref="rulesets/design.xml"/> | 
				
			||||
 | 
					    <rule ref="rulesets/naming.xml"/> | 
				
			||||
 | 
					    <rule ref="rulesets/unusedcode.xml"/> | 
				
			||||
 | 
					    <rule | 
				
			||||
 | 
					        name="NPathComplexity" | 
				
			||||
 | 
					        message="The {0} {1}() has an NPath complexity of {2}. The configured NPath complexity threshold is {3}." | 
				
			||||
 | 
					        class="PHP_PMD_Rule_Design_NpathComplexity" | 
				
			||||
 | 
					    > | 
				
			||||
 | 
					        <properties> | 
				
			||||
 | 
					            <property name="minimum" description="The npath reporting threshold" value="10"/> | 
				
			||||
 | 
					        </properties> | 
				
			||||
 | 
					    </rule> | 
				
			||||
 | 
					</ruleset> | 
				
			||||
@ -0,0 +1,22 @@ | 
				
			|||||
 | 
					<?xml version="1.0"?> | 
				
			||||
 | 
					<phpunit | 
				
			||||
 | 
					    bootstrap="./vendor/autoload.php" | 
				
			||||
 | 
					    colors="true" | 
				
			||||
 | 
					    convertErrorsToExceptions="true" | 
				
			||||
 | 
					    convertNoticesToExceptions="true" | 
				
			||||
 | 
					    convertWarningsToExceptions="true" | 
				
			||||
 | 
					    verbose="true" | 
				
			||||
 | 
					    stopOnFailure="false" | 
				
			||||
 | 
					    processIsolation="false" | 
				
			||||
 | 
					    backupGlobals="false" | 
				
			||||
 | 
					    syntaxCheck="true" | 
				
			||||
 | 
					> | 
				
			||||
 | 
					    <testsuite name="Doctrine\Instantiator tests"> | 
				
			||||
 | 
					        <directory>./tests/DoctrineTest/InstantiatorTest</directory> | 
				
			||||
 | 
					    </testsuite> | 
				
			||||
 | 
					    <filter> | 
				
			||||
 | 
					        <whitelist addUncoveredFilesFromWhitelist="true"> | 
				
			||||
 | 
					            <directory suffix=".php">./src</directory> | 
				
			||||
 | 
					        </whitelist> | 
				
			||||
 | 
					    </filter> | 
				
			||||
 | 
					</phpunit> | 
				
			||||
@ -0,0 +1,96 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorPerformance; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use Athletic\AthleticEvent; | 
				
			||||
 | 
					use Doctrine\Instantiator\Instantiator; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * Performance tests for {@see \Doctrine\Instantiator\Instantiator} | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					class InstantiatorPerformanceEvent extends AthleticEvent | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @var \Doctrine\Instantiator\Instantiator | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    private $instantiator; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * {@inheritDoc} | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    protected function setUp() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $this->instantiator = new Instantiator(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->instantiator->instantiate(__CLASS__); | 
				
			||||
 | 
					        $this->instantiator->instantiate('ArrayObject'); | 
				
			||||
 | 
					        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset'); | 
				
			||||
 | 
					        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset'); | 
				
			||||
 | 
					        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @iterations 20000 | 
				
			||||
 | 
					     * @baseline | 
				
			||||
 | 
					     * @group instantiation | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function testInstantiateSelf() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $this->instantiator->instantiate(__CLASS__); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @iterations 20000 | 
				
			||||
 | 
					     * @group instantiation | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function testInstantiateInternalClass() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $this->instantiator->instantiate('ArrayObject'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @iterations 20000 | 
				
			||||
 | 
					     * @group instantiation | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function testInstantiateSimpleSerializableAssetClass() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @iterations 20000 | 
				
			||||
 | 
					     * @group instantiation | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function testInstantiateSerializableArrayObjectAsset() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @iterations 20000 | 
				
			||||
 | 
					     * @group instantiation | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function testInstantiateUnCloneableAsset() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,83 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorTest\Exception; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use Doctrine\Instantiator\Exception\InvalidArgumentException; | 
				
			||||
 | 
					use PHPUnit_Framework_TestCase; | 
				
			||||
 | 
					use ReflectionClass; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * Tests for {@see \Doctrine\Instantiator\Exception\InvalidArgumentException} | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @covers \Doctrine\Instantiator\Exception\InvalidArgumentException | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					class InvalidArgumentExceptionTest extends PHPUnit_Framework_TestCase | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    public function testFromNonExistingTypeWithNonExistingClass() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $className = __CLASS__ . uniqid(); | 
				
			||||
 | 
					        $exception = InvalidArgumentException::fromNonExistingClass($className); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\InvalidArgumentException', $exception); | 
				
			||||
 | 
					        $this->assertSame('The provided class "' . $className . '" does not exist', $exception->getMessage()); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function testFromNonExistingTypeWithTrait() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        if (PHP_VERSION_ID < 50400) { | 
				
			||||
 | 
					            $this->markTestSkipped('Need at least PHP 5.4.0, as this test requires traits support to run'); | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $exception = InvalidArgumentException::fromNonExistingClass( | 
				
			||||
 | 
					            'DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset' | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->assertSame( | 
				
			||||
 | 
					            'The provided type "DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset" is a trait, ' | 
				
			||||
 | 
					            . 'and can not be instantiated', | 
				
			||||
 | 
					            $exception->getMessage() | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function testFromNonExistingTypeWithInterface() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $exception = InvalidArgumentException::fromNonExistingClass('Doctrine\\Instantiator\\InstantiatorInterface'); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->assertSame( | 
				
			||||
 | 
					            'The provided type "Doctrine\\Instantiator\\InstantiatorInterface" is an interface, ' | 
				
			||||
 | 
					            . 'and can not be instantiated', | 
				
			||||
 | 
					            $exception->getMessage() | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function testFromAbstractClass() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset'); | 
				
			||||
 | 
					        $exception  = InvalidArgumentException::fromAbstractClass($reflection); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->assertSame( | 
				
			||||
 | 
					            'The provided class "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" is abstract, ' | 
				
			||||
 | 
					            . 'and can not be instantiated', | 
				
			||||
 | 
					            $exception->getMessage() | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,69 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorTest\Exception; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use Doctrine\Instantiator\Exception\UnexpectedValueException; | 
				
			||||
 | 
					use Exception; | 
				
			||||
 | 
					use PHPUnit_Framework_TestCase; | 
				
			||||
 | 
					use ReflectionClass; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * Tests for {@see \Doctrine\Instantiator\Exception\UnexpectedValueException} | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @covers \Doctrine\Instantiator\Exception\UnexpectedValueException | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					class UnexpectedValueExceptionTest extends PHPUnit_Framework_TestCase | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    public function testFromSerializationTriggeredException() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $reflectionClass = new ReflectionClass($this); | 
				
			||||
 | 
					        $previous        = new Exception(); | 
				
			||||
 | 
					        $exception       = UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $previous); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\UnexpectedValueException', $exception); | 
				
			||||
 | 
					        $this->assertSame($previous, $exception->getPrevious()); | 
				
			||||
 | 
					        $this->assertSame( | 
				
			||||
 | 
					            'An exception was raised while trying to instantiate an instance of "' | 
				
			||||
 | 
					            . __CLASS__  . '" via un-serialization', | 
				
			||||
 | 
					            $exception->getMessage() | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function testFromUncleanUnSerialization() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $reflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset'); | 
				
			||||
 | 
					        $exception  = UnexpectedValueException::fromUncleanUnSerialization($reflection, 'foo', 123, 'bar', 456); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->assertInstanceOf('Doctrine\\Instantiator\\Exception\\UnexpectedValueException', $exception); | 
				
			||||
 | 
					        $this->assertSame( | 
				
			||||
 | 
					            'Could not produce an instance of "DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset" ' | 
				
			||||
 | 
					            . 'via un-serialization, since an error was triggered in file "bar" at line "456"', | 
				
			||||
 | 
					            $exception->getMessage() | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $previous = $exception->getPrevious(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->assertInstanceOf('Exception', $previous); | 
				
			||||
 | 
					        $this->assertSame('foo', $previous->getMessage()); | 
				
			||||
 | 
					        $this->assertSame(123, $previous->getCode()); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,219 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorTest; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use Doctrine\Instantiator\Exception\UnexpectedValueException; | 
				
			||||
 | 
					use Doctrine\Instantiator\Instantiator; | 
				
			||||
 | 
					use PHPUnit_Framework_TestCase; | 
				
			||||
 | 
					use ReflectionClass; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * Tests for {@see \Doctrine\Instantiator\Instantiator} | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @covers \Doctrine\Instantiator\Instantiator | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					class InstantiatorTest extends PHPUnit_Framework_TestCase | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @var Instantiator | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    private $instantiator; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * {@inheritDoc} | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    protected function setUp() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $this->instantiator = new Instantiator(); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @param string $className | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @dataProvider getInstantiableClasses | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function testCanInstantiate($className) | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $this->assertInstanceOf($className, $this->instantiator->instantiate($className)); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @param string $className | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @dataProvider getInstantiableClasses | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function testInstantiatesSeparateInstances($className) | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $instance1 = $this->instantiator->instantiate($className); | 
				
			||||
 | 
					        $instance2 = $this->instantiator->instantiate($className); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->assertEquals($instance1, $instance2); | 
				
			||||
 | 
					        $this->assertNotSame($instance1, $instance2); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function testExceptionOnUnSerializationException() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        if (defined('HHVM_VERSION')) { | 
				
			||||
 | 
					            $this->markTestSkipped( | 
				
			||||
 | 
					                'As of facebook/hhvm#3432, HHVM has no PDORow, and therefore ' | 
				
			||||
 | 
					                . ' no internal final classes that cannot be instantiated' | 
				
			||||
 | 
					            ); | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $className = 'DoctrineTest\\InstantiatorTestAsset\\UnserializeExceptionArrayObjectAsset'; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        if (\PHP_VERSION_ID >= 50600) { | 
				
			||||
 | 
					            $className = 'PDORow'; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        if (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513) { | 
				
			||||
 | 
					            $className = 'DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset'; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->setExpectedException('Doctrine\\Instantiator\\Exception\\UnexpectedValueException'); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->instantiator->instantiate($className); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function testNoticeOnUnSerializationException() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        if (\PHP_VERSION_ID >= 50600) { | 
				
			||||
 | 
					            $this->markTestSkipped( | 
				
			||||
 | 
					                'PHP 5.6 supports `ReflectionClass#newInstanceWithoutConstructor()` for some internal classes' | 
				
			||||
 | 
					            ); | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        try { | 
				
			||||
 | 
					            $this->instantiator->instantiate('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset'); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					            $this->fail('No exception was raised'); | 
				
			||||
 | 
					        } catch (UnexpectedValueException $exception) { | 
				
			||||
 | 
					            $wakeUpNoticesReflection = new ReflectionClass('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset'); | 
				
			||||
 | 
					            $previous                = $exception->getPrevious(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					            $this->assertInstanceOf('Exception', $previous); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					            // in PHP 5.4.29 and PHP 5.5.13, this case is not a notice, but an exception being thrown | 
				
			||||
 | 
					            if (! (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513)) { | 
				
			||||
 | 
					                $this->assertSame( | 
				
			||||
 | 
					                    'Could not produce an instance of "DoctrineTest\\InstantiatorTestAsset\WakeUpNoticesAsset" ' | 
				
			||||
 | 
					                    . 'via un-serialization, since an error was triggered in file "' | 
				
			||||
 | 
					                    . $wakeUpNoticesReflection->getFileName() . '" at line "36"', | 
				
			||||
 | 
					                    $exception->getMessage() | 
				
			||||
 | 
					                ); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					                $this->assertSame('Something went bananas while un-serializing this instance', $previous->getMessage()); | 
				
			||||
 | 
					                $this->assertSame(\E_USER_NOTICE, $previous->getCode()); | 
				
			||||
 | 
					            } | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * @param string $invalidClassName | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @dataProvider getInvalidClassNames | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function testInstantiationFromNonExistingClass($invalidClassName) | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $this->setExpectedException('Doctrine\\Instantiator\\Exception\\InvalidArgumentException'); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->instantiator->instantiate($invalidClassName); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    public function testInstancesAreNotCloned() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $className = 'TemporaryClass' . uniqid(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        eval('namespace ' . __NAMESPACE__ . '; class ' . $className . '{}'); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $instance = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $instance->foo = 'bar'; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $instance2 = $this->instantiator->instantiate(__NAMESPACE__ . '\\' . $className); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $this->assertObjectNotHasAttribute('foo', $instance2); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * Provides a list of instantiable classes (existing) | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @return string[][] | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function getInstantiableClasses() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $classes = array( | 
				
			||||
 | 
					            array('stdClass'), | 
				
			||||
 | 
					            array(__CLASS__), | 
				
			||||
 | 
					            array('Doctrine\\Instantiator\\Instantiator'), | 
				
			||||
 | 
					            array('Exception'), | 
				
			||||
 | 
					            array('PharException'), | 
				
			||||
 | 
					            array('DoctrineTest\\InstantiatorTestAsset\\SimpleSerializableAsset'), | 
				
			||||
 | 
					            array('DoctrineTest\\InstantiatorTestAsset\\ExceptionAsset'), | 
				
			||||
 | 
					            array('DoctrineTest\\InstantiatorTestAsset\\FinalExceptionAsset'), | 
				
			||||
 | 
					            array('DoctrineTest\\InstantiatorTestAsset\\PharExceptionAsset'), | 
				
			||||
 | 
					            array('DoctrineTest\\InstantiatorTestAsset\\UnCloneableAsset'), | 
				
			||||
 | 
					            array('DoctrineTest\\InstantiatorTestAsset\\XMLReaderAsset'), | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        if (\PHP_VERSION_ID === 50429 || \PHP_VERSION_ID === 50513) { | 
				
			||||
 | 
					            return $classes; | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        $classes = array_merge( | 
				
			||||
 | 
					            $classes, | 
				
			||||
 | 
					            array( | 
				
			||||
 | 
					                array('PharException'), | 
				
			||||
 | 
					                array('ArrayObject'), | 
				
			||||
 | 
					                array('DoctrineTest\\InstantiatorTestAsset\\ArrayObjectAsset'), | 
				
			||||
 | 
					                array('DoctrineTest\\InstantiatorTestAsset\\SerializableArrayObjectAsset'), | 
				
			||||
 | 
					            ) | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        if (\PHP_VERSION_ID >= 50600) { | 
				
			||||
 | 
					            $classes[] = array('DoctrineTest\\InstantiatorTestAsset\\WakeUpNoticesAsset'); | 
				
			||||
 | 
					            $classes[] = array('DoctrineTest\\InstantiatorTestAsset\\UnserializeExceptionArrayObjectAsset'); | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        return $classes; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * Provides a list of instantiable classes (existing) | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @return string[][] | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function getInvalidClassNames() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        $classNames = array( | 
				
			||||
 | 
					            array(__CLASS__ . uniqid()), | 
				
			||||
 | 
					            array('Doctrine\\Instantiator\\InstantiatorInterface'), | 
				
			||||
 | 
					            array('DoctrineTest\\InstantiatorTestAsset\\AbstractClassAsset'), | 
				
			||||
 | 
					        ); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        if (\PHP_VERSION_ID >= 50400) { | 
				
			||||
 | 
					            $classNames[] = array('DoctrineTest\\InstantiatorTestAsset\\SimpleTraitAsset'); | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        return $classNames; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,29 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorTestAsset; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * A simple asset for an abstract class | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					abstract class AbstractClassAsset | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,41 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorTestAsset; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use ArrayObject; | 
				
			||||
 | 
					use BadMethodCallException; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * Test asset that extends an internal PHP class | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					class ArrayObjectAsset extends ArrayObject | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * Constructor - should not be called | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @throws BadMethodCallException | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function __construct() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        throw new BadMethodCallException('Not supposed to be called!'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,41 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorTestAsset; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use BadMethodCallException; | 
				
			||||
 | 
					use Exception; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * Test asset that extends an internal PHP base exception | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					class ExceptionAsset extends Exception | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * Constructor - should not be called | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @throws BadMethodCallException | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function __construct() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        throw new BadMethodCallException('Not supposed to be called!'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,41 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorTestAsset; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use BadMethodCallException; | 
				
			||||
 | 
					use Exception; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * Test asset that extends an internal PHP base exception | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					final class FinalExceptionAsset extends Exception | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * Constructor - should not be called | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @throws BadMethodCallException | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function __construct() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        throw new BadMethodCallException('Not supposed to be called!'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,41 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorTestAsset; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use BadMethodCallException; | 
				
			||||
 | 
					use Phar; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * Test asset that extends an internal PHP class | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					class PharAsset extends Phar | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * Constructor - should not be called | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @throws BadMethodCallException | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function __construct() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        throw new BadMethodCallException('Not supposed to be called!'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,44 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorTestAsset; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use BadMethodCallException; | 
				
			||||
 | 
					use PharException; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * Test asset that extends an internal PHP class | 
				
			||||
 | 
					 * This class should be serializable without problems | 
				
			||||
 | 
					 * and without getting the "Erroneous data format for unserializing" | 
				
			||||
 | 
					 * error | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					class PharExceptionAsset extends PharException | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * Constructor - should not be called | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @throws BadMethodCallException | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function __construct() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        throw new BadMethodCallException('Not supposed to be called!'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,62 @@ | 
				
			|||||
 | 
					<?php | 
				
			||||
 | 
					/* | 
				
			||||
 | 
					 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
				
			||||
 | 
					 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 
				
			||||
 | 
					 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 
				
			||||
 | 
					 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 
				
			||||
 | 
					 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 
				
			||||
 | 
					 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
				
			||||
 | 
					 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
				
			||||
 | 
					 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
				
			||||
 | 
					 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 
				
			||||
 | 
					 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * This software consists of voluntary contributions made by many individuals | 
				
			||||
 | 
					 * and is licensed under the MIT license. For more information, see | 
				
			||||
 | 
					 * <http://www.doctrine-project.org>. | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					namespace DoctrineTest\InstantiatorTestAsset; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					use ArrayObject; | 
				
			||||
 | 
					use BadMethodCallException; | 
				
			||||
 | 
					use Serializable; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					/** | 
				
			||||
 | 
					 * Serializable test asset that also extends an internal class | 
				
			||||
 | 
					 * | 
				
			||||
 | 
					 * @author Marco Pivetta <ocramius@gmail.com> | 
				
			||||
 | 
					 */ | 
				
			||||
 | 
					class SerializableArrayObjectAsset extends ArrayObject implements Serializable | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * Constructor - should not be called | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @throws BadMethodCallException | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function __construct() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        throw new BadMethodCallException('Not supposed to be called!'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * {@inheritDoc} | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function serialize() | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        return ''; | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    /** | 
				
			||||
 | 
					     * {@inheritDoc} | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * Should not be called | 
				
			||||
 | 
					     * | 
				
			||||
 | 
					     * @throws BadMethodCallException | 
				
			||||
 | 
					     */ | 
				
			||||
 | 
					    public function unserialize($serialized) | 
				
			||||
 | 
					    { | 
				
			||||
 | 
					        throw new BadMethodCallException('Not supposed to be called!'); | 
				
			||||
 | 
					    } | 
				
			||||
 | 
					} | 
				
			||||