Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Dziedziczenie, czy niezależne komponenty?
q3trm
post 27.04.2013, 08:39:51
Post #1





Grupa: Zarejestrowani
Postów: 83
Pomógł: 1
Dołączył: 26.02.2013

Ostrzeżenie: (0%)
-----


Cześć.


Mam dwie klasy, Pierwsza która pobiera wyniki wykonania odrębnych klasa. Druga klasa Pobierającą wyniki pierwszej klasy i zamieniającą je na dane sesyjne.

Moje pytanie, czy zgodne z zasadami OOP byłoby połączenie, a właściwie wykonanie tych operacji w jednej klasie?


  1.  
  2. class ImageParameter // kąt oraz pliki zdjęć
  3. {
  4. protected $angleImage;
  5. protected $fileImage;
  6.  
  7.  
  8. public function downloandParam(OperationDir $operationDir, AngleImage $angleImage )
  9. {
  10. $this ->fileImage = $operationDir ->getArrayDir();
  11. $this ->angleImage = $angleImage ->getAngleImage();
  12. }
  13.  
  14. public function getAngleImage()
  15. {
  16. return $this ->angleImage;
  17. }
  18. public function getFileImage()
  19. {
  20. return $this ->fileImage;
  21. }
  22. }
  23.  
  24.  
  25. class SessionParameter
  26. {
  27. protected $instance;
  28.  
  29. function takeInstance (ImageParameter $imageParameter)
  30. {
  31. $this ->instance = $imageParameter;
  32. }
  33. function sessionAngleImage()
  34. {
  35. return $_SESSION['angleImage'] = $this ->instance ->getAngleImage();
  36. }
  37. function sessionFileImage()
  38. {
  39. return $_SESSION['fileImage'] = $this ->instance ->getFileImage();
  40. }
  41.  
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 25.07.2025 - 01:52