From fea8580204adbf5f7a7d45b5ca54607e949ab65d Mon Sep 17 00:00:00 2001 From: Kavalar Date: Fri, 17 May 2024 14:16:29 +0300 Subject: [PATCH] first --- .gitignore | 1 + index.php | 24 ++++++++++++++++++++++++ src/Animal.php | 30 ++++++++++++++++++++++++++++++ src/Cat.php | 27 +++++++++++++++++++++++++++ src/Cow.php | 13 +++++++++++++ src/Dog.php | 23 +++++++++++++++++++++++ src/interfaces/TypeInterface.php | 9 +++++++++ src/traits/Jumping.php | 13 +++++++++++++ 8 files changed, 140 insertions(+) create mode 100644 .gitignore create mode 100644 index.php create mode 100644 src/Animal.php create mode 100644 src/Cat.php create mode 100644 src/Cow.php create mode 100644 src/Dog.php create mode 100644 src/interfaces/TypeInterface.php create mode 100644 src/traits/Jumping.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..0e70474 --- /dev/null +++ b/index.php @@ -0,0 +1,24 @@ +makeSound(); +$cat->makeSound(); +$cow->makeSound(); + +$dog->makeJump(); +$cat->makeJump(); + +echo "
";
+print_r($cat);
+
+$cat->meow();
+$dog->woof();
\ No newline at end of file
diff --git a/src/Animal.php b/src/Animal.php
new file mode 100644
index 0000000..972ae5a
--- /dev/null
+++ b/src/Animal.php
@@ -0,0 +1,30 @@
+paws++;
+    }
+
+    abstract public function makeSound(): void;
+
+    /**
+     * @return void
+     */
+    public function beating(): void
+    {
+        $this->heart++;
+    }
+
+}
\ No newline at end of file
diff --git a/src/Cat.php b/src/Cat.php
new file mode 100644
index 0000000..6a9cceb
--- /dev/null
+++ b/src/Cat.php
@@ -0,0 +1,27 @@
+type . " - shipe shipe shipe shipe shipe shipe shipe shipe shipe shipe shipe  
"; + } + + public function meow() + { + echo $this->type . " - meow meow meow meow meow meow meow meow meow meow meow meow meow meow
"; + } + +} \ No newline at end of file diff --git a/src/Cow.php b/src/Cow.php new file mode 100644 index 0000000..5192112 --- /dev/null +++ b/src/Cow.php @@ -0,0 +1,13 @@ +type . " - mu mu mu mu mu mu mu mu mu mu mu mu mu mu mu mu mu
"; + } +} \ No newline at end of file diff --git a/src/Dog.php b/src/Dog.php new file mode 100644 index 0000000..e043371 --- /dev/null +++ b/src/Dog.php @@ -0,0 +1,23 @@ +type . " - growling growling growling growling growling growling growling growling
"; + } + + public function woof() + { + echo $this->type . " - woof woof woof woof woof woof woof woof woof woof woof woof woof woof
"; + } + +} \ No newline at end of file diff --git a/src/interfaces/TypeInterface.php b/src/interfaces/TypeInterface.php new file mode 100644 index 0000000..8d0b677 --- /dev/null +++ b/src/interfaces/TypeInterface.php @@ -0,0 +1,9 @@ +type . " - jump jump jump jump jump jump jump jump jump jump
"; + } + +} \ No newline at end of file