Skip to content

Commit 5a6cc89

Browse files
authored
feat: Create Container interface and add unit tests (#18)
* add size method * feat: Normalize Interfaces - Refined and standardized interface definitions across the project - Applied Single Responsibility Principle (SRP) to ensure each interface has a clear, singular purpose - Consistent naming conventions were implemented for better readability and maintainability - Added thorough documentation for each interface, including method descriptions and expected behaviors - Organized interfaces within appropriate namespaces to prevent naming collisions and maintain a logical structure - Ensured parameter names in interface methods are consistent with implementing classes - Avoided including constructors in interfaces to maintain flexibility These changes enhance the overall clarity, maintainability, and professional quality of the codebase. * Refactor and Normalize Collection Interface and Implementation - Refactored `Collection` interface for consistency and adherence to best practices. - Ensured all tests are comprehensive and validate the expected behavior. * feat: Add BinaryHeap implementation and comprehensive tests - Implemented BinaryHeap class with support for both min-heap and max-heap operations. - Methods include: add, poll, peek, size, isEmpty, heapifyUp, heapifyDown, swap, and compare. - Created unit tests for BinaryHeap class ensuring 100% coverage. - Tested all key operations: add, poll, peek, heapifyUp, heapifyDown, swap, and compare. - Included edge case tests for min-heap and max-heap scenarios. - Ensured compliance with type safety and PHP 8.0+ features. - Added comprehensive documentation and examples for BinaryHeap usage. This commit enhances the KaririCode Framework by providing a robust, type-safe, and efficient BinaryHeap data structure with extensive unit tests. * docs: Update README files in English and Portuguese - Enhanced the overview and key features sections for clarity and completeness. - Added detailed descriptions for all implemented data structures: - TreeSet - ArrayDeque - ArrayQueue - TreeMap - LinkedList - BinaryHeap - HashMap - Included complexity analysis and key methods for each data structure. - Provided usage examples for each data structure to demonstrate functionality. - Updated installation instructions and requirements. - Updated acknowledgments and roadmap sections. * style: Normalize code formatting and style * feat: Create Container interface and add unit tests - Define the Container interface with methods: `set`, `get`, and `has`. - Implement unit tests for `set` method to ensure services are registered correctly. - Add unit tests for `get` method to verify correct retrieval of services by identifier. - Include unit tests for `has` method to check existence of services in the container. - Normalize the `@category` comments in the interface documentation for consistency. These changes establish a foundational contract for dependency injection within the KaririCode project and ensure robust and reliable functionality through comprehensive testing
1 parent 8aba8e4 commit 5a6cc89

File tree

19 files changed

+106
-17
lines changed

19 files changed

+106
-17
lines changed

src/DataStructure/Behavioral/Comparable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Defines the contract for objects that can be compared.
1111
*
12-
* @category Interfaces
12+
* @category DataStructure\Behavioral
1313
*
1414
* @author Walmir Silva <walmir.silva@kariricode.org>
1515
* @license MIT

src/DataStructure/Behavioral/Countable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Defines the contract for counting elements.
1111
*
12-
* @category Interfaces
12+
* @category DataStructure\Behavioral
1313
*
1414
* @author Walmir Silva <walmir.silva@kariricode.org>
1515
* @license MIT

src/DataStructure/Behavioral/Indexable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Defines the contract for indexed access to elements.
1111
*
12-
* @category Interfaces
12+
* @category DataStructure\Behavioral
1313
*
1414
* @author Walmir Silva <walmir.silva@kariricode.org>
1515
* @license MIT

src/DataStructure/Behavioral/IterableCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Provides the ability to iterate over a collection.
1111
*
12-
* @category Interfaces
12+
* @category DataStructure\Behavioral
1313
*
1414
* @author Walmir Silva <walmir.silva@kariricode.org>
1515
* @license MIT

src/DataStructure/Behavioral/Iterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Defines the contract for iterating over a collection of elements.
1111
*
12-
* @category Interfaces
12+
* @category DataStructure\Behavioral
1313
*
1414
* @author Walmir Silva <walmir.silva@kariricode.org>
1515
* @license MIT

src/DataStructure/Behavioral/Modifiable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Defines the contract for modifying elements in a collection.
1111
*
12-
* @category Interfaces
12+
* @category DataStructure\Behavioral
1313
*
1414
* @author Walmir Silva <walmir.silva@kariricode.org>
1515
* @license MIT

src/DataStructure/Behavioral/Searchable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
* Defines the contract for searching elements in a collection.
1111
*
12-
* @category Interfaces
12+
* @category DataStructure\Behavioral
1313
*
1414
* @author Walmir Silva <walmir.silva@kariricode.org>
1515
* @license MIT

src/DataStructure/Behavioral/Sortable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Classes implementing this interface should provide an implementation
1212
* for the sort method to allow sorting of their elements.
1313
*
14-
* @category Interfaces
14+
* @category DataStructure\Behavioral
1515
*
1616
* @author Walmir Silva <walmir.silva@kariricode.org>
1717
* @license MIT

src/DataStructure/Deque.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Extends the Queue interface to define the contract for double-ended queue data structures,
1111
* which allow elements to be added and removed from both ends.
1212
*
13-
* @category Interfaces
13+
* @category DataStructure
1414
*
1515
* @author Walmir Silva <walmir.silva@kariricode.org>
1616
* @license MIT

src/DataStructure/Heap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Defines the contract for heap data structures.
1111
* A heap is a specialized tree-based data structure that satisfies the heap property.
1212
*
13-
* @category Interfaces
13+
* @category DataStructure
1414
*
1515
* @author Walmir Silva <walmir.silva@kariricode.org>
1616
* @license MIT

0 commit comments

Comments
 (0)