public function afferentCoupling(DependencyMap $map) : array
    {
        return $map->fromDependencies()->reduce([], function (array $afferent, Dependency $from) use ($map) {
            $afferent[$from->toString()] = $map->reduce(
                0,
                function (int $count, Dependency $fromOther, Dependency $to) use ($from): int {
                    return $from->equals($to)
                        ? $count + 1
                        : $count;
                }
            );
            return $afferent;
        });
    }
public function afferentCoupling(DependencyMap $map) : array
    {
        return $map->fromDependencies()->reduce([], function (array $afferent, Dependency $from) use ($map) {
            $afferent[$from->toString()] = $map->reduce(
                0,
                function (int $count, Dependency $fromOther, Dependency $to) use ($from): int {
                    return $from->equals($to)
                        ? $count + 1
                        : $count;
                }
            );
            return $afferent;
        });
    }
public function afferentCoupling ( DependencyMap $ map ) : array { return $ map -> fromDependencies ( ) -> reduce ( [ ] , function ( array $ afferent , Dependency $ from ) use ( $ map ) { $ afferent [ $ from -> toString ( ) ] = $ map -> reduce ( 0 , function ( int $ count , Dependency $ fromOther , Dependency $ to ) use ( $ from ) : int { return $ from -> equals ( $ to ) ? $ count + 1 : $ count ; } ) ; return $ afferent ; } ) ; }
Afferent coupling is an indicator for the responsibility of a package.

@param DependencyMap $map

@return array
Afferent coupling is an indicator for the responsibility of a package .